From 927fbc391e1afa36b8c21272a01e00bb64c80d13 Mon Sep 17 00:00:00 2001 From: Dony Sukardi Date: Mon, 9 Dec 2019 13:57:42 +0800 Subject: [PATCH] Prevent scroll locking when scroll distance reaches damping value --- src/PullToRefresh.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PullToRefresh.tsx b/src/PullToRefresh.tsx index a40557e..74024e2 100644 --- a/src/PullToRefresh.tsx +++ b/src/PullToRefresh.tsx @@ -167,12 +167,12 @@ export default class PullToRefresh extends React.Component { } damping = (dy: number): number => { - if (Math.abs(this._lastScreenY) > this.props.damping) { - return 0; - } - const ratio = Math.abs(this._ScreenY - this._startScreenY) / window.screen.height; dy *= (1 - ratio) * 0.6; + + if (this._lastScreenY + dy > this.props.damping) { + return 0; + } return dy; }