Hi,
it seems like there is no official way to trigger a resize event. Before i could use triggerResize(), however I can't find such a helper method anymore. The only way I can trigger a resize event is via google.maps.event.trigger(this.map.context[__SECRET_MAP_DO_NOT_USE_OR_YOU_WILL_BE_FIRED], 'resize') with this.map being the instance passed in onMapMounted. This seems really dirty. Is there a proper way to trigger a resize event?
Oh my, this is a thing! Thanks for pointing out this 'secret' map object. I finally can do resize on this library
try this one
import { GoogleMap } from 'react-google-maps';
import { MAP } from 'react-google-maps/lib/constants';
import ReactResizeDetector from 'react-resize-detector';
...
const mapInstance = map && map.context[MAP];
const onResize = () => google.maps.event.trigger(mapInstance, 'resize'),
...
<GoogleMap>
<ReactResizeDetector handleWidth handleHeight onResize={onResize} />
</GoogleMap>
Any where i can see the full implementation of resize of map on window resize
Please refer to Getting Help section in the README (or #469).
Most helpful comment
try this one