react-google-maps
react-google-maps copied to clipboard
backgroundColor in GoogleMap options not working
backgroundColor set in options or defaultOptions in GoogleMap does not work as described here.
The following snippet is not working correctly:
<GoogleMap defaultOptions={{backgroundColor: "orange"}}/>
One solution I found is if the defaultOptions are initialized in handleComponentMount
method in withGoogleMap.jsx
, directly when initializing new google.maps.Map(node, defaultOptions)
.
Could you provide a code example of your mentioned solution?
To anyone tracking this issue, here was my solution to workaround the broken defaultOption methodology:
const oContainerStyle = {
backgroundColor: 'somecolor'
};
containerElement={<div style={oContainerStyle} />}
mapElement={<div className="mapElement" />}
.mapElement > div {
background-color: transparent !important;
}
I added this to my map container to adjust the direct child and it worked:
.map-container { & > div { background-color: $dark-gray !important; } }