twobin / react-lazyload

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

Set placeholder width to real component size #348

Open Paso opened 3 years ago

Paso commented 3 years ago

Set placeholder width to real component size after render when using unmountIfInvisible. This solves the problem of items jumping around when scrolling. Usefull for when parent component rendering LazyLoad doesn't know the height of the child component. The added example shows the problem when run without the visibleHeight patch and works flawless with it.