Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/google_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,12 @@ class GoogleMap extends Component {
// remove zoom, center and draggable options as these are managed by google-maps-react
options = omit(options, ['zoom', 'center', 'draggable']);

// A Map's styles property cannot be set when a mapId is present.
// When a mapId is present Map styles are controlled via the cloud console.
if ('mapId' in options) {
options = omit(options, ['styles']);
}

if ('minZoom' in options) {
const minZoom = this._computeMinZoom(options.minZoom);
options.minZoom = _checkMinZoom(options.minZoom, minZoom);
Expand Down Expand Up @@ -585,7 +591,7 @@ class GoogleMap extends Component {
// "MaxZoomStatus", "StreetViewStatus", "TransitMode", "TransitRoutePreference",
// "TravelMode", "UnitSystem"
const mapPlainObjects = pick(maps, isPlainObject);
const options =
let options =
typeof this.props.options === 'function'
? this.props.options(mapPlainObjects)
: this.props.options;
Expand All @@ -598,6 +604,12 @@ class GoogleMap extends Component {
const minZoom = this._computeMinZoom(options.minZoom);
this.minZoom_ = minZoom;

// A Map's styles property cannot be set when a mapId is present.
// When a mapId is present Map styles are controlled via the cloud console.
if ('mapId' in options) {
options = omit(options, ['styles']);
}

const preMapOptions = {
...defaultOptions,
minZoom,
Expand Down