react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

KML preserveViewport bug (Temp Fix Inside)

Open techsev opened this issue 9 years ago • 3 comments

Plugin is great, does everything I needed but when I load a KML, map recenters to fit the container.

an old closed issue says to use

<KmlLayer options={{preserveViewport: true}} />

but it still didn't prevent the map from shifting. I was able to fix it by modifying the "KmlLayers.js" file to add the missing propType.

var controlledPropTypes = { // NOTICE!!!!!! // // Only expose those with getters & setters in the table as controlled props. // // [].map.call($0.querySelectorAll("tr>td>code", function(it){ return it.textContent; }) // .filter(function(it){ return it.match(/^set/) && !it.match(/^setMap/); }) // // https://developers.google.com/maps/documentation/javascript/3.exp/reference#KmlLayer defaultViewport: _react.PropTypes.any, preserveViewport: _react.PropTypes.any, metadata: _react.PropTypes.any, status: _react.PropTypes.any, url: _react.PropTypes.string, zIndex: _react.PropTypes.number }; /* global google */

I added preserveViewport: _react.PropTypes.any, and now it works perfectly!

thanks, again, great plugin

techsev avatar Dec 14 '16 17:12 techsev

Put in a pull request to address this issue: https://github.com/tomchentw/react-google-maps/pull/428

jsmapr1 avatar Jan 24 '17 21:01 jsmapr1

Please refer to Getting Help section in the README (or #469).

tomchentw avatar Apr 20 '17 06:04 tomchentw

Released 6.2.0

tomchentw avatar Apr 20 '17 12:04 tomchentw