From 10455e47a038827252bb6ae0f71ddd089a56b1d4 Mon Sep 17 00:00:00 2001 From: buddy Date: Thu, 14 Sep 2023 03:34:53 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E2=9A=A1=EF=B8=8F=20support=20web,=20b?= =?UTF-8?q?ut=20cant=20smooth=20swith=20state=20in=20web?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MrPullRefresh.tsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/MrPullRefresh.tsx b/src/MrPullRefresh.tsx index bfe1210..706d0fa 100644 --- a/src/MrPullRefresh.tsx +++ b/src/MrPullRefresh.tsx @@ -142,6 +142,8 @@ const MrRefreshWrapper: React.FC> = ({ // pull down if (event.translationY > 0) { if (pullupState.value !== PullingRefreshStatus.IDLE) { + // FIXME: The delay released here will trigger the freezing of the bottom scroll, + // which is more obvious on Android than on iOS. lockIDLE.value = 1; pullupState.value = PullingRefreshStatus.IDLE; } @@ -207,15 +209,13 @@ const MrRefreshWrapper: React.FC> = ({ pullupState.value = newStatus; } - console.log('panGesture', recordValue.value); - const move = event.translationY - recordValue.value; - if (move > 0) { - pullupState.value = PullingRefreshStatus.IDLE; - } else { - panTranslateY.value = move; - } + // if (move > 0) { + // pullupState.value = PullingRefreshStatus.IDLE; + // } else { + panTranslateY.value = move; + // } } } @@ -353,6 +353,13 @@ const MrRefreshWrapper: React.FC> = ({ * However, it works fine on the real device. * Maybe the simulator cant tracking gestures by mouse normally. * */ + overflowY: + /* for web */ + pullupState.value !== PullingRefreshStatus.IDLE || + pulldownState.value !== PullingRefreshStatus.IDLE || + lockIDLE.value + ? 'hidden' + : 'auto', pointerEvents: pullupState.value !== PullingRefreshStatus.IDLE || pulldownState.value !== PullingRefreshStatus.IDLE ||