Skip to content

Commit

Permalink
Merge pull request #235 from AlaDouagi/fix-infinite-scroll-on-top
Browse files Browse the repository at this point in the history
Fix inverse scroll triggering next function on scroll down
  • Loading branch information
ankeetmaini authored Feb 5, 2021
2 parents dfc38ea + 991dd6f commit 71e2b0f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,13 @@ export default class InfiniteScroll extends Component<Props, State> {
if (threshold.unit === ThresholdUnits.Pixel) {
return (
target.scrollTop <=
threshold.value + clientHeight - target.scrollHeight + 1 ||
target.scrollTop === 0
threshold.value + clientHeight - target.scrollHeight + 1
);
}

return (
target.scrollTop <=
threshold.value / 100 + clientHeight - target.scrollHeight + 1 ||
target.scrollTop === 0
threshold.value / 100 + clientHeight - target.scrollHeight + 1
);
}

Expand Down

0 comments on commit 71e2b0f

Please sign in to comment.