twobin / react-lazyload

Lazy load your component, image or anything matters the performance.
MIT License
5.85k stars 487 forks source link

Placeholder not re-rendering with window size change #337

Open jackread opened 3 years ago

jackread commented 3 years ago

I'm observing that my placeholder component is not re-rendering when the window size is changed, even when resize={true} is set.

I think its because of this line?

shouldComponentUpdate() {
  return this.visible;
}
Reykugo-Gear commented 3 years ago

there are an issue about that?

jack-matthews-axomic commented 3 years ago

I also needed the placeholder to re-render however, as @jackread said, re-rendering of placeholders is blocked by that snippet.

In my case I needed the placeholders to re-render with new heights as the height of the lazy loaded components had changed.

My workaround was to add a key prop to the LazyLoad component which will force a re-render of the component and it's placeholder when the height changes.