KML preserveViewport bug (Temp Fix Inside)
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
Put in a pull request to address this issue: https://github.com/tomchentw/react-google-maps/pull/428
Please refer to Getting Help section in the README (or #469).
Released 6.2.0