Open loloide opened 1 year ago
Just use useState Hook
import { LatLng, LeafletView } from 'react-native-leaflet-view';
export default function App(){
const [DEFAULT_COORDINATES, setCoordinates]: LatLng = useState({
lat: 37.78825,
lng: -122.1324,
});
return(
<>
<LeafletView
mapCenterPosition={DEFAULT_COORDINATES}
/>
<Button onPress={() => {
setCoordinates({
lat: 40.706669,
lng: -73.997705
})
}/>
</>
)}
I hope it helps :)
i am trying to pan the camera of the map to a different location than the original one in the web version i can use
map.panTo(new L.LatLng(lat, lon));
and it moves the map to the coordinates.but in the React-Native version there is, as far as i'm concerned, no way to control it that way and have to instead use the props which i can't control dynamically.