【发布时间】:2019-03-13 20:39:27
【问题描述】:
我有这种方法可以通过单击按钮来获取当前位置,它将获取当前位置。我想在不点击该按钮的情况下获取位置。
getLocationHandler = () =>{
navigator.geolocation.getCurrentPosition(pos =>{
const coordsEvent ={
nativeEvent :{
coordinate : {
latitude : pos.coords.latitude,
longitude : pos.coords.longitude
}
}
};
this.pickLocationHandler(coordsEvent);
},
err => {
console.log(err);
alert("Fetching the position failed,Please pick one manually")
})
}
【问题讨论】:
-
您想定期获取位置吗?在特定事件之后?
-
我想在地图屏幕打开时显示当前位置
标签: react-native react-native-android react-native-maps