Closed 0is1 closed 8 years ago
Hello,
You're welcome ! Being able to set the offset make sense in your case. This can probably be used for others things.
Using the component for lazy loading is definitely a good idea. I don't know why I didn't think about that use case 😁.
I must add a sample with lazy loading. I can plan a new release today. Maybe you would like to work on it ?
Yeah, nice! Do you wish that I make PR for this?
Of course, lets do this 😄
Hi, and thanks for this nice visibility tracker component!
I'm using this for lazy loading data (images at the moment) from API but there's one pitfall: API call is firing only just when you scroll down to the img-element and you will see image loader :)
So it would be nice if you could add offset to TrackVisibility-component, like:
In Image-component I have logic like (this is simplified):
So then in
node_modules/react-on-screen/lib/TrackVisibility.js
:This way it would be possible to load the data from API before user scrolls down to the element. What do you think about the idea?