joshwnj / joshwnj/react-visibility-sensor

No handler for determining visibility of elements that never change visibility

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

Description

### Problem
Assume having a list of elements that should be checked in the interval but are in the middle of a scroll container so the visibility will never change. That won't trigger the `onChange` handler.
But the use case of the application won't allow to expect that the element is visible from beginning (so we could check at render) and a callback needs to be called when it is visible for a certain time. The callback could not be called in the render method because it affects the performance and should be called when the check is done.
Such a handler is not implemented.

### Suggestion
Introduce a `onCheck` prop where a callback can be registered that is called after a check is done (with the `isVisible`, even if it didn't change).

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.