Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ const StatefulPressable = (props: PressableProps) => {
if (longPressTimeoutRef.current) {
clearTimeout(longPressTimeoutRef.current);
longPressTimeoutRef.current = null;
isOnPressAllowed.current = true;
}
}, []);

Expand All @@ -141,6 +140,7 @@ const StatefulPressable = (props: PressableProps) => {
if (onLongPress) {
cancelLongPress();
longPressTimeoutRef.current = setTimeout(() => {
longPressTimeoutRef.current = null;
isOnPressAllowed.current = false;
onLongPress(event);
}, delayLongPress ?? DEFAULT_LONG_PRESS_DURATION);
Expand Down Expand Up @@ -188,6 +188,7 @@ const StatefulPressable = (props: PressableProps) => {
}

isCurrentlyPressed.current = true;
isOnPressAllowed.current = true;
pressInEventRef.current = event;
if (unstable_pressDelay) {
pressDelayTimeoutRef.current = setTimeout(() => {
Expand Down Expand Up @@ -311,6 +312,11 @@ const StatefulPressable = (props: PressableProps) => {
pressableEvent
);
},
onTouchesUp: () => {
// The button may still be waiting for another gesture; a long press
// must not fire after the finger lifted
cancelLongPress();
Comment thread
coderabbitai[bot] marked this conversation as resolved.
},
onTouchesCancel: (event) => {
const pressableEvent = gestureTouchToPressableEvent(event);
stateMachine.reset();
Expand Down
Loading