Skip to content

Commit

Permalink
perf: ⚡️ support web, but cant smooth swith state in web
Browse files Browse the repository at this point in the history
  • Loading branch information
little-buddy committed Sep 13, 2023
1 parent 337588f commit 10455e4
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/MrPullRefresh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ const MrRefreshWrapper: React.FC<PropsWithChildren<MrRefreshWrapperProps>> = ({
// 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;
}
Expand Down Expand Up @@ -207,15 +209,13 @@ const MrRefreshWrapper: React.FC<PropsWithChildren<MrRefreshWrapperProps>> = ({
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;
// }
}
}

Expand Down Expand Up @@ -353,6 +353,13 @@ const MrRefreshWrapper: React.FC<PropsWithChildren<MrRefreshWrapperProps>> = ({
* 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 ||
Expand Down

0 comments on commit 10455e4

Please sign in to comment.