Open Nantris opened 6 years ago
+1
@Slapbox @samakshjain usually this is a problem when the document is not the where the scroll event is being triggered. i have submitted a pull request to add custom scroll containers. just waiting on @jasonslyvia to merge so you can define your own
@mmclau14 thanks for your thoughts on this issue. Can you explain a little what you mean by:
when the document is not where the scroll event is being triggered
Thanks again!
@mmclau14 So a component nested more than 1 level deep would not trigger lazy loading?
@Slapbox depending on your page structure, the scroll event might not be triggered on the document element. scroll events do not propagate up. It just depends on your structure. @samakshjain is probably right.
I was facing the same issue. I ended up using https://github.com/loktar00/react-lazy-load.
I am facing same issue. Seems like their code only works on body level scroll. If any of the parent container has overflow: auto, it does not seems to trigger event.
FYI, I was able to get it to work by setting scroll attribute because the parent div already had overflow on it.
I just spent another hour trying to get this working. This is a great library if you have a simple layout, but otherwise it's probably not going to work has been my experience.
I had this issue as well. I ended up forking the library because it really is great. My problem ended up being the passive config on the event handler. I overwrote this to be capture: true, passive: false.
Maybe that should be an option?
@opula great find. I'm interested to know if others have success with that. I don't have time to give it a test right now unfortunately. @twobin what do you think?
@twobin, any thoughts on a remedy for this? I'd really love to use this library, but the behavior today is the same for me as it was 18 months ago with react-lazyload@2.3.0
.
forceCheck()
gets the components to display, but without it, nothing gets them to display - I only get placeholders. Scrolling, resizing, changing zoom, setting different scrollContainer
s and trying different overflow styles - nothing works. Any ideas at all welcome.
Looking at @opula's branch, I see that @twobin's master branch seems to be missing code for handling non-string scrollContainers
- am I mistaken?
https://github.com/twobin/react-lazyload/blob/master/src/index.jsx#L198-L202
Please consider merging PR #276 which is a patch for this issue (based on @opula's work)
I've tried all sorts of combinations of options. Any thoughts in where to begin with debugging this?
Thanks!