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

Add onVisible event #37

Open nharlow89 opened 6 years ago

nharlow89 commented 6 years ago

Another use case I came across is triggering additional logic when the component becomes visible (outside of rendering logic). Would be super convenient to add an event as a prop such as onVisible or onVisibilityChange.

ost-ing commented 5 years ago

+1 This would be handy indeed

HemalR commented 5 years ago

This would be useful.

Workaround (about to implement it) - Passing down a prop with the function to the component, which can be called onMount (or on render or whatever).

I'll see how I go and post an example here if it works.

liao-frank commented 5 years ago

39