ionic-team / ionic-team/capacitor-google-maps

bug: Map's styles property cannot be set when a mapId is present

Open
#96 1 comment 0 reactions 0 assignees View on GitHub
triage
Dominant language
TypeScript
Stars
32
Forks
47
PR merge metrics
No merged PRs in 30d

Description

you can't use styles, but I didn't set the mapId anywhere, but set by default

https://github.com/ionic-team/capacitor-google-maps/blob/e26260db7840de29c8450f12ffe05cf9ffe22b57/plugin/src/web.ts#L495

> Google Maps JavaScript API: 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. Please see documentation at https://developers.google.com/maps/documentation/javascript/styling#cloud_tooling

Image

```ts
const map = await GoogleMap.create({
id: 'my-cool-map',
element: mapRef.value,
apiKey: '',
config: {
center: {
lat: 33.6,
lng: -117.9,
},
zoom: 8,
heading: 0,
minZoom: 0,
maxZoom: 16,
styles: [
{
featureType: 'poi.attraction',
elementType: 'all',
stylers: [{ visibility: 'off' }],
},
{
featureType: 'poi.business',
stylers: [{ visibility: 'off' }],
},
{
featureType: 'transit',
elementType: 'labels.icon',
stylers: [{ visibility: 'off' }],
},
],
},
})
```

I assume that we need to move away from using mapId and use our own id to get the maps

Current solution use cloud based

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.