civiccc / civiccc/react-waypoint

onPositionChange, onEnter and onLeave fire once on page load, and won't fire again until reload

Open
#275 19 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4k
Forks
206
PR merge metrics
No merged PRs in 30d

Description

I am using Waypoint to track whether a header has left the top of the viewport.

When a page is loaded (using Gatsbyjs's wrapper for react-router's `Link` component) `onPositionChange`, `onEnter` and `onLeave` are all fired at once (checked by using them to log a string to console), and then are never fired again when the page is scrolled. They are only fired again when I navigate to a different page, and they all fire at once again and the process repeats.

The `debug` output shows that waypoints of the child `div` are being tracked, and correctly identify when the `div` has left the viewport.

Despite this, none of the functions are triggering on scroll - I'm not sure if this is connected to react-router similar to #249

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.