onBoundsChanged or onZoom?
See original GitHub issueI’m filtering some data based the visibility of markets in the view area (using getBounds
on the markers lat/longs). I can easily do this for dragging using mapDragEnd
, but is there an action related to the bounds_changed
event? Or some other way to listen to viewport changes/zoom level changes?
I see actions being dynamically defined here
https://github.com/fullstackreact/google-maps-react/blob/master/src/index.js#L174
but onBoundsChanged
does not work.
EDIT:
Hmm, actually, I see my codebase differs from 1.0.18. My package.json says I’m on 1.0.19, and, in this version, all these events do not exist.
I added bounds_changed
here:
# index.js
var evtNames = ['ready', 'click', 'dragend', 'recenter', 'bounds_changed'];
evtNames.forEach(function (e) {
return Map.propTypes[(0, _String.camelize)(e)] = _react.PropTypes.func;
});
and, though the prop is called onBounds_changed
, it’s working for me now. Not sure what’s up with the version numbers, but I’ll try… downgrading(?) to the latest?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top GitHub Comments
All of the events are now available through the npm package but are not named what they should be. To use any of the events simply capitalize the first letter and prepend the word on. For example ‘tilesloaded’ becomes ‘onTilesloaded’, ‘bounds_changed’ becomes ‘onBounds_changed’, and so on
How is it possible that this still isn’t fixed? Even though code is correct in this repo, npm package still has old version of events even after three months?!