Revert 643 fix/map context (#645)

* Revert "Bump version to 1.0.7 (#644)"

This reverts commit 800092ae6f57648cf0ed74625a90752283ac1af4.

* Revert "Add passive scroll (#631)"

This reverts commit 40c8f67e78c1b851f5d35ef832ff5ef728db86af.

* Revert "Use React 16 portal to render map overlay (#643)"

This reverts commit b121bb673e9dae5ae558c8c98218f7fc02029da2.
This commit is contained in:
Michael Diego 2018-09-21 12:51:04 +03:00 committed by GitHub
parent 800092ae6f
commit 317b5c0999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,7 +240,7 @@ export default class GoogleMap extends Component {
this.zoomAnimationInProgress_ = false;
this.state = {
overlay: null,
overlayCreated: false,
};
}
@ -593,7 +593,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';
@ -607,21 +607,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);
}
},
@ -1060,7 +1068,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}
@ -1083,22 +1091,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}