twobin / twobin/react-lazyload
"overflow" and "resize" won't work together
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 485
- PR merge metrics
- No merged PRs in 30d
Description
It seems that this part of the code has caused this bug. When the prop "overflow" is set, the code doesn't add resize listener.
```
if (this.props.overflow) {
const parent = scrollParent(this.ref);
if (parent && typeof parent.getAttribute === 'function') {
const listenerCount = 1 + +parent.getAttribute(LISTEN_FLAG);
if (listenerCount === 1) {
parent.addEventListener('scroll', finalLazyLoadHandler, passiveEvent);
}
parent.setAttribute(LISTEN_FLAG, listenerCount);
}
} else if (listeners.length === 0 || needResetFinalLazyLoadHandler) {
const { scroll, resize } = this.props;
if (scroll) {
on(scrollport, 'scroll', finalLazyLoadHandler, passiveEvent);
}
if (resize) {
on(window, 'resize', finalLazyLoadHandler, passiveEvent);
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.