mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-18 15:54:22 +00:00
fixed issue 192:fixed geolocate control bug (#914)
This commit is contained in:
parent
bf6788edaa
commit
874e77464c
@ -110,10 +110,12 @@ export default class GeolocateControl extends BaseControl<
|
||||
componentWillUnmount() {
|
||||
// re-implement MapboxGeolocateControl's _onRemove
|
||||
// clear the geolocation watch if exists
|
||||
const geolocationWatchID = this._mapboxGeolocateControl._geolocationWatchID;
|
||||
if (geolocationWatchID !== undefined) {
|
||||
window.navigator.geolocation.clearWatch(geolocationWatchID);
|
||||
this._mapboxGeolocateControl._geolocationWatchID = undefined;
|
||||
if (this._mapboxGeolocateControl) {
|
||||
const geolocationWatchID = this._mapboxGeolocateControl._geolocationWatchID;
|
||||
if (geolocationWatchID !== undefined) {
|
||||
window.navigator.geolocation.clearWatch(geolocationWatchID);
|
||||
this._mapboxGeolocateControl._geolocationWatchID = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user