Skip to content

Update README.md #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2020
Merged
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
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,45 @@ The `<Circle />` component listens to `onClick`, `onMouseover` and `onMouseout`

The `GoogleApiWrapper` automatically passes the `google` instance loaded when the component mounts (and will only load it once).

#### Custom Map Style

To set your own custom map style, import your custom map style in JSON format.

```javascript
const mapStyle = [
{
featureType: 'landscape.man_made',
elementType: 'geometry.fill',
stylers: [
{
color: '#dceafa'
}
]
},
]

_mapLoaded(mapProps, map) {
map.setOptions({
styles: mapStyle
})
}

render() {
return (
<Map
style={style}
google={this.props.google}
zoom={this.state.zoom}
initialCenter={this.state.center}
onReady={(mapProps, map) => this._mapLoaded(mapProps, map)}
>
...
</Map>
);
}

```

## Manually loading the Google API

If you prefer not to use the automatic loading option, you can also pass the `window.google` instance as a `prop` to your `<Map />` component.
Expand Down