giorgiabosello / google-maps-react-markers

Google Maps library that accepts markers as react components and works with React 18+.
https://giorgiabosello.github.io/google-maps-react-markers/
MIT License
147 stars 19 forks source link

(feat) dynamic Transit Layer for the map #146

Closed kravchenko2805 closed 8 months ago

kravchenko2805 commented 12 months ago

Describe the feature you'd like to request

There was prop on MapComponent to control layers that could take array of strings like:

layerTypes={publicTransport ? ['TransitLayer'] : []}

in this case to show transit layer that could be controlled in options.styles object by specifying featureType

I have tried maps.TransitLayer(); at onGoogleApiLoaded event but it didn't work

Describe the solution you'd like

To have ability to control appearance of transit layer through GoogleMap props

Describe alternatives you've considered

To control appearance of transit layer through Map or GoogleApi instances at onGoogleApiLoaded event or through handlers

kravchenko2805 commented 12 months ago

There is a workaround for this:

inside onGoogleApiLoaded event: transitLayer.current = new maps.TransitLayer()

And trigger: on - transitLayer.current.setMap(map) off - transitLayer.current.setMap(null)

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 10 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.