v2.0.0
In this release, the arguments passed to onEnter
, onLeave
and onPositionChange
has changed. Before, arguments would be listed as a flat arguments list starting with event
. Now everything is combined into a single object, passed down as a single argument. To upgrade, change event handlers from this
<Waypoint onEnter={(event, from) => {
// do something useful
}}
/>
to this
<Waypoint onEnter={({ previousPosition, currentPosition, event }) => {
// do something useful
}}
/>
Or, if you are more familiar with plain old js functions (i.e. no arrow functions or object destructuring), you'll do something like this:
<Waypoint onEnter={function(props) {
// here you can use `props.currentPosition`, `props.previousPosition`, and
// `props.event`
}}
/>
See the section on Prop types in the README for more information.