Reactjs 用户可以更改本地地图中的标记位置吗?
我有一个带有用户当前位置标记的地图,但我想用户可以更改标记的位置这可能是我代码的一部分: 基金会:Reactjs 用户可以更改本地地图中的标记位置吗?,reactjs,maps,position,native,marker,Reactjs,Maps,Position,Native,Marker,我有一个带有用户当前位置标记的地图,但我想用户可以更改标记的位置这可能是我代码的一部分: 基金会: componentDidMount(){ navigator.geolocation.getCurrentPosition(position =>{ this.setState({ latitude : position.coords.latitude, longitude : position.coords.long
componentDidMount(){
navigator.geolocation.getCurrentPosition(position =>{
this.setState({
latitude : position.coords.latitude,
longitude : position.coords.longitude,
erreur: null
});
erreur => this.setState({ error: error.message}),
{enableHighAccuracy: true , timeout:20000, maximumAge: 2000}
});
}
观点:
<MapView
style={styles.mapStyle}
initialRegion={{
latitude: this.state.latitude,
longitude: this.state.longitude,
latitudeDelta: 1,
longitudeDelta: 2
}}
>
<Marker coordinate= {this.state}/>
</MapView>