google-maps-react-markers 1.1.7 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -8
- package/package.json +14 -15
package/README.md
CHANGED
|
@@ -75,8 +75,12 @@ const App = () => {
|
|
|
75
75
|
setMapReady(true)
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
const onMarkerClick = (markerId) => {
|
|
78
|
+
const onMarkerClick = (e, { markerId, lat, lng }) => {
|
|
79
79
|
console.log('This is ->', markerId)
|
|
80
|
+
|
|
81
|
+
// inside the map instance you can call any google maps method
|
|
82
|
+
mapRef.current.setCenter({ lat, lng })
|
|
83
|
+
// rif. https://developers.google.com/maps/documentation/javascript/reference?hl=it
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
return (
|
|
@@ -104,11 +108,13 @@ export default App
|
|
|
104
108
|
|
|
105
109
|
## 🧐 Props
|
|
106
110
|
|
|
111
|
+
### GoogleMap component
|
|
112
|
+
|
|
107
113
|
| Prop | Type | Required | Default | Description |
|
|
108
114
|
| -------------------- | -------- | -------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
109
|
-
| apiKey
|
|
110
|
-
| defaultCenter
|
|
111
|
-
| defaultZoom
|
|
115
|
+
| **apiKey** | string | **yes** | `''` | API Key to load Google Maps |
|
|
116
|
+
| **defaultCenter** | object | **yes** | `{ lat: 0, lng: 0 }` | Default center of the map |
|
|
117
|
+
| **defaultZoom** | number | **yes** | `1-20` | Default zoom of the map |
|
|
112
118
|
| libraries | array | no | `['places', 'geometry']` | Libraries to load |
|
|
113
119
|
| options | object | no | `{}` | Options for the map |
|
|
114
120
|
| onGoogleApiLoaded | function | no | `() => {}` | Callback when the map is loaded |
|
|
@@ -123,6 +129,13 @@ export default App
|
|
|
123
129
|
| containerProps | object | no | `{}` | Props for the div container of the map |
|
|
124
130
|
| scriptCallback | function | no | `() => {}` | window global callback passed to the Google Script |
|
|
125
131
|
|
|
132
|
+
### Markers
|
|
133
|
+
|
|
134
|
+
| Prop | Type | Required | Default | Description |
|
|
135
|
+
| ------- | ------ | -------- | ----------- | ----------------------- |
|
|
136
|
+
| **lat** | number | **yes** | `undefined` | Latitude of the marker |
|
|
137
|
+
| **lng** | number | **yes** | `undefined` | Longitude of the marker |
|
|
138
|
+
|
|
126
139
|
## 📍 Clustering
|
|
127
140
|
|
|
128
141
|
For clustering, follow this [guide](https://www.leighhalliday.com/google-maps-clustering) using [useSupercluster Hook](https://github.com/leighhalliday/use-supercluster), but use bounds in this way:
|
|
@@ -148,15 +161,15 @@ const onMapChange = ({ bounds, zoom }) => {
|
|
|
148
161
|
To run the project locally, clone the repo and run:
|
|
149
162
|
|
|
150
163
|
```bash
|
|
151
|
-
|
|
152
|
-
|
|
164
|
+
yarn install
|
|
165
|
+
yarn dev
|
|
153
166
|
```
|
|
154
167
|
|
|
155
168
|
```bash
|
|
156
169
|
# in another tab
|
|
157
170
|
cd docs
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
yarn install
|
|
172
|
+
yarn dev
|
|
160
173
|
```
|
|
161
174
|
|
|
162
175
|
Do your changes to `src/` or `docs/src` directory, commits all files (ones in `dist` too) and open a PR.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "google-maps-react-markers",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Google Maps library with markers as react components",
|
|
5
5
|
"author": "Giorgia Bosello",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,20 +44,19 @@
|
|
|
44
44
|
"react-dom": "^18.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/core": "^7.
|
|
48
|
-
"@babel/eslint-parser": "^7.
|
|
49
|
-
"@babel/preset-env": "^7.
|
|
47
|
+
"@babel/core": "^7.21.4",
|
|
48
|
+
"@babel/eslint-parser": "^7.21.3",
|
|
49
|
+
"@babel/preset-env": "^7.21.4",
|
|
50
50
|
"@babel/preset-react": "^7.18.6",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"eslint": "^8.
|
|
54
|
-
"eslint-config-prettier": "^8.6.0",
|
|
51
|
+
"cross-env": "^7.0.3",
|
|
52
|
+
"eslint": "^8.37.0",
|
|
53
|
+
"eslint-config-prettier": "^8.8.0",
|
|
55
54
|
"eslint-config-standard": "^17.0.0",
|
|
56
55
|
"eslint-config-standard-react": "^13.0.0",
|
|
57
56
|
"eslint-plugin-import": "^2.27.5",
|
|
58
57
|
"eslint-plugin-jsx": "^0.1.0",
|
|
59
|
-
"eslint-plugin-n": "^15.
|
|
60
|
-
"eslint-plugin-node": "^11.
|
|
58
|
+
"eslint-plugin-n": "^15.7.0",
|
|
59
|
+
"eslint-plugin-node": "^11.1.0",
|
|
61
60
|
"eslint-plugin-prettier": "^4.2.1",
|
|
62
61
|
"eslint-plugin-promise": "^6.1.1",
|
|
63
62
|
"eslint-plugin-react": "^7.32.2",
|
|
@@ -65,20 +64,20 @@
|
|
|
65
64
|
"eslint-plugin-standard": "^5.0.0",
|
|
66
65
|
"eslint-plugin-typescript": "^0.14.0",
|
|
67
66
|
"gh-pages": "^5.0.0",
|
|
68
|
-
"microbundle-crl": "^0.13.
|
|
67
|
+
"microbundle-crl": "^0.13.11",
|
|
69
68
|
"npm-run-all": "^4.1.5",
|
|
70
|
-
"prettier": "^2.8.
|
|
69
|
+
"prettier": "^2.8.7",
|
|
71
70
|
"react": "^18.2.0",
|
|
72
71
|
"react-dom": "^18.2.0",
|
|
73
72
|
"react-scripts": "^5.0.1",
|
|
74
|
-
"typescript": "^
|
|
73
|
+
"typescript": "^5.0.3"
|
|
75
74
|
},
|
|
76
75
|
"files": [
|
|
77
76
|
"dist"
|
|
78
77
|
],
|
|
79
78
|
"dependencies": {
|
|
80
|
-
"@babel/plugin-syntax-flow": "^7.
|
|
81
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
|
79
|
+
"@babel/plugin-syntax-flow": "^7.21.4",
|
|
80
|
+
"@babel/plugin-transform-react-jsx": "^7.21.0",
|
|
82
81
|
"prop-types": "^15.8.1"
|
|
83
82
|
}
|
|
84
83
|
}
|