teovillanueva / react-native-web-maps

Cross platform maps for react & react-native 🗺
https://teovillanueva.github.io/react-native-web-maps/
MIT License
54 stars 14 forks source link

fix: trigger onMapReady after map state has updated #10

Open robert-nash opened 1 year ago

robert-nash commented 1 year ago

If props.onMapReady is called immediately after setMap then a method called in props.onMapReady such as fitToCoordinates may not work correctly since map is still null.

Using an effect to trigger props.onMapReady means that by the time props.onMapReady is triggered MapView is ready not just the underlying GoogleMap.