mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
commit
8fc399b1a5
File diff suppressed because it is too large
Load Diff
6
lib/umd/GoogleMapReact.min.js
vendored
6
lib/umd/GoogleMapReact.min.js
vendored
File diff suppressed because one or more lines are too long
@ -141,7 +141,7 @@ export default class GoogleMap extends Component {
|
||||
|
||||
// render in overlay
|
||||
const this_ = this;
|
||||
const overlay = assign(new maps.OverlayView(), {
|
||||
const overlay = this.overlay_ = assign(new maps.OverlayView(), {
|
||||
onAdd() {
|
||||
const K_MAX_WIDTH = (typeof screen !== 'undefined') ? `${screen.width}px` : '2000px';
|
||||
const K_MAX_HEIGHT = (typeof screen !== 'undefined') ? `${screen.height}px` : '2000px';
|
||||
@ -176,6 +176,10 @@ export default class GoogleMap extends Component {
|
||||
);
|
||||
},
|
||||
|
||||
onRemove() {
|
||||
React.unmountComponentAtNode(this.div);
|
||||
},
|
||||
|
||||
draw() {
|
||||
const div = overlay.div;
|
||||
const overlayProjection = overlay.getProjection();
|
||||
@ -385,6 +389,11 @@ export default class GoogleMap extends Component {
|
||||
|
||||
window.removeEventListener('resize', this._onWindowResize);
|
||||
|
||||
if (this.overlay_) {
|
||||
// this triggers overlay_.onRemove(), which will unmount the <GoogleMapMarkers/>
|
||||
this.overlay_.setMap(null);
|
||||
}
|
||||
|
||||
if (this.maps_ && this.map_) {
|
||||
this.maps_.event.clearInstanceListeners(this.map_);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user