Skip to content

Commit b2476d1

Browse files
j-piaseckiCopilot
andcommitted
Change callback order
Co-authored-by: Copilot <copilot@github.com>
1 parent 67cdbb0 commit b2476d1

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

  • packages/react-native-gesture-handler/src/v3/components/Touchable

packages/react-native-gesture-handler/src/v3/components/Touchable/Touchable.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,14 @@ export const Touchable = (props: TouchableProps) => {
8989
}
9090
}, []);
9191

92-
const onDeactivate = useCallback(
93-
(e: EndCallbackEventType) => {
94-
if (!e.canceled && !longPressDetected.current && e.pointerInside) {
95-
onPress?.(e);
96-
}
97-
},
98-
[onPress]
99-
);
100-
10192
const onFinalize = useCallback(
10293
(e: EndCallbackEventType) => {
10394
if (pointerState.current === PointerState.INSIDE) {
10495
onPressOut?.(e);
96+
97+
if (!e.canceled && !longPressDetected.current) {
98+
onPress?.(e);
99+
}
105100
}
106101

107102
pointerState.current = PointerState.UNKNOWN;
@@ -157,7 +152,6 @@ export const Touchable = (props: TouchableProps) => {
157152
enabled={!disabled}
158153
onBegin={onBegin}
159154
onActivate={onActivate}
160-
onDeactivate={onDeactivate}
161155
onFinalize={onFinalize}
162156
onUpdate={onUpdate}
163157
defaultOpacity={defaultOpacity}

0 commit comments

Comments
 (0)