fullstackreact / google-maps-react

Companion code to the "How to Write a Google Maps React Component" Tutorial
https://www.fullstackreact.com/articles/how-to-write-a-google-maps-react-component/
MIT License
1.63k stars 818 forks source link

Maps config : streetViewControl can't be disabled #73

Open sylvainpina opened 7 years ago

sylvainpina commented 7 years ago

Hi, I would like to disable streetViewControl, but it is not possible because mapConfig is cleaned of falsy values.

# node_modules/google-maps-react/dist/index.js: line 216
            var mapConfig = Object.assign({}, {
              mapTypeId: mapTypeIds[mapTypeFromProps],
              center: center,
              zoom: _this4.props.zoom,
              maxZoom: _this4.props.maxZoom,
              minZoom: _this4.props.maxZoom,
              clickableIcons: _this4.props.clickableIcons,
              disableDefaultUI: _this4.props.disableDefaultUI,
              zoomControl: _this4.props.zoomControl,
              mapTypeControl: _this4.props.mapTypeControl,
              scaleControl: _this4.props.scaleControl,
              streetViewControl: _this4.props.streetViewControl,
              panControl: _this4.props.panControl,
              rotateControl: _this4.props.rotateControl,
              scrollwheel: _this4.props.scrollwheel,
              draggable: _this4.props.draggable,
              keyboardShortcuts: _this4.props.keyboardShortcuts,
              disableDoubleClickZoom: _this4.props.disableDoubleClickZoom,
              noClear: _this4.props.noClear,
              styles: _this4.props.styles
            });

            Object.keys(mapConfig).forEach(function (key) {
              if (!mapConfig[key]) {
                delete mapConfig[key];
              }
            });

Could you update the cleaner with typeof mapConfig[key] === 'undefined' ? Many thx

namezero commented 7 years ago

+1

joeyfigaro commented 5 years ago

Any updates on this?

jsrrocha commented 5 years ago

try puting streetViewControl before mapTypeId