mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
Update README.md (#698)
* Update README.md * Update README.md * Update README.md * Add javascript tag * Update README.md
This commit is contained in:
parent
4d863d9ddc
commit
3d7c9823e4
34
README.md
34
README.md
@ -37,7 +37,7 @@ class SimpleMap extends Component {
|
||||
<AnyReactComponent
|
||||
lat={59.955413}
|
||||
lng={30.337844}
|
||||
text={'Kreyser Avrora'}
|
||||
text="My Marker"
|
||||
/>
|
||||
</GoogleMapReact>
|
||||
</div>
|
||||
@ -83,6 +83,38 @@ It renders components on the map before (and even without) the Google Maps API l
|
||||
|
||||
There is no need to place a `<script src=` tag at top of page. The Google Maps API loads upon the first usage of the `GoogleMapReact` component.
|
||||
|
||||
### Anything you can do with Google Maps, you can do with Google Map React
|
||||
|
||||
You can access to Google Maps `map` and `maps` objects by using `onGoogleApiLoaded`, in this case you will need to set `yesIWantToUseGoogleMapApiInternals` to `true`
|
||||
|
||||
```javascript
|
||||
...
|
||||
|
||||
const handleApiLoaded = (map, maps) => {
|
||||
// use map and maps objects
|
||||
};
|
||||
|
||||
...
|
||||
|
||||
<GoogleMapReact
|
||||
bootstrapURLKeys={{ key: /* YOUR KEY HERE */ }}
|
||||
defaultCenter={this.props.center}
|
||||
defaultZoom={this.props.zoom}
|
||||
yesIWantToUseGoogleMapApiInternals
|
||||
onGoogleApiLoaded={({ map, maps }) => handleApiLoaded(map, maps)}
|
||||
>
|
||||
<AnyReactComponent
|
||||
lat={59.955413}
|
||||
lng={30.337844}
|
||||
text="My Marker"
|
||||
/>
|
||||
</GoogleMapReact>
|
||||
```
|
||||
|
||||
PST: Remember to set `yesIWantToUseGoogleMapApiInternals` to true.
|
||||
|
||||
[Example here](https://github.com/google-map-react/google-map-react-examples/blob/master/src/examples/Main.js#L69)
|
||||
|
||||
### Internal Hover Algorithm
|
||||
|
||||
Now every object on the map can be hovered (however, you can still use css hover selectors if you want). If you try zooming out here [example](http://google-map-react.github.io/google-map-react/map/main), you will still be able to hover on almost every map marker.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user