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

visibility is not setting true on child element of absolutely positioned element. #24

Open kunalns opened 6 years ago

kunalns commented 6 years ago

Due to some the scroll is not on document in my app, it's on a element and because of this visibility is not setting true of it's child elements.

oskarleonard commented 6 years ago

Wrote a comment here https://github.com/fkhadra/react-on-screen/issues/27 on how i think this could be solved

korbav commented 4 years ago

@fkhadra Any update or action planned on this? It seems to be a pretty common use case

For the moment, a simple (but probably not performant) way to solve it is to forward the scroll event to the window :

const event = new Event('scroll');
scrollingDiv.addEventListener('scroll', () => window.dispatchEvent(event));