Inverse scroll triggers next function on scroll down
https://codesandbox.io/s/trusting-frost-q6wjc?file=/src/index.js
next function is triggered due to target.scrollTop === 0 condition in line 257 https://github.com/ankeetmaini/react-infinite-scroll-component/blob/9e5ac46ca55e94543b3ca4a1276a2d7ab96a8af5/src/index.tsx#L257 when you scroll to bottom.
When you use inverse scroll and scroll up to the page, target.scrollTop is negative value. I think target.scrollTop === 0 is not the right condition for the check, I should be something like target.scrollHeight + target.scrollTop === 0
Same problem here
Same problem here
You found any fix for this?
I have some problem, OMG the package has weekly Downloads 114 055, and fix the problem is so ease just add corrections for method isElementAtTop
isElementAtTop(target: HTMLElement, scrollThreshold: string | number = 0.8) {
const isInverseMode = this.props.inverse;
const clientHeight =
target === document.body || target === document.documentElement
? window.screen.availHeight
: target.clientHeight;
const threshold = parseThreshold(scrollThreshold);
if (threshold.unit === ThresholdUnits.Pixel) {
return (
target.scrollTop <= threshold.value + clientHeight - target.scrollHeight + 1 ||
(!isInverseMode && target.scrollTop === 0)
);
}
return (
target.scrollTop <=
threshold.value / 100 + clientHeight - target.scrollHeight + 1 ||
(!isInverseMode && target.scrollTop === 0)
);
}
any update?
Same problem.
Facing the same problem on version ^5.1.0 :disappointed:
@ankeetmaini I just opened a PR to fix this issue, please review it and merge it if everything is OK :pray:
Still have issues with the inverse scrolling, I copied the example from the main page of this repo and it doesn't work: https://codesandbox.io/s/zealous-hellman-e6ug0
No trigger for fetching more items
@hanrok you are using an old version of react-infinite-scroll-component (4.1.0) in CodeSandbox example, try to upgrade to latest version (it should work after that) :wink:
@hanrok you are using an old version of react-infinite-scroll-component (4.1.0) in CodeSandbox example, try to upgrade to latest version (it should work after that) 😉
you are right.. shame on me. Thanks!