【发布时间】:2016-12-13 05:15:27
【问题描述】:
我们如何通过单击可拖动标记在react-native-maps 地图上创建新标记?此新标记将在单击发生时初始可拖动标记所在的位置创建。'
我可以从e.nativeEvent.coordinate 获得新标记的位置坐标,但是我们如何创建这个新标记呢?
createMarker(e) {
console.log(e.nativeEvent.coordinate) # here's the lng/lat for new marker
}
render() {
<MapView
ref='map'
initialRegion={{
latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
}}
>
<MapView.Marker
coordinate={{latitude: LATITUDE, longitude: LONGITUDE}}
onPress={(e) => this.setPickupLocation(e)}
draggable
></MapView.Marker>
</MapView>
}
【问题讨论】:
标签: javascript google-maps reactjs react-native react-native-maps