Geolocation.getCurrentPosition()
.then(data => {
console.log('------------mapdata-------------------');
console.log(data);
Geolocation.reverseGeoCode(data.latitude,data.longitude)
.then(dataAddress=>{
console.log('------------reverseGeoCode-------------------');
console.log(dataAddress);
this.setState({
address: dataAddress.address,
});
}) .catch(e =>{
console.warn(e, 'error');
});
this.setState({
zoom: 18,
marker: {
latitude: data.latitude,
longitude: data.longitude,
title: "当前位置"
},
center: {
latitude: data.latitude,
longitude: data.longitude,
title:""
}
});
})
.catch(e =>{
console.warn(e, 'error');
});
}