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

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

Description

@robotgo

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions