Revert 643 fix/map context by itsmichaeldiego · Pull Request #645 · google-map-react/google-map-react

Expand Up @@ -239,7 +239,7 @@ export default class GoogleMap extends Component { this.zoomAnimationInProgress_ = false;
this.state = { overlay: null, overlayCreated: false, }; }
Expand Down Expand Up @@ -587,7 +587,7 @@ export default class GoogleMap extends Component { : '2000px';
const div = document.createElement('div'); this.overlay = div; this.div = div; div.style.backgroundColor = 'transparent'; div.style.position = 'absolute'; div.style.left = '0px'; Expand All @@ -601,21 +601,29 @@ export default class GoogleMap extends Component { maps, overlay.getProjection() );
this_.setState(state => ({ ...state, overlay: div, })); ReactDOM.unstable_renderSubtreeIntoContainer( this_, <GoogleMapMarkers experimental={this_.props.experimental} onChildClick={this_._onChildClick} onChildMouseDown={this_._onChildMouseDown} onChildMouseEnter={this_._onChildMouseEnter} onChildMouseLeave={this_._onChildMouseLeave} geoService={this_.geoService_} insideMapPanes distanceToMouse={this_.props.distanceToMouse} getHoverDistance={this_._getHoverDistance} dispatcher={this_.markersDispatcher_} />, div, // remove prerendered markers () => this_.setState({ overlayCreated: true }) ); },
onRemove() { this_.setState(state => ({ ...state, overlay: null, }));
if (this.overlay) { ReactDOM.unmountComponentAtNode(this.overlay); if (this.div) { ReactDOM.unmountComponentAtNode(this.div); } },
Expand Down Expand Up @@ -1054,7 +1062,7 @@ export default class GoogleMap extends Component { };
render() { const mapMarkerPrerender = !this.state.overlay const mapMarkerPrerender = !this.state.overlayCreated ? <GoogleMapMarkersPrerender experimental={this.props.experimental} onChildClick={this._onChildClick} Expand All @@ -1077,22 +1085,6 @@ export default class GoogleMap extends Component { onClick={this._onMapClick} > <GoogleMapMap registerChild={this._registerChild} /> {this.state.overlay && ReactDOM.createPortal( <GoogleMapMarkers experimental={this.props.experimental} onChildClick={this._onChildClick} onChildMouseDown={this._onChildMouseDown} onChildMouseEnter={this._onChildMouseEnter} onChildMouseLeave={this._onChildMouseLeave} geoService={this.geoService_} insideMapPanes distanceToMouse={this.props.distanceToMouse} getHoverDistance={this._getHoverDistance} dispatcher={this.markersDispatcher_} />, this.state.overlay )}
{/* render markers before map load done */} {mapMarkerPrerender} Expand Down