Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When parent is hidden, it will fire onEnter callback anyway #328

Open
moyus opened this issue Jul 3, 2020 · 1 comment · May be fixed by #344
Open

When parent is hidden, it will fire onEnter callback anyway #328

moyus opened this issue Jul 3, 2020 · 1 comment · May be fixed by #344

Comments

@moyus
Copy link

moyus commented Jul 3, 2020

If I place <Waypoint /> in a hidden parent container, it will fire onEnter callback immediately as soon as it mounted, even if it's not in viewport. Which seems is a bug?

Here is the reproduce demo: https://codesandbox.io/s/react-waypoint-bug-nr0j4

@moyus moyus changed the title When parent is hidden, it will fire onEnter callback immediately When parent is hidden, it will fire onEnter callback anyway Jul 3, 2020
@xyy94813
Copy link

We can refer to the Intersection Observer Polyfill

https://github.com/w3c/IntersectionObserver/blob/76ba9761eadab4091927b2497bfa13e59c9e25d8/polyfill/intersection-observer.js#L555-L570

first determines whether the element is displayed or not, and then calculates.

xyy94813 pushed a commit to xyy94813/react-waypoint that referenced this issue Feb 4, 2021
xyy94813 added a commit to xyy94813/react-waypoint that referenced this issue Feb 4, 2021
xyy94813 added a commit to xyy94813/react-waypoint that referenced this issue Feb 4, 2021
@moyus moyus closed this as completed Feb 5, 2021
@moyus moyus reopened this Feb 5, 2021
xyy94813 added a commit to xyy94813/react-waypoint that referenced this issue May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants