You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`google-map-react` is a component written over a small set of the [Google Maps API](https://developers.google.com/maps/). It allows you to render any React component on the Google Map. It is fully isomorphic and can render on a server. Additionally, it can render map components in the browser even if the Google Maps API is not loaded. It uses an internal, tweakable hover algorithm - every object on the map can be hovered.
4
+
`google-map-react` is a component written over a small set of the [Google Maps API](https://developers.google.com/maps/). It allows you to render any React component on the Google Map. It is fully isomorphic and can render on a server. Additionally, it can render map components in the browser even if the Google Maps API is not loaded. It uses an internal, tweakable hover algorithm - every object on the map can be hovered.
5
5
6
6
It allows you to create interfaces like this [example](http://istarkov.github.io/google-map-react/map/main)*(You can scroll the table, zoom/move the map, hover/click on markers, and click on table rows)*
7
7
8
8
9
-
##Features
9
+
##Features
10
10
11
-
###Works with your Components
11
+
###Works with your Components
12
12
13
13
Instead of the ugly Google Maps markers, balloons and other map components, you can render your cool animated react components on the map.
14
14
15
-
###Isomorphic Rendering
15
+
###Isomorphic Rendering
16
16
17
17
It renders on the server. *(Welcome search engines)**(you can disable javascript in browser dev tools, and reload any example page to see how it works)*
18
18
19
-
###Component Positions Calculated Independently of Google Maps API
19
+
###Component Positions Calculated Independently of Google Maps API
20
20
21
21
It renders components on the map before (and even without) the Google Maps API loaded.
22
22
23
-
###Google Maps API Loads on Demand
23
+
###Google Maps API Loads on Demand
24
24
25
25
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 `GoogleMap` component.
26
26
27
-
###Internal Hover Algorithm
27
+
###Internal Hover Algorithm
28
28
29
29
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://istarkov.github.io/google-map-react/map/main), you will still be able to hover on almost every map marker.
30
30
31
31
This algorithm allows you to tweak hover probability of map objects, for example making some objects "more hoverable". [distance_hover example with different hover probabilities](http://istarkov.github.io/google-map-react/map/distance_hover)
32
32
33
-
##Known Issues
33
+
##Known Issues
34
34
35
35
* Small icons jiggle on Firefox (I don't see this in my older 'GoogleMap' version, so I will find the problem soon)
We no longer intend to support Bower. Please stop using Bower. NPM works very well for front-end development, and you should use it instead. ((c)Dan Abramov)
49
49
UMD AMD and other build are available under dist folder after `npm install`
50
50
51
-
##What's it Look Like?
51
+
##What's it Look Like?
52
52
53
53
In the simple case you just need to add `lat``lng` props to any child of `GoogleMap` component.
54
54
[simple example in action](http://istarkov.github.io/google-map-react/map/simple)
####apiKey (string) (_Deprecated use bootstrapURLKeys_)
114
+
####apiKey (string) (_Deprecated use bootstrapURLKeys_)
115
115
116
116
Google maps api key. (Optional, but your map will be rate-limited with no key)
117
117
118
-
####bootstrapURLKeys (object)
118
+
####bootstrapURLKeys (object)
119
119
120
-
Example:
120
+
Example:
121
121
122
122
```javascript
123
-
<GoogleMap
123
+
<GoogleMap
124
124
bootstrapURLKeys={{
125
125
key:API_KEY,
126
126
language:'ru',
@@ -129,45 +129,45 @@ Example:
129
129
>
130
130
```
131
131
132
-
####defaultCenter (array or object)
132
+
####defaultCenter (array or object)
133
133
134
134
`[lat, lng]` or `{ lat: lat, lng: lng}`
135
135
Default lat/lng at which to center the map - changing this prop throws a warning
136
136
137
-
####center (array or object)
137
+
####center (array or object)
138
138
139
139
`[lat, lng]` or `{ lat: lat, lng: lng}`
140
140
Lat/lng at which to center the map
141
141
142
-
####defaultZoom: (number)
142
+
####defaultZoom: (number)
143
143
144
144
Default map zoom level - changing this prop throws a warning
145
145
146
-
####zoom (number)
146
+
####zoom (number)
147
147
148
148
Map zoom level
149
149
150
-
####hoverDistance (number)
150
+
####hoverDistance (number)
151
151
152
152
Default: 30
153
153
154
-
####margin (array)
154
+
####margin (array)
155
155
156
156
In onChange callback, gives you a marginBounds argument property, where lat lng will be shifted using margin you have set. For example, you could use a simple check pointInRect to not show Markers near map bounds.
157
157
158
-
####debounced (bool)
158
+
####debounced (bool)
159
159
160
160
Default: true
161
161
162
162
### callbacks
163
163
164
-
####options (func|object)
164
+
####options (func|object)
165
165
166
166
Set map options such as controls positions / styles, etc.
167
167
168
168
Example:
169
169
170
-
```jsx
170
+
```javascript
171
171
createMapOptions:function (maps) {
172
172
return {
173
173
panControl:false,
@@ -181,23 +181,23 @@ createMapOptions: function (maps) {
181
181
```
182
182
See "Custom map options example" in Examples below for a further example.
183
183
184
-
####onClick (func)
184
+
####onClick (func)
185
185
186
186
`(x, y, lat, lng, event)`
187
187
188
188
The `event` prop in args is the outer div onClick event, not the gmap-api 'click' event.
189
189
190
190
Example:
191
191
192
-
```jsx
192
+
```javascript
193
193
_onClick= ({x, y, lat, lng, event}) =>console.log(x, y, lat, lng, event)
@@ -306,7 +306,7 @@ Initially any map object has its top left corner at lat lng coordinates. It's up
306
306
307
307
Example (centering the marker):
308
308
309
-
```jsx
309
+
```javascript
310
310
constMARKER_SIZE=40;
311
311
constgreatPlaceStyle= {
312
312
position:'absolute',
@@ -317,7 +317,7 @@ const greatPlaceStyle = {
317
317
}
318
318
```
319
319
320
-
```jsx
320
+
```javascript
321
321
render() {
322
322
return (
323
323
<div style={greatPlaceStyle}>
@@ -331,7 +331,7 @@ render() {
331
331
332
332
If at the moment of GoogleMap control created, a modal has no size (width,height=0) or/and not displayed, the simple solution is to add something like this in render:
0 commit comments