MapTypeId is not set from props if mapOptions is used
Please provide an explanation
props.mapTypeId on GoogleMap does not do any difference if props.mapOptions (without mapTypeId) is passed to the component.
Your Environment
os: mac
node --version 11.7
react version 16.8.6
webpack version 4.34
@babel version 7.4.5
@react-google-maps/api version 1.7.7
How is it behave?
The map type on google maps is always set to "roadmap" if mapOptions (without mapTypeId) is passed to the GoogleMaps-component
How should it behave correctly?
The prop mapTypeId on GoogleMaps should be the one that is passed down to google-maps, even though a mapOptions is present.
@gson88 Can you please provide minimal reproduction on codesandbox?
@JustFly1984 I certainly can, sorry for not providing one from the beginning. https://codesandbox.io/s/usegooglemap-repro-gyt0k mapTypeId is set to "hybrid", but the mapTypeId being set on the map is "roadmap"
I also just ran into this issue. But I was able to get around it by just always including "mapTypeId" into the mapOptions and stopped passing it into the map.
@dogofpavlov Yeah that is possible. The problem for us is that we don't have the global google-object when the mapOptions-object is created (we want to create the object outside of the component to prevent re-rendering). We solved it by setting the mapType when the map had loaded instead.