fkhadra / react-on-screen

Check if a react component in the viewport
https://fkhadra.github.io/react-on-screen/
MIT License
405 stars 50 forks source link

`partialVisibility` doesn't check if a component is partially visible at the bottom of the screen #15

Closed tapayne88 closed 6 years ago

tapayne88 commented 6 years ago

Hi again, I think the partialVisibility check is missing a case as it doesn't verify from the bottom of the component up. What I'm seeing is everything is visible. I think a check like below could be added to the partial visibility condition to prevent false positives.

bottom - height <= heightCheck

Happy to submit a PR.

Thanks, Tom

fkhadra commented 6 years ago

Hey @tapayne88,

If I understand correctly, when you scroll down the partialVisibility is not working right ?

tapayne88 commented 6 years ago

Seems to be that when the components mount (and on scroll/resize), every component is considered visible as top + height >= 0 is true for all components (except ones off the top of the screen)