The example provided in the examples of the react-native-maps repo on GitHub shows a button to execute a function to set the appropriate zoom considering to a list of markers:
fitAllMarkers() {
this.map.fitToCoordinates(MARKERS, {
edgePadding: DEFAULT_PADDING,
animated: true,
});
}
https://github.com/airbnb/react-native-maps/blob/master/docs/mapview.md
Would it be possible to initialize the map with the appropriate fit given an array of markers already initialized ?
When trying to set the right fit on the componentDidMount
, I am receiving:
Error using new LatLntBounds(LatLngBounds, int): Map size can't be 0. Most likely, layout has not yet occured for the map view
.
It is definitively too early to call my fitAllMarkers()
function.
Is there a onLoad
function that can be triggered right after the map was initialized ?