Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

TypeError: Cannot read property 'setCenter' of undefined #34

Open
robotgo opened this issue Dec 20, 2018 · 0 comments
Open

TypeError: Cannot read property 'setCenter' of undefined #34

robotgo opened this issue Dec 20, 2018 · 0 comments

Comments

@robotgo
Copy link

robotgo commented Dec 20, 2018

Hi,

i have a blinking problem on test server using this.map.fitBounds(boundCoords) in componentDidUpdate:

TypeError: Cannot read property 'setCenter' of undefined
    at n._handleZoomAnim (react-leaflet-google.js:1635)
    at n.fire (leaflet-src.js:593)
    at n._moveEnd (leaflet-src.js:4193)
    at n._resetView (leaflet-src.js:4137)
    at n.setView (leaflet-src.js:3191)
    at n.fitBounds (leaflet-src.js:3280)
    at t.value (Map.js:211)

And in the source code file dist/react-leaflet-google.js I see that there isn't check on undefined value of this._mutant in _handleZoomAnim like in other methods:

_handleZoomAnim: function _handleZoomAnim() {
	    var center = this._map.getCenter();
	    var _center = new google.maps.LatLng(center.lat, center.lng);
	    this._mutant.setCenter(_center);
	    this._mutant.setZoom(Math.round(this._map.getZoom()));
	  },

In _resize method:

_resize: function _resize() {
	    var size = this._map.getSize();
	    if (this._mutantContainer.style.width === size.x && this._mutantContainer.style.height === size.y) return;
	    this.setElementSize(this._mutantContainer, size);
	    *if (!this._mutant) return;*
	    google.maps.event.trigger(this._mutant, "resize");
	  },

Should it be?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant