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

Documentation lacks styled Maps

Open MassivDash opened this issue 7 years ago • 2 comments

Hello, great job on this module.

However I have spent like an hour finding out how can I style these maps. Maybe you should include a little section that explains how to style these maps.

For anyone searching this : prepare json file with mapStyles, and attach it to Google Maps like this.

<GoogleMap id="basic-map-example" mapContainerStyle={{ height: "400px", width: "100%" }} options={{ styles: mapStyles }} zoom={15} center={{ lat: 52.088368, lng: 21.030126 }}

Thanks, for your great work on this.

MassivDash avatar Mar 01 '19 18:03 MassivDash

Hi @MassivDash, Thanks for the feedback. I think what needs to be emphasised is that react-google-maps-api is a very simple binding between react and the google maps api.

If you (or anyone else reading this) find yourself asking: How do I do this with react-google-maps-api You should be asking yourself: How do I do this with google maps. The answer is usually well documented in: https://developers.google.com/maps/documentation/javascript/reference/

Any property that has a setX function (setCenter, setHeading, setMapType etc...) can be passed as a prop to the component (center={...} heading={...}). Also, anything available via a component's options can be passed in the options property (as you eventually found out)

If you want a deep dive into the lib's codebase you can check out this video session I gave: https://www.youtube.com/watch?v=SySVBV_jcCM

We should probably do a clean write-up of this comment and add it to the docs. :-)

Cheers! Uri

uriklar avatar Mar 01 '19 19:03 uriklar

@uriklar I am passing heading as number as per document but it is not working, could you please help

Raam10 avatar Mar 01 '22 13:03 Raam10