From 0d856c61c7f9dce7d12a985b050dfcf9fe8e18a1 Mon Sep 17 00:00:00 2001 From: thislight Date: Mon, 12 Aug 2024 20:39:12 +0800 Subject: [PATCH] PullDownToRefresh:fix wont pull back when touchend --- src/timelines/PullDownToRefresh.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/timelines/PullDownToRefresh.tsx b/src/timelines/PullDownToRefresh.tsx index 3aa7195..e63aaa2 100644 --- a/src/timelines/PullDownToRefresh.tsx +++ b/src/timelines/PullDownToRefresh.tsx @@ -103,7 +103,7 @@ const PullDownToRefresh: Component<{ const handleTouch = (event: TouchEvent) => { if (event.targetTouches.length > 1) { lastTouchId = 0; - lastTouchScreenY; + lastTouchScreenY = 0; return; } const item = event.targetTouches.item(0)!; @@ -128,7 +128,12 @@ const PullDownToRefresh: Component<{ lastTouchScreenY = 0; holding = false; if (untrack(pullDownDistance) >= 160 && !props.loading && props.onRefresh) { - setTimeout(props.onRefresh, 0) + setTimeout(props.onRefresh, 0); + } else { + if (released) { + released = false; + requestAnimationFrame(updatePullDown); + } } };