Open huynlx opened 2 years ago
Hi @Huynh12345678, thanks for opening this issue! Can you try passing useIntersectionObserver: false
as a prop? If it's set to true and the browser supports intersection observer, trackWindowScroll
will default to null
:
Hi @Huynh12345678, thanks for opening this issue! Can you try passing
useIntersectionObserver: false
as a prop? If it's set to true and the browser supports intersection observer,trackWindowScroll
will default tonull
:
Oh, so i don't necessarily use trackWindowScroll if the browser supports intersection observer ?
Hi @Huynh12345678, thanks for opening this issue! Can you try passing
useIntersectionObserver: false
as a prop? If it's set to true and the browser supports intersection observer,trackWindowScroll
will default tonull
:
And how to setState loaded from true to false when changing img src in the same component ? Because i want it to rerun the effect when changing the img src on the same component
Oh, so i don't necessarily use trackWindowScroll if the browser supports intersection observer ?
If you only want to use LazyLoadImage
or LazyLoadComponent
, it shouldn't be necessary. react-lazy-load-image-component tries to use the native Intersection Observer because it's more performant.
trackWindowScroll
is still there for compatibility with old browsers or in case you need to manually have access to the window scroll position.
And how to setState loaded from true to false when changing img src in the same component ? Because i want it to rerun the effect when changing the img src on the same component
I would try setting a different key
prop to the component, so React remounts it.
Hope it helps! :slightly_smiling_face:
Bug description The scrollPosition prop of HOC trackWindowScroll always return "null". I think it should return a object {x,y} ?