Skip to content

Commit

Permalink
fix(useLongPress):移动时取消长按事件,清除setTimeout timerId
Browse files Browse the repository at this point in the history
  • Loading branch information
Wait authored and Wait committed Dec 18, 2023
1 parent 978cb22 commit 945af85
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/hooks/src/useLongPress/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function useLongPress(

const onMove = (event: TouchEvent) => {
if (timerRef.current && overThreshold(event)) {
clearInterval(timerRef.current);
clearTimeout(timerRef.current);
timerRef.current = undefined;
}
};
Expand Down

0 comments on commit 945af85

Please sign in to comment.