react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

backgroundColor in GoogleMap options not working

Open Talmaj opened this issue 7 years ago • 3 comments

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).

Talmaj avatar Feb 05 '18 21:02 Talmaj

Could you provide a code example of your mentioned solution?

sambokai avatar Jun 21 '18 23:06 sambokai

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;
}

juxton avatar Nov 27 '18 18:11 juxton

I added this to my map container to adjust the direct child and it worked: .map-container { & > div { background-color: $dark-gray !important; } }

WillsWebsites avatar Sep 24 '23 08:09 WillsWebsites