mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
Avoid null error (#570)
Avoid the error "Cannot read property 'removeEventListener' of null"
This commit is contained in:
parent
cdd6ec658f
commit
d6576f226f
@ -396,9 +396,11 @@ export default class GoogleMap extends Component {
|
||||
componentWillUnmount() {
|
||||
this.mounted_ = false;
|
||||
const mapDom = ReactDOM.findDOMNode(this.googleMapDom_);
|
||||
if (mapDom) {
|
||||
mapDom.removeEventListener('mousedown', this._onMapMouseDownNative, true);
|
||||
}
|
||||
window.removeEventListener('resize', this._onWindowResize);
|
||||
window.removeEventListener('keydown', this._onKeyDownCapture);
|
||||
mapDom.removeEventListener('mousedown', this._onMapMouseDownNative, true);
|
||||
window.removeEventListener('mouseup', this._onChildMouseUp, false);
|
||||
if (this.props.resetBoundsOnResize) {
|
||||
detectElementResize.removeResizeListener(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user