Skip to content

Commit 4501782

Browse files
Remove deprecated props (google-map-react#952)
* Remove heatmapLibrary that we flagged as deprecated in google-map-react#948 * Remove apiKey which has been deprecated for a long time * Remove onBoundsChange which has been deprecated for a long time
1 parent 2dc51dd commit 4501782

File tree

6 files changed

+97
-145
lines changed

6 files changed

+97
-145
lines changed

API.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
### parameters
44

5-
#### apiKey (string) (_Deprecated use bootstrapURLKeys_)
6-
7-
Google maps api key.
8-
95
#### bootstrapURLKeys (object)
106

117
Example:
@@ -16,7 +12,7 @@ Example:
1612
key: API_KEY,
1713
language: 'ru',
1814
region: 'ru',
19-
libraries:['places'],
15+
libraries: ['places'],
2016
...otherUrlParams,
2117
}}
2218
>
@@ -103,16 +99,6 @@ Example:
10399
<GoogleMap onClick={_onClick} ... />
104100
```
105101

106-
#### onBoundsChange (func) (_Deprecated use onChange_)
107-
108-
```
109-
({ center, zoom, bounds, marginBounds })
110-
```
111-
```
112-
[lat, lng] = center;
113-
[topLat, leftLng, bottomLat, rightLng] = bounds;
114-
```
115-
116102
#### resetBoundsOnResize (bool)
117103

118104
When true this will reset the map bounds if the parent resizes.

CHANGELOG.md

Lines changed: 72 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1+
## [unreleased(major)]
2+
3+
- Remove deprecated props (#952):
4+
- Remove `apiKey` which has been deprecated for a long time
5+
- Remove `heatmapLibrary` that we flagged as deprecated in #948
6+
- Remove `onBoundsChange` which has been deprecated for a long time
7+
8+
## [2.1.6] - 2020-09-25
9+
10+
- Change `componentWillReceiveProps` to `componentDidUpdate` (#950)
11+
12+
## [2.1.5] - 2020-09-22
13+
14+
- Use `@googlemaps/js-api-loader` (#946)
15+
- Fix libraries usage (#946)
16+
17+
## [2.1.3] - 2020-09-01
18+
19+
- Produce CommonJS and UMD bundles (#932)
20+
121
## [2.1.0] - 2020-08-31
222

3-
- #921 Add support to libraries: places, visualization, places, and geomerty.
23+
- Add support to libraries: places, visualization, places, and geomerty. (#921)
424
And keeps support for previous heatMapLibrary prop to avoid breaking older usage.
525

626
## [2.0.4] - 2020-07-30
@@ -9,12 +29,12 @@ And keeps support for previous heatMapLibrary prop to avoid breaking older usage
929

1030
## [2.0.2] - 2020-07-30
1131

12-
- #878 Fix heatmap options not being updated
32+
- Fix heatmap options not being updated (#878)
1333

1434
## [2.0.1] - 2020-07-30
1535

16-
- #864 On resize it's getting undefined minZoom
17-
- #873 Moves marker dispatcher binds to componentDidMount
36+
- On resize it's getting undefined minZoom (#864)
37+
- Moves marker dispatcher binds to componentDidMount (#873)
1838

1939
## [2.0.0] - 2020-07-30
2040

@@ -25,120 +45,120 @@ And keeps support for previous heatMapLibrary prop to avoid breaking older usage
2545

2646
## [1.1.7] - 2020-03-17
2747

28-
- #835 Add dev folders to .gitignore
48+
- Add dev folders to .gitignore (#835)
2949

3050
## [1.1.6] - 2020-02-04
3151

32-
- #827 Updated China base url
52+
- Updated China base url (#827)
3353

3454
## [1.1.5] - 2019-09-20
3555

36-
- #778 Add UNSAFE_ prefix to deprecated lifecycle methods
37-
- #769 Move prop-types to dependencies
38-
- #759 Add shouldUnregisterMapOnUnmount prop to persist map object on unmount
39-
- #754 Add prop 'onDragEnd'
56+
- Add UNSAFE_ prefix to deprecated lifecycle methods (#778)
57+
- Move prop-types to dependencies (#769)
58+
- Add shouldUnregisterMapOnUnmount prop to persist map object on unmount (#759)
59+
- Add prop 'onDragEnd' (#754)
4060

4161
## [1.1.4] - 2019-04-03
4262

43-
- #738 Revert #726 Google Map loader respecting the app language change
44-
- #739 Revert #722 Add shouldUnregisterMapOnUnmount prop to persist map object on unmount
63+
- Revert #726 Google Map loader respecting the app language change (#738)
64+
- Revert #722 Add shouldUnregisterMapOnUnmount prop to persist map object on unmount (#739)
4565

4666
## [1.1.3] - 2019-04-01
4767

48-
- #726 Google Map loader respecting the app language change
49-
- #722 Add shouldUnregisterMapOnUnmount prop to persist map object on unmount
50-
- #728 Fix: Update heatmap layer when heatmap positions prop changes
68+
- Google Map loader respecting the app language change (#726)
69+
- Add shouldUnregisterMapOnUnmount prop to persist map object on unmount (#722)
70+
- Fix: Update heatmap layer when heatmap positions prop changes (#728)
5171

5272
## [1.1.2] - 2018-12-18
5373

54-
- #696 Add React 16 createPortal with backwards compatibility
74+
- Add React 16 createPortal with backwards compatibility (#696)
5575

5676
## [1.1.1] - 2018-10-21
5777

58-
- #679 Revert #593 (had a problem with the way of importing libraries)
78+
- Revert #593 (had a problem with the way of importing libraries) (#679)
5979

6080
## [1.1.0] - 2018-10-08
6181

62-
- #655 Add math abs to avoid negative values when calculating zoom
63-
- #656 Pass map instance to onDrag handler
64-
- #593 Added feature: update heat map on data change + fix linting
82+
- Add math abs to avoid negative values when calculating zoom (#655)
83+
- Pass map instance to onDrag handler (#656)
84+
- Added feature: update heat map on data change + fix linting (#593)
6585

6686
## [1.0.9] - 2018-09-29
6787

68-
- #634 Custom div style options
88+
- Custom div style options (#634)
6989

7090
## [1.0.8] - 2018-09-21
7191

72-
- #645 Revert #643 Use React 16 map portal to render map overlay. Was causing problems for users using React version < 16
92+
- Revert #643 Use React 16 map portal to render map overlay. Was causing problems for users (#645)using React version < 16
7393

7494
## [1.0.7] - 2018-09-20
7595

76-
- #631 Add passive scroll
77-
- #643 Use React 16 map portal to render map overlay
96+
- Add passive scroll (#631)
97+
- Use React 16 map portal to render map overlay (#643)
7898

7999
## [1.0.6] - 2018-08-03
80100

81-
- #620 Fix bug in fromContainerPixelToLatLng()
82-
- #615 Add prop `onTilesLoaded`
101+
- Fix bug in fromContainerPixelToLatLng() (#620)
102+
- Add prop `onTilesLoaded` (#615)
83103

84104
## [1.0.5] - 2018-06-26
85105

86-
- #605 Fix build
87-
- #603 Remove marker jiggle, Issue #575
106+
- Fix build (#605)
107+
- Remove marker jiggle, Issue #575 (#603)
88108

89109
## [1.0.4] - 2018-06-11
90110

91-
- #570 Avoid null error
92-
- #594 Add guard around mapDom event listener
93-
- #592 Move dep for react-dom
111+
- Avoid null error (#570)
112+
- Add guard around mapDom event listener (#594)
113+
- Move dep for react-dom (#592)
94114

95115
## [1.0.3] - 2018-05-17
96116

97-
- #580: Scales tiles properly
117+
-: Scales tiles properly (#580)
98118

99119
## [1.0.2] - 2018-05-13
100120

101-
- #577 Move react-dom to dependencies
121+
- Move react-dom to dependencies (#577)
102122

103123
## [1.0.1] - 2018-05-12
104124

105-
- #572 Add weights to the heatmap
125+
- Add weights to the heatmap (#572)
106126

107127
## [1.0.0] - 2018-04-27
108128

109-
- #559 Fix soom animation for google maps' version 3.32
110-
- #548 Improves to documentation
111-
- #535 Remove lodash completely, using our own functions, now the build size is 4 times smaller.
112-
- #533 Fixes some of the examples in the documentation
113-
- #555 & #563 Fix error Target container is not a DOM element
129+
- Fix soom animation for google maps' version 3.32 (#559)
130+
- Improves to documentation (#548)
131+
- Remove lodash completely, using our own functions, now the build size is 4 times smaller. (#535)
132+
- Fixes some of the examples in the documentation (#533)
133+
- & #563 Fix error Target container is not a DOM element (#555)
114134

115135
## [0.34.0] - 2018-04-27
116136

117-
- #521 Upgrade .babelrc
118-
- #211 Call zoomControlClickTime on all clicks
119-
- #530 Set latest release version as default if user does not specify a version
137+
- Upgrade .babelrc (#521)
138+
- Call zoomControlClickTime on all clicks (#211)
139+
- Set latest release version as default if user does not specify a version (#530)
120140

121141
## [0.33.0] - 2018-03-09
122142

123-
- #504 Added loose to es2015 for IE10, IE11 support
124-
- #517 Fix error about fromLatLngToDivPixel
125-
- #525 Accept 0 as zoom value
126-
- #529 Update package.json
143+
- Added loose to es2015 for IE10, IE11 support (#504)
144+
- Fix error about fromLatLngToDivPixel (#517)
145+
- Accept 0 as zoom value (#525)
146+
- Update package.json (#529)
127147

128148
## [0.30.0] - 2018-02-12
129149

130-
- #441 Add heatmap functionality
131-
- #496 Fix support for china
150+
- Add heatmap functionality (#441)
151+
- Fix support for china (#496)
132152

133153
## [0.28.0] - 2018-01-18
134154

135-
- #494 Add support for China
155+
- Add support for China (#494)
136156

137157
## [0.27.0] - 2018-01-04
138158

139-
- #485 Add fullscreen check for Internet explorer 11
140-
- #482 Make `resetBoundsOnResize` preserve center when full-screened
141-
- #483 Updates yarn.lock to fix @mapbox/point-geometry warning
159+
- Add fullscreen check for Internet explorer 11 (#485)
160+
- Make `resetBoundsOnResize` preserve center when full-screened (#482)
161+
- Updates yarn.lock to fix @mapbox/point-geometry warning (#483)
142162

143163
## [0.9]
144164

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"react-dom": "^16.0.0"
3737
},
3838
"devDependencies": {
39+
"@mapbox/point-geometry": "^0.1.0",
3940
"babel-eslint": "^10.0.3",
4041
"cross-env": "^7.0.2",
4142
"eslint": "^6.8.0",

src/google_map.js

Lines changed: 16 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ const isFullScreen = () =>
9797

9898
class GoogleMap extends Component {
9999
static propTypes = {
100-
apiKey: PropTypes.string,
101100
bootstrapURLKeys: PropTypes.any,
102101

103102
defaultCenter: PropTypes.oneOfType([
@@ -167,7 +166,6 @@ class GoogleMap extends Component {
167166
},
168167
layerTypes: [],
169168
heatmap: {},
170-
heatmapLibrary: false,
171169
shouldUnregisterMapOnUnmount: true,
172170
};
173171

@@ -197,7 +195,6 @@ class GoogleMap extends Component {
197195

198196
this.markersDispatcher_ = new MarkerDispatcher(this);
199197
this.geoService_ = new Geo(K_GOOGLE_TILE_SIZE);
200-
this.centerIsObject_ = isPlainObject(this.props.center);
201198

202199
this.minZoom_ = DEFAULT_MIN_ZOOM;
203200
this.defaultDraggableOption_ = true;
@@ -209,36 +206,6 @@ class GoogleMap extends Component {
209206

210207
this.googleMapDom_ = null;
211208

212-
if (process.env.NODE_ENV !== 'production') {
213-
if (this.props.apiKey) {
214-
console.warn(
215-
'GoogleMap: ' + // eslint-disable-line no-console
216-
'apiKey is deprecated, use ' +
217-
'bootstrapURLKeys={{key: YOUR_API_KEY}} instead.'
218-
);
219-
}
220-
221-
if (this.props.onBoundsChange) {
222-
console.warn(
223-
'GoogleMap: ' + // eslint-disable-line no-console
224-
'onBoundsChange is deprecated, use ' +
225-
'onChange({center, zoom, bounds, ...other}) instead.'
226-
);
227-
}
228-
229-
if (isEmpty(this.props.center) && isEmpty(this.props.defaultCenter)) {
230-
console.warn(
231-
'GoogleMap: center or defaultCenter property must be defined' // eslint-disable-line no-console
232-
);
233-
}
234-
235-
if (isEmpty(this.props.zoom) && isEmpty(this.props.defaultZoom)) {
236-
console.warn(
237-
'GoogleMap: zoom or defaultZoom property must be defined' // eslint-disable-line no-console
238-
);
239-
}
240-
}
241-
242209
if (this._isCenterDefined(this.props.center || this.props.defaultCenter)) {
243210
const propsCenter = latLng2Obj(
244211
this.props.center || this.props.defaultCenter
@@ -258,6 +225,20 @@ class GoogleMap extends Component {
258225
}
259226

260227
componentDidMount() {
228+
if (process.env.NODE_ENV !== 'production') {
229+
if (isEmpty(this.props.center) && isEmpty(this.props.defaultCenter)) {
230+
console.warn(
231+
'GoogleMap: center or defaultCenter property must be defined' // eslint-disable-line no-console
232+
);
233+
}
234+
235+
if (isEmpty(this.props.zoom) && isEmpty(this.props.defaultZoom)) {
236+
console.warn(
237+
'GoogleMap: zoom or defaultZoom property must be defined' // eslint-disable-line no-console
238+
);
239+
}
240+
}
241+
261242
this.mounted_ = true;
262243
addPassiveEventListener(window, 'resize', this._onWindowResize, false);
263244
addPassiveEventListener(window, 'keydown', this._onKeyDownCapture, true);
@@ -275,12 +256,8 @@ class GoogleMap extends Component {
275256
}
276257

277258
addPassiveEventListener(window, 'mouseup', this._onChildMouseUp, false);
278-
const bootstrapURLKeys = {
279-
...(this.props.apiKey && { key: this.props.apiKey }),
280-
...this.props.bootstrapURLKeys,
281-
};
282259

283-
this.props.googleMapLoader(bootstrapURLKeys, this.props.heatmapLibrary); // we can start load immediatly
260+
this.props.googleMapLoader(this.props.bootstrapURLKeys); // we can start load immediatly
284261

285262
setTimeout(
286263
() => {
@@ -545,13 +522,8 @@ class GoogleMap extends Component {
545522

546523
this._onBoundsChanged(); // now we can calculate map bounds center etc...
547524

548-
const bootstrapURLKeys = {
549-
...(this.props.apiKey && { key: this.props.apiKey }),
550-
...this.props.bootstrapURLKeys,
551-
};
552-
553525
this.props
554-
.googleMapLoader(bootstrapURLKeys, this.props.heatmapLibrary)
526+
.googleMapLoader(this.props.bootstrapURLKeys)
555527
.then((maps) => {
556528
if (!this.mounted_) {
557529
return;
@@ -1061,16 +1033,6 @@ class GoogleMap extends Component {
10611033
if (!isArraysEqualEps(bounds, this.prevBounds_, kEPS)) {
10621034
if (callExtBoundsChange !== false) {
10631035
const marginBounds = this.geoService_.getBounds(this.props.margin);
1064-
if (this.props.onBoundsChange) {
1065-
this.props.onBoundsChange(
1066-
this.centerIsObject_
1067-
? { ...centerLatLng }
1068-
: [centerLatLng.lat, centerLatLng.lng],
1069-
zoom,
1070-
bounds,
1071-
marginBounds
1072-
);
1073-
}
10741036

10751037
if (this.props.onChange) {
10761038
this.props.onChange({

0 commit comments

Comments
 (0)