Remove overwritten dotElement from geolocate control (#944)

This commit is contained in:
Xintong Xia 2019-11-22 15:06:51 -08:00 committed by GitHub
parent 08267e7a5f
commit 82d18af7e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,7 +96,6 @@ export default class GeolocateControl extends BaseControl<
_mapboxGeolocateControl: any = null;
_geolocateButtonRef: {current: null | HTMLButtonElement} = createRef();
_markerRef: {current: null | Marker} = createRef();
componentDidMount() {
isGeolocationSupported().then(result => {
@ -105,14 +104,6 @@ export default class GeolocateControl extends BaseControl<
});
}
componentDidUpdate() {
// MapboxGeolocateControl needs manipulate the style of Marker's container
const markerRef = this._markerRef.current;
if (this._mapboxGeolocateControl && markerRef) {
this._mapboxGeolocateControl._dotElement = markerRef._containerRef.current;
}
}
componentWillUnmount() {
// re-implement MapboxGeolocateControl's _onRemove
// clear the geolocation watch if exists
@ -235,7 +226,6 @@ export default class GeolocateControl extends BaseControl<
// $FlowFixMe
<Marker
key="location-maker"
ref={this._markerRef}
className="mapboxgl-user-location-dot"
longitude={markerPosition.longitude}
latitude={markerPosition.latitude}