joshwnj / joshwnj/react-visibility-sensor

Not triggering "onChange" when "visibilityRect" changes

Open
#108 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
2.3k
Forks
192
PR merge metrics
No merged PRs in 30d

Description

Instead of using "isVisible", we're using "visibilityRect" to know whether the scroll is past one menu so that we can make it sticky, exactly like this: https://codepen.io/senff/pen/ayGvD. The problem is that *onChange* is not triggered whenever "visibilityRect" changes.

1. Should it trigger *onChange* anyway, even though "isVisible" hasn't changed? If so, should it be optional?
1. Should we have an extra callback?
1. Should it update the state with the new "visibilityRect" so that we can get it using a function as children?

Apart from that, the docs need to be updated in order to reflect that "visibilityRect" is passed to *onChange*.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.