Reactjs 显示错误当前位置的反应传单
我使用给定的代码来计算我的浏览器的位置,但这是大错特错的,我处于不同的状态。 而且画的圆太大了。为什么会这样Reactjs 显示错误当前位置的反应传单,reactjs,react-native,geolocation,leaflet,Reactjs,React Native,Geolocation,Leaflet,我使用给定的代码来计算我的浏览器的位置,但这是大错特错的,我处于不同的状态。 而且画的圆太大了。为什么会这样 map.locate({ setView:true }); map.on('locationfound', handleOnLocationFound); const handleOnLocationFound = (event: any) => { const { current = {} } = mapRef; co
map.locate({
setView:true
});
map.on('locationfound', handleOnLocationFound);
const handleOnLocationFound = (event: any) => {
const { current = {} } = mapRef;
const { leafletElement: map } = current;
const latlng = event.latlng;
setMyPosition(latlng);
const radius = 10;
const circle = L.circle(latlng, radius);
circle.addTo(map);
};