在React Native中,我正在使用react-native-maps开发一个示例应用程序。它工作得很好,但是我没有找到:如何显示从当前位置到另一个地址或位置的路线地图?
这是我的代码:
这是我的代码:
<MapView
ref='map'
style={styles.map}
region={this.state.mapRegion}
showsUserLocation={true}
followUserLocation={true}
zoomEnabled={true}
pitchEnabled={true}
showsCompass={true}
showsBuildings={true}
showsTraffic={true}
showsIndoors={true}
onRegionChange={this.onRegionChange.bind(this)}
onPress={this.onMapPress.bind(this)}
>
{this.state.markers.map(marker => (
<MapView.Marker
coordinate={{
latitude: marker.Latitude || this.state.lastLat || region.latitude,
longitude: marker.Longitude || this.state.lastLong || region.longitude
}}
image = {
marker.EmergencyService == true ?(
require('./Imgs/emergencyService.png')):
(require('./Imgs/regularService.png'))
}
onCalloutPress={() => this.bookDoctorsAppointment(marker)}
>
<MyCustomMarkerView marker={marker} navigator={this.props.navigator}/>
</MapView.Marker>
))}
</MapView>
实际上,在此代码中,我展示了一些标记列表,但我不需要所有标记的路线图...我只想显示一些特定标记到当前位置。
这里我附上了我想要的图片: