Merge pull request #24 from jedwards1211/master

fix issue #23
This commit is contained in:
Andy Edwards 2015-07-29 15:15:13 -05:00
commit 8fc399b1a5
3 changed files with 2218 additions and 1031 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -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_);
}