Safari onChange bounds and size invalid values
Hi there! Some weird stuff is going on Safari. Not quite sure the reason but seems like a condition race is taking place somewhere.
Describe the bug 🐛
First onChange triggered once the map is loaded is returning invalid bounds and size values on the event object on Safari. It's working perfectly in Chrome.
To Reproduce 🔍
Steps to reproduce the behavior:
- Mount the component
- Debug event on the onChange callback once the map is loaded
- Observe values
Expected behavior 💭
On chrome the event it's returning correct values for the initial center passed in the props.

Screenshots 🖥
On Safari, seems like there is a condition race. Most of the time, the event comes with incorrect values. Sometimes, the value are correct.

Environment:
- OS: OSX
- Browser: Safari
- Version: latest
Additional context
Code fragment of how Component is being called:
<GoogleMapReact
bootstrapURLKeys={{
key: window.GOOGLE_MAPS_CONFIG.apiKey,
libraries: 'places',
}}
defaultCenter={MAP_INITIAL_POSITION}
center={getInitialPosition()}
defaultZoom={getInitialZoom()}
onDrag={handleSetOnDrag}
onDragEnd={onDragEnd}
onZoomAnimationEnd={handleOnZoomEnd}
yesIWantToUseGoogleMapApiInternals
onGoogleApiLoaded={onGoogleApiLoaded}
onChange={handleChange}
options={{
fullscreenControl: false,
zoomControl: false,
styles: MAP_STYLES,
}}
>
{markers}
</GoogleMapReact>
Any ideas of what's going on? When I get a chance, I could have a look at the implementation, try to find the issue and send the PR for it.
It's interesting because I have the same problem with Chrome and I have all the correct values with Firefox.
I get this in capacitor as well. Doesn't always happen, seems pretty random whenever map first loads