Skip to content

onBoundsChanged or onZoom? #56

@derekcannon

Description

@derekcannon

I'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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions