From 4ccb444dd3b9617b2d503ff03a90fa4a66d02781 Mon Sep 17 00:00:00 2001 From: Vishal Date: Thu, 31 Dec 2020 03:23:16 +0530 Subject: [PATCH] fix threshold calculation in inverse mode --- src/index.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 44ad859..ba8e8c0 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -243,17 +243,16 @@ export default class InfiniteScroll extends Component { const threshold = parseThreshold(scrollThreshold); + if (threshold.unit === ThresholdUnits.Pixel) { return ( - target.scrollTop <= - threshold.value + clientHeight - target.scrollHeight + 1 || + target.scrollTop <= threshold.value || target.scrollTop === 0 ); } return ( - target.scrollTop <= - threshold.value / 100 + clientHeight - target.scrollHeight + 1 || + target.scrollTop <= ((100 - threshold.value) / 100) * clientHeight || target.scrollTop === 0 ); }