react-native-gesture-handler 3.2.0-nightly-20260812-bd853311a → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/android/build.gradle +21 -6
  2. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +4 -2
  3. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerDetectorView.kt +1 -2
  4. package/lib/module/specs/RNGestureHandlerDetectorNativeComponent.ts +1 -1
  5. package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.ts +1 -1
  6. package/lib/module/v3/components/Pressable.js +23 -312
  7. package/lib/module/v3/components/Pressable.js.map +1 -1
  8. package/lib/module/v3/components/PressableWithTouchable.js +259 -0
  9. package/lib/module/v3/components/PressableWithTouchable.js.map +1 -0
  10. package/lib/module/v3/components/StatefulPressable.js +338 -0
  11. package/lib/module/v3/components/StatefulPressable.js.map +1 -0
  12. package/lib/module/v3/components/pointerStyle.js +6 -0
  13. package/lib/module/v3/components/pointerStyle.js.map +1 -0
  14. package/lib/module/v3/components/pointerStyle.web.js +9 -0
  15. package/lib/module/v3/components/pointerStyle.web.js.map +1 -0
  16. package/lib/typescript/specs/RNGestureHandlerDetectorNativeComponent.d.ts +1 -1
  17. package/lib/typescript/specs/RNGestureHandlerDetectorNativeComponent.d.ts.map +1 -1
  18. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +1 -1
  19. package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts.map +1 -1
  20. package/lib/typescript/v3/components/Pressable.d.ts +13 -0
  21. package/lib/typescript/v3/components/Pressable.d.ts.map +1 -1
  22. package/lib/typescript/v3/components/PressableWithTouchable.d.ts +5 -0
  23. package/lib/typescript/v3/components/PressableWithTouchable.d.ts.map +1 -0
  24. package/lib/typescript/v3/components/StatefulPressable.d.ts +5 -0
  25. package/lib/typescript/v3/components/StatefulPressable.d.ts.map +1 -0
  26. package/lib/typescript/v3/components/pointerStyle.d.ts +3 -0
  27. package/lib/typescript/v3/components/pointerStyle.d.ts.map +1 -0
  28. package/lib/typescript/v3/components/pointerStyle.web.d.ts +3 -0
  29. package/lib/typescript/v3/components/pointerStyle.web.d.ts.map +1 -0
  30. package/package.json +1 -1
  31. package/src/specs/RNGestureHandlerDetectorNativeComponent.ts +1 -1
  32. package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +1 -1
  33. package/src/v3/components/Pressable.tsx +28 -448
  34. package/src/v3/components/PressableWithTouchable.tsx +326 -0
  35. package/src/v3/components/StatefulPressable.tsx +476 -0
  36. package/src/v3/components/pointerStyle.ts +5 -0
  37. package/src/v3/components/pointerStyle.web.ts +6 -0
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+
3
+ import React, { useEffect, useRef, useState } from 'react';
4
+ import { addInsets, isTouchWithinInset, numberAsInset } from '../../components/Pressable/utils';
5
+ import { PressabilityDebugView } from '../../handlers/PressabilityDebugView';
6
+ import { pointerStyle } from './pointerStyle';
7
+ import { Touchable } from './Touchable/Touchable';
8
+
9
+ // RN's Pressable default. Touchable's own default is 600ms
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const DEFAULT_LONG_PRESS_DURATION = 500;
12
+ function normalizeInset(value) {
13
+ return typeof value === 'number' ? numberAsInset(value) : value ?? numberAsInset(0);
14
+ }
15
+ function buttonToInner(event) {
16
+ return {
17
+ identifier: 0,
18
+ locationX: event.x,
19
+ locationY: event.y,
20
+ pageX: event.absoluteX,
21
+ pageY: event.absoluteY,
22
+ target: 0,
23
+ timestamp: Date.now(),
24
+ touches: [],
25
+ changedTouches: [],
26
+ force: undefined
27
+ };
28
+ }
29
+ function buttonToPressableEvent(event) {
30
+ const inner = buttonToInner(event);
31
+ return {
32
+ nativeEvent: {
33
+ ...inner,
34
+ touches: [inner],
35
+ changedTouches: [inner]
36
+ }
37
+ };
38
+ }
39
+ const PressableWithTouchable = props => {
40
+ const {
41
+ testOnly_pressed,
42
+ hitSlop,
43
+ pressRetentionOffset,
44
+ delayHoverIn,
45
+ delayHoverOut,
46
+ delayLongPress,
47
+ unstable_pressDelay,
48
+ onHoverIn,
49
+ onHoverOut,
50
+ onPress,
51
+ onPressIn,
52
+ onPressOut,
53
+ onLongPress,
54
+ onLayout,
55
+ style,
56
+ children,
57
+ android_disableSound,
58
+ android_ripple,
59
+ disabled,
60
+ accessible,
61
+ ref,
62
+ ...rest
63
+ } = props;
64
+
65
+ // Drop props Touchable doesn't take: `cancelable`/`dimensionsAfterResize` are
66
+ // unsupported; the relation props are handled by the wrapper.
67
+ //
68
+ /* eslint-disable @typescript-eslint/no-unused-vars */
69
+ const {
70
+ cancelable,
71
+ dimensionsAfterResize,
72
+ simultaneousWith,
73
+ requireToFail,
74
+ block,
75
+ ...remainingProps
76
+ } = rest;
77
+ /* eslint-enable @typescript-eslint/no-unused-vars */
78
+
79
+ const [pressed, setPressed] = useState(false);
80
+ const timers = useRef({
81
+ press: null,
82
+ hoverIn: null,
83
+ hoverOut: null
84
+ });
85
+ const dimensions = useRef({
86
+ width: 0,
87
+ height: 0
88
+ });
89
+
90
+ // Whether the in-progress press activated within hitSlop (see handlePressIn).
91
+ const isActive = useRef(false);
92
+ useEffect(() => () => {
93
+ const pending = timers.current;
94
+ if (pending.press) {
95
+ clearTimeout(pending.press);
96
+ }
97
+ if (pending.hoverIn) {
98
+ clearTimeout(pending.hoverIn);
99
+ }
100
+ if (pending.hoverOut) {
101
+ clearTimeout(pending.hoverOut);
102
+ }
103
+ }, []);
104
+
105
+ // RN's ripple config allows `null` on every field; Touchable's excludes it.
106
+ // Normalize `null` → `undefined` so the types line up.
107
+ const androidRipple = android_ripple ? {
108
+ color: android_ripple.color ?? undefined,
109
+ borderless: android_ripple.borderless ?? undefined,
110
+ radius: android_ripple.radius ?? undefined,
111
+ foreground: android_ripple.foreground ?? undefined
112
+ } : undefined;
113
+
114
+ // Activation is gated to `normalizedHitSlop` (see handlePressIn); the native
115
+ // button gets the wider `appliedHitSlop` so an active press is retained out
116
+ // to hitSlop + pressRetentionOffset before it cancels.
117
+ const normalizedHitSlop = normalizeInset(hitSlop);
118
+ const appliedHitSlop = addInsets(normalizedHitSlop, normalizeInset(pressRetentionOffset));
119
+
120
+ // Long press is measured from onPressIn, which `unstable_pressDelay` defers,
121
+ // so fold it in to match RN / StatefulPressable.
122
+ const resolvedDelayLongPress = (delayLongPress ?? DEFAULT_LONG_PRESS_DURATION) + (unstable_pressDelay ?? 0);
123
+ const handleLayout = event => {
124
+ onLayout?.(event);
125
+ dimensions.current = event.nativeEvent.layout;
126
+ };
127
+ const firePressIn = event => {
128
+ setPressed(true);
129
+ onPressIn?.(buttonToPressableEvent(event));
130
+ };
131
+ const handlePressIn = event => {
132
+ // A down in the retention-only zone is held by the button but isn't a press.
133
+ isActive.current = isTouchWithinInset(dimensions.current, normalizedHitSlop, buttonToInner(event));
134
+ if (!isActive.current) {
135
+ return;
136
+ }
137
+ if (unstable_pressDelay) {
138
+ // Drop a still-pending timer so a re-entrant press can't double-fire.
139
+ if (timers.current.press) {
140
+ clearTimeout(timers.current.press);
141
+ }
142
+ timers.current.press = setTimeout(() => {
143
+ timers.current.press = null;
144
+ firePressIn(event);
145
+ }, unstable_pressDelay);
146
+ return;
147
+ }
148
+ firePressIn(event);
149
+ };
150
+ const handlePressOut = event => {
151
+ // Not cleared here: onPress fires after onPressOut and must stay suppressed
152
+ // too; isActive resets on the next press-in.
153
+ if (!isActive.current) {
154
+ return;
155
+ }
156
+
157
+ // If the touch is released before `unstable_pressDelay` elapses, RN still
158
+ // emits the deferred `onPressIn` before `onPressOut` — flush it now.
159
+ if (timers.current.press) {
160
+ clearTimeout(timers.current.press);
161
+ timers.current.press = null;
162
+ firePressIn(event);
163
+ }
164
+ setPressed(false);
165
+ onPressOut?.(buttonToPressableEvent(event));
166
+ };
167
+ const handlePress = onPress ? event => {
168
+ if (isActive.current) {
169
+ onPress(buttonToPressableEvent(event));
170
+ }
171
+ } : undefined;
172
+ const handleLongPress = onLongPress ? event => {
173
+ if (!isActive.current) {
174
+ return;
175
+ }
176
+ // Flush the deferred onPressIn so it can't arrive after onLongPress
177
+ // (e.g. delayLongPress={0} makes the two timers coincide).
178
+ if (timers.current.press) {
179
+ clearTimeout(timers.current.press);
180
+ timers.current.press = null;
181
+ firePressIn(event);
182
+ }
183
+ onLongPress(buttonToPressableEvent(event));
184
+ } : undefined;
185
+
186
+ // Wire each handler whenever the opposite side can leave a pending timer, so a
187
+ // delayed hover callback is cancelled once the pointer leaves/re-enters.
188
+ const needsHoverIn = onHoverIn != null || onHoverOut != null && !!delayHoverOut;
189
+ const needsHoverOut = onHoverOut != null || onHoverIn != null && !!delayHoverIn;
190
+ const handleHoverIn = needsHoverIn ? event => {
191
+ if (timers.current.hoverOut) {
192
+ clearTimeout(timers.current.hoverOut);
193
+ timers.current.hoverOut = null;
194
+ }
195
+ if (!onHoverIn) {
196
+ return;
197
+ }
198
+ if (delayHoverIn) {
199
+ timers.current.hoverIn = setTimeout(() => {
200
+ timers.current.hoverIn = null;
201
+ onHoverIn(buttonToPressableEvent(event));
202
+ }, delayHoverIn);
203
+ return;
204
+ }
205
+ onHoverIn(buttonToPressableEvent(event));
206
+ } : undefined;
207
+ const handleHoverOut = needsHoverOut ? event => {
208
+ if (timers.current.hoverIn) {
209
+ clearTimeout(timers.current.hoverIn);
210
+ timers.current.hoverIn = null;
211
+ }
212
+ if (!onHoverOut) {
213
+ return;
214
+ }
215
+ if (delayHoverOut) {
216
+ timers.current.hoverOut = setTimeout(() => {
217
+ timers.current.hoverOut = null;
218
+ onHoverOut(buttonToPressableEvent(event));
219
+ }, delayHoverOut);
220
+ return;
221
+ }
222
+ onHoverOut(buttonToPressableEvent(event));
223
+ } : undefined;
224
+
225
+ // `testOnly_pressed` forces the pressed state for snapshots/tests. Derive the
226
+ // displayed value from it each render, keeping the interactive `pressed` state
227
+ // independent (seeded to false) so clearing the prop doesn't leave it stuck.
228
+ const displayPressed = testOnly_pressed ?? pressed;
229
+ const resolvedStyle = typeof style === 'function' ? style({
230
+ pressed: displayPressed
231
+ }) : style;
232
+ const resolvedChildren = typeof children === 'function' ? children({
233
+ pressed: displayPressed
234
+ }) : children;
235
+ return /*#__PURE__*/_jsxs(Touchable, {
236
+ ...remainingProps,
237
+ ref: ref,
238
+ accessible: accessible !== false,
239
+ disabled: disabled === true,
240
+ hitSlop: appliedHitSlop,
241
+ onLayout: handleLayout,
242
+ androidRipple: androidRipple,
243
+ touchSoundDisabled: android_disableSound ?? undefined,
244
+ delayLongPress: resolvedDelayLongPress,
245
+ style: [pointerStyle, resolvedStyle],
246
+ onPressIn: handlePressIn,
247
+ onPressOut: handlePressOut,
248
+ onPress: handlePress,
249
+ onLongPress: handleLongPress,
250
+ onHoverIn: handleHoverIn,
251
+ onHoverOut: handleHoverOut,
252
+ children: [resolvedChildren, __DEV__ ? /*#__PURE__*/_jsx(PressabilityDebugView, {
253
+ color: "red",
254
+ hitSlop: normalizedHitSlop
255
+ }) : null]
256
+ });
257
+ };
258
+ export default PressableWithTouchable;
259
+ //# sourceMappingURL=PressableWithTouchable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","useRef","useState","addInsets","isTouchWithinInset","numberAsInset","PressabilityDebugView","pointerStyle","Touchable","jsx","_jsx","jsxs","_jsxs","DEFAULT_LONG_PRESS_DURATION","normalizeInset","value","buttonToInner","event","identifier","locationX","x","locationY","y","pageX","absoluteX","pageY","absoluteY","target","timestamp","Date","now","touches","changedTouches","force","undefined","buttonToPressableEvent","inner","nativeEvent","PressableWithTouchable","props","testOnly_pressed","hitSlop","pressRetentionOffset","delayHoverIn","delayHoverOut","delayLongPress","unstable_pressDelay","onHoverIn","onHoverOut","onPress","onPressIn","onPressOut","onLongPress","onLayout","style","children","android_disableSound","android_ripple","disabled","accessible","ref","rest","cancelable","dimensionsAfterResize","simultaneousWith","requireToFail","block","remainingProps","pressed","setPressed","timers","press","hoverIn","hoverOut","dimensions","width","height","isActive","pending","current","clearTimeout","androidRipple","color","borderless","radius","foreground","normalizedHitSlop","appliedHitSlop","resolvedDelayLongPress","handleLayout","layout","firePressIn","handlePressIn","setTimeout","handlePressOut","handlePress","handleLongPress","needsHoverIn","needsHoverOut","handleHoverIn","handleHoverOut","displayPressed","resolvedStyle","resolvedChildren","touchSoundDisabled","__DEV__"],"sourceRoot":"../../../../src","sources":["v3/components/PressableWithTouchable.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAS1D,SACEC,SAAS,EACTC,kBAAkB,EAClBC,aAAa,QACR,kCAAkC;AACzC,SAASC,qBAAqB,QAAQ,sCAAsC;AAC5E,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,SAAS,QAAQ,uBAAuB;;AAEjD;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,MAAMC,2BAA2B,GAAG,GAAG;AAQvC,SAASC,cAAcA,CAACC,KAAyC,EAAU;EACzE,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAC5BV,aAAa,CAACU,KAAK,CAAC,GACnBA,KAAK,IAAIV,aAAa,CAAC,CAAC,CAAE;AACjC;AAEA,SAASW,aAAaA,CAACC,KAAkB,EAAuB;EAC9D,OAAO;IACLC,UAAU,EAAE,CAAC;IACbC,SAAS,EAAEF,KAAK,CAACG,CAAC;IAClBC,SAAS,EAAEJ,KAAK,CAACK,CAAC;IAClBC,KAAK,EAAEN,KAAK,CAACO,SAAS;IACtBC,KAAK,EAAER,KAAK,CAACS,SAAS;IACtBC,MAAM,EAAE,CAAC;IACTC,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;IACrBC,OAAO,EAAE,EAAE;IACXC,cAAc,EAAE,EAAE;IAClBC,KAAK,EAAEC;EACT,CAAC;AACH;AAEA,SAASC,sBAAsBA,CAAClB,KAAkB,EAAE;EAClD,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zBnD,UAAU,EAAEoD,cAAe;IAAA7C,QAAA,GAC1BgD,gBAAgB,EAChBE,OAAO,gBACN/F,IAAA,CAACJ,qBAAqB;MAAC4E,KAAK,EAAC,KAAK;MAACzC,OAAO,EAAE6C;IAAkB,CAAE,CAAC,GAC/D,IAAI;EAAA,CACC,CAAC;AAEhB,CAAC;AAED,eAAehD,sBAAsB","ignoreList":[]}
@@ -0,0 +1,338 @@
1
+ "use strict";
2
+
3
+ import React, { use, useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
+ import { Platform } from 'react-native';
5
+ import { getStatesConfig, StateMachineEvent } from '../../components/Pressable/stateDefinitions';
6
+ import { PressableStateMachine } from '../../components/Pressable/StateMachine';
7
+ import { addInsets, gestureToPressableEvent, gestureTouchToPressableEvent, isTouchWithinInset, numberAsInset, viewCenterToPressableEvent } from '../../components/Pressable/utils';
8
+ import { getTVProps } from '../../components/utils';
9
+ import { PressabilityDebugView } from '../../handlers/PressabilityDebugView';
10
+ import { useIsScreenReaderEnabled } from '../../useIsScreenReaderEnabled';
11
+ import { INT32_MAX, isTestEnv } from '../../utils';
12
+ import { GestureDetector } from '../detectors';
13
+ import { useHoverGesture, useLongPressGesture, useNativeGesture, useSimultaneousGestures } from '../hooks';
14
+ import { isKeyboardDismissingTap, JSResponderContext } from '../scrollViewInterop';
15
+ import { PureNativeButton } from './GestureButtons';
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
+ const DEFAULT_LONG_PRESS_DURATION = 500;
18
+ const IS_TEST_ENV = isTestEnv();
19
+ const StatefulPressable = props => {
20
+ const {
21
+ testOnly_pressed,
22
+ hitSlop,
23
+ pressRetentionOffset,
24
+ delayHoverIn,
25
+ delayHoverOut,
26
+ delayLongPress,
27
+ unstable_pressDelay,
28
+ onHoverIn,
29
+ onHoverOut,
30
+ onPress,
31
+ onPressIn,
32
+ onPressOut,
33
+ onLongPress,
34
+ onLayout,
35
+ style,
36
+ children,
37
+ android_disableSound,
38
+ android_ripple,
39
+ disabled,
40
+ accessible,
41
+ simultaneousWith,
42
+ requireToFail,
43
+ block,
44
+ ref,
45
+ ...remainingProps
46
+ } = props;
47
+ const [pressedState, setPressedState] = useState(false);
48
+ const longPressTimeoutRef = useRef(null);
49
+ const pressDelayTimeoutRef = useRef(null);
50
+ const isOnPressAllowed = useRef(true);
51
+ const jsResponderContext = use(JSResponderContext);
52
+ const isCurrentlyPressed = useRef(false);
53
+ const dimensions = useRef({
54
+ width: 0,
55
+ height: 0
56
+ });
57
+
58
+ // When the touch that begins a press is the one dismissing the keyboard
59
+ // (keyboardShouldPersistTaps="never"), the press is swallowed to match RN's
60
+ // touchables.
61
+ const dropKeyboardTapRef = useRef(null);
62
+ const normalizedHitSlop = useMemo(() => typeof hitSlop === 'number' ? numberAsInset(hitSlop) : hitSlop ?? numberAsInset(0), [hitSlop]);
63
+ const normalizedPressRetentionOffset = useMemo(() => typeof pressRetentionOffset === 'number' ? numberAsInset(pressRetentionOffset) : pressRetentionOffset ?? {}, [pressRetentionOffset]);
64
+ const appliedHitSlop = addInsets(normalizedHitSlop, normalizedPressRetentionOffset);
65
+ const cancelLongPress = useCallback(() => {
66
+ if (longPressTimeoutRef.current) {
67
+ clearTimeout(longPressTimeoutRef.current);
68
+ longPressTimeoutRef.current = null;
69
+ isOnPressAllowed.current = true;
70
+ }
71
+ }, []);
72
+ const cancelDelayedPress = useCallback(() => {
73
+ if (pressDelayTimeoutRef.current) {
74
+ clearTimeout(pressDelayTimeoutRef.current);
75
+ pressDelayTimeoutRef.current = null;
76
+ }
77
+ }, []);
78
+ const startLongPress = useCallback(event => {
79
+ if (onLongPress) {
80
+ cancelLongPress();
81
+ longPressTimeoutRef.current = setTimeout(() => {
82
+ isOnPressAllowed.current = false;
83
+ onLongPress(event);
84
+ }, delayLongPress ?? DEFAULT_LONG_PRESS_DURATION);
85
+ }
86
+ }, [onLongPress, cancelLongPress, delayLongPress]);
87
+ const innerHandlePressIn = useCallback(event => {
88
+ onPressIn?.(event);
89
+ startLongPress(event);
90
+ setPressedState(true);
91
+ if (pressDelayTimeoutRef.current) {
92
+ clearTimeout(pressDelayTimeoutRef.current);
93
+ pressDelayTimeoutRef.current = null;
94
+ }
95
+ }, [onPressIn, startLongPress]);
96
+ const handleFinalize = useCallback(() => {
97
+ isCurrentlyPressed.current = false;
98
+ dropKeyboardTapRef.current = null;
99
+ cancelLongPress();
100
+ cancelDelayedPress();
101
+ setPressedState(false);
102
+ }, [cancelDelayedPress, cancelLongPress]);
103
+ const captureKeyboardDismiss = useCallback(() => {
104
+ dropKeyboardTapRef.current ??= isKeyboardDismissingTap(jsResponderContext);
105
+ }, [jsResponderContext]);
106
+ const handlePressIn = useCallback((event, skipBoundsCheck = false) => {
107
+ if (!skipBoundsCheck && !isTouchWithinInset(dimensions.current, normalizedHitSlop, event.nativeEvent.changedTouches.at(-1))) {
108
+ // Ignoring pressIn within pressRetentionOffset
109
+ return;
110
+ }
111
+ isCurrentlyPressed.current = true;
112
+ if (unstable_pressDelay) {
113
+ pressDelayTimeoutRef.current = setTimeout(() => {
114
+ innerHandlePressIn(event);
115
+ }, unstable_pressDelay);
116
+ } else {
117
+ innerHandlePressIn(event);
118
+ }
119
+ }, [innerHandlePressIn, normalizedHitSlop, unstable_pressDelay]);
120
+ const handlePressOut = useCallback((event, success = true) => {
121
+ if (!isCurrentlyPressed.current) {
122
+ // Some prop configurations may lead to handlePressOut being called multiple times.
123
+ return;
124
+ }
125
+ isCurrentlyPressed.current = false;
126
+ if (pressDelayTimeoutRef.current) {
127
+ innerHandlePressIn(event);
128
+ }
129
+ onPressOut?.(event);
130
+ if (isOnPressAllowed.current && success) {
131
+ onPress?.(event);
132
+ }
133
+ handleFinalize();
134
+ }, [handleFinalize, innerHandlePressIn, onPress, onPressOut]);
135
+ const stateMachine = useMemo(() => new PressableStateMachine(), []);
136
+ const isScreenReaderEnabled = useIsScreenReaderEnabled();
137
+ useEffect(() => {
138
+ const configuration = getStatesConfig(handlePressIn, handlePressOut, isScreenReaderEnabled);
139
+ stateMachine.setStates(configuration);
140
+ }, [handlePressIn, handlePressOut, stateMachine, isScreenReaderEnabled]);
141
+ const hoverInTimeout = useRef(null);
142
+ const hoverOutTimeout = useRef(null);
143
+ useEffect(() => () => {
144
+ if (longPressTimeoutRef.current) {
145
+ clearTimeout(longPressTimeoutRef.current);
146
+ }
147
+ if (pressDelayTimeoutRef.current) {
148
+ clearTimeout(pressDelayTimeoutRef.current);
149
+ }
150
+ if (hoverInTimeout.current) {
151
+ clearTimeout(hoverInTimeout.current);
152
+ }
153
+ if (hoverOutTimeout.current) {
154
+ clearTimeout(hoverOutTimeout.current);
155
+ }
156
+ }, []);
157
+ const hoverGesture = useHoverGesture({
158
+ manualActivation: true,
159
+ // Prevents Hover blocking Native gesture on web
160
+ cancelsTouchesInView: false,
161
+ onBegin: event => {
162
+ if (hoverOutTimeout.current) {
163
+ clearTimeout(hoverOutTimeout.current);
164
+ }
165
+ if (delayHoverIn) {
166
+ hoverInTimeout.current = setTimeout(() => onHoverIn?.(gestureToPressableEvent(event)), delayHoverIn);
167
+ return;
168
+ }
169
+ onHoverIn?.(gestureToPressableEvent(event));
170
+ },
171
+ onFinalize: event => {
172
+ if (hoverInTimeout.current) {
173
+ clearTimeout(hoverInTimeout.current);
174
+ }
175
+ if (delayHoverOut) {
176
+ hoverOutTimeout.current = setTimeout(() => onHoverOut?.(gestureToPressableEvent(event)), delayHoverOut);
177
+ return;
178
+ }
179
+ onHoverOut?.(gestureToPressableEvent(event));
180
+ },
181
+ enabled: disabled !== true,
182
+ disableReanimated: true,
183
+ simultaneousWith,
184
+ block,
185
+ requireToFail,
186
+ hitSlop: appliedHitSlop
187
+ });
188
+ const pressAndTouchGesture = useLongPressGesture({
189
+ minDuration: Platform.OS === 'web' ? 0 : INT32_MAX,
190
+ // Long press handles finalize on web, thus it must activate right away
191
+ maxDistance: INT32_MAX,
192
+ // Stops long press from cancelling on touch move
193
+ cancelsTouchesInView: false,
194
+ onTouchesDown: event => {
195
+ captureKeyboardDismiss();
196
+ if (dropKeyboardTapRef.current) {
197
+ return;
198
+ }
199
+ const pressableEvent = gestureTouchToPressableEvent(event);
200
+ stateMachine.handleEvent(StateMachineEvent.LONG_PRESS_TOUCHES_DOWN, pressableEvent);
201
+ },
202
+ onTouchesUp: () => {
203
+ if (Platform.OS === 'android' && !isScreenReaderEnabled) {
204
+ // Prevents potential soft-locks
205
+ stateMachine.reset();
206
+ handleFinalize();
207
+ }
208
+ },
209
+ onTouchesCancel: event => {
210
+ const pressableEvent = gestureTouchToPressableEvent(event);
211
+ stateMachine.reset();
212
+ handlePressOut(pressableEvent, false);
213
+ },
214
+ onFinalize: event => {
215
+ if (Platform.OS !== 'web') {
216
+ return;
217
+ }
218
+ stateMachine.handleEvent(event.canceled ? StateMachineEvent.CANCEL : StateMachineEvent.FINALIZE);
219
+ handleFinalize();
220
+ },
221
+ enabled: disabled !== true,
222
+ disableReanimated: true,
223
+ simultaneousWith: simultaneousWith,
224
+ block: block,
225
+ requireToFail: requireToFail,
226
+ hitSlop: appliedHitSlop
227
+ });
228
+
229
+ // RNButton is placed inside ButtonGesture to enable Android's ripple and to capture non-propagating events
230
+ const buttonGesture = useNativeGesture({
231
+ onTouchesCancel: event => {
232
+ if (Platform.OS !== 'macos' && Platform.OS !== 'web') {
233
+ // On MacOS cancel occurs in middle of gesture
234
+ // On Web cancel occurs on mouse move, which is unwanted
235
+ const pressableEvent = gestureTouchToPressableEvent(event);
236
+ stateMachine.reset();
237
+ handlePressOut(pressableEvent, false);
238
+ }
239
+ },
240
+ onBegin: () => {
241
+ captureKeyboardDismiss();
242
+ if (dropKeyboardTapRef.current) {
243
+ return;
244
+ }
245
+ if (Platform.isTV) {
246
+ // tvOS drives this native gesture from the focus-engine Select press.
247
+ // The press state machine is touch-based and never
248
+ // receives LONG_PRESS_TOUCHES_DOWN here, so bypass it and drive the press handlers directly.
249
+ // A focus-driven press has no coordinates, so skip the hit-slop bounds check entirely.
250
+ handlePressIn(viewCenterToPressableEvent(dimensions.current), true);
251
+ return;
252
+ }
253
+ if (Platform.OS === 'android' && isScreenReaderEnabled) {
254
+ stateMachine.handleEvent(StateMachineEvent.NATIVE_BEGIN, viewCenterToPressableEvent(dimensions.current));
255
+ return;
256
+ }
257
+ stateMachine.handleEvent(StateMachineEvent.NATIVE_BEGIN);
258
+ },
259
+ onActivate: () => {
260
+ if (!Platform.isTV && Platform.OS !== 'android') {
261
+ stateMachine.handleEvent(StateMachineEvent.NATIVE_START);
262
+ }
263
+ },
264
+ onFinalize: event => {
265
+ // On Web we use LongPress.onFinalize instead of Native.onFinalize,
266
+ // as Native cancels on mouse move, and LongPress does not.
267
+ if (Platform.OS === 'web') {
268
+ return;
269
+ }
270
+ if (Platform.isTV) {
271
+ handlePressOut(viewCenterToPressableEvent(dimensions.current), !event.canceled);
272
+ handleFinalize();
273
+ return;
274
+ }
275
+ stateMachine.handleEvent(event.canceled ? StateMachineEvent.CANCEL : StateMachineEvent.FINALIZE);
276
+ handleFinalize();
277
+ },
278
+ enabled: disabled !== true,
279
+ disableReanimated: true,
280
+ simultaneousWith,
281
+ block,
282
+ requireToFail,
283
+ hitSlop: appliedHitSlop,
284
+ shouldActivateOnStart: Platform.OS === 'web'
285
+ });
286
+ const gesture = useSimultaneousGestures(buttonGesture, pressAndTouchGesture, hoverGesture);
287
+
288
+ // `cursor: 'pointer'` on `RNButton` crashes iOS
289
+ const pointerStyle = Platform.OS === 'web' ? {
290
+ cursor: 'pointer'
291
+ } : {};
292
+
293
+ // `testOnly_pressed` forces the pressed state for snapshots/tests. Derive the
294
+ // displayed value from it each render, keeping the interactive `pressedState`
295
+ // independent (seeded to false) so clearing the prop doesn't leave it stuck.
296
+ const displayPressed = testOnly_pressed ?? pressedState;
297
+ const styleProp = typeof style === 'function' ? style({
298
+ pressed: displayPressed
299
+ }) : style;
300
+ const childrenProp = typeof children === 'function' ? children({
301
+ pressed: displayPressed
302
+ }) : children;
303
+ const rippleColor = useMemo(() => {
304
+ const defaultRippleColor = android_ripple ? undefined : 'transparent';
305
+ return android_ripple?.color ?? defaultRippleColor;
306
+ }, [android_ripple]);
307
+ const setDimensions = useCallback(event => {
308
+ onLayout?.(event);
309
+ dimensions.current = event.nativeEvent.layout;
310
+ }, [onLayout]);
311
+ const tvProps = getTVProps(remainingProps);
312
+ return /*#__PURE__*/_jsx(GestureDetector, {
313
+ gesture: gesture,
314
+ children: /*#__PURE__*/_jsxs(PureNativeButton, {
315
+ ...remainingProps,
316
+ ref: ref,
317
+ ...tvProps,
318
+ onLayout: setDimensions,
319
+ accessible: accessible !== false,
320
+ hitSlop: appliedHitSlop,
321
+ enabled: disabled !== true,
322
+ touchSoundDisabled: android_disableSound ?? undefined,
323
+ rippleColor: rippleColor,
324
+ rippleRadius: android_ripple?.radius ?? undefined,
325
+ style: [pointerStyle, styleProp],
326
+ testOnly_onPress: IS_TEST_ENV ? onPress : undefined,
327
+ testOnly_onPressIn: IS_TEST_ENV ? onPressIn : undefined,
328
+ testOnly_onPressOut: IS_TEST_ENV ? onPressOut : undefined,
329
+ testOnly_onLongPress: IS_TEST_ENV ? onLongPress : undefined,
330
+ children: [childrenProp, __DEV__ ? /*#__PURE__*/_jsx(PressabilityDebugView, {
331
+ color: "red",
332
+ hitSlop: normalizedHitSlop
333
+ }) : null]
334
+ })
335
+ });
336
+ };
337
+ export default StatefulPressable;
338
+ //# sourceMappingURL=StatefulPressable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","use","useCallback","useEffect","useMemo","useRef","useState","Platform","getStatesConfig","StateMachineEvent","PressableStateMachine","addInsets","gestureToPressableEvent","gestureTouchToPressableEvent","isTouchWithinInset","numberAsInset","viewCenterToPressableEvent","getTVProps","PressabilityDebugView","useIsScreenReaderEnabled","INT32_MAX","isTestEnv","GestureDetector","useHoverGesture","useLongPressGesture","useNativeGesture","useSimultaneousGestures","isKeyboardDismissingTap","JSResponderContext","PureNativeButton","jsx","_jsx","jsxs","_jsxs","DEFAULT_LONG_PRESS_DURATION","IS_TEST_ENV","StatefulPressable","props","testOnly_pressed","hitSlop","pressRetentionOffset","delayHoverIn","delayHoverOut","delayLongPress","unstable_pressDelay","onHoverIn","onHoverOut","onPress","onPressIn","onPressOut","onLongPress","onLayout","style","children","android_disableSound","android_ripple","disabled","accessible","simultaneousWith","requireToFail","block","ref","remainingProps","pressedState","setPressedState","longPressTimeoutRef","pressDelayTimeoutRef","isOnPressAllowed","jsResponderContext","isCurrentlyPressed","dimensions","width","height","dropKeyboardTapRef","normalizedHitSlop","normalizedPressRetentionOffset","appliedHitSlop","cancelLongPress","current","clearTimeout","cancelDelayedPress","startLongPress","event","setTimeout","innerHandlePressIn","handleFinalize","captureKeyboardDismiss","handlePressIn","skipBoundsCheck","nativeEvent","changedTouches","at","handlePressOut","success","stateMachine","isScreenReaderEnabled","configuration","setStates","hoverInTimeout","hoverOutTimeout","hoverGesture","manualActivation","cancelsTouchesInView","onBegin","onFinalize","enabled","disableReanimated","pressAndTouchGesture","minDuration","OS","maxDistance","onTouchesDown","pressableEvent","handleEvent","LONG_PRESS_TOUCHES_DOWN","onTouchesUp","reset","onTouchesCancel","canceled","CANCEL","FINALIZE","buttonGesture","isTV","NATIVE_BEGIN","onActivate","NATIVE_START","shouldActivateOnStart","gesture","pointerStyle","cursor","displayPressed","styleProp","pressed","childrenProp","rippleColor","defaultRippleColor","undefined","color","setDimensions","layout","tvProps","touchSoundDisabled","rippleRadius","radius","testOnly_onPress","testOnly_onPressIn","testOnly_onPressOut","testOnly_onLongPress","__DEV__"],"sourceRoot":"../../../../src","sources":["v3/components/StatefulPressable.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IACVC,GAAG,EACHC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AAOd,SAASC,QAAQ,QAAQ,cAAc;AAOvC,SACEC,eAAe,EACfC,iBAAiB,QACZ,6CAA6C;AACpD,SAASC,qBAAqB,QAAQ,yCAAyC;AAC/E,SAC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AW,GAAGY,OAAO,GAAGyF,SAAU;MACpDS,kBAAkB,EAAE9G,WAAW,GAAGa,SAAS,GAAGwF,SAAU;MACxDU,mBAAmB,EAAE/G,WAAW,GAAGc,UAAU,GAAGuF,SAAU;MAC1DW,oBAAoB,EAAEhH,WAAW,GAAGe,WAAW,GAAGsF,SAAU;MAAAnF,QAAA,GAC3DgF,YAAY,EACZe,OAAO,gBACNrH,IAAA,CAACb,qBAAqB;QAACuH,KAAK,EAAC,KAAK;QAAClG,OAAO,EAAEmC;MAAkB,CAAE,CAAC,GAC/D,IAAI;IAAA,CACQ;EAAC,CACJ,CAAC;AAEtB,CAAC;AAED,eAAetC,iBAAiB","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ // A pointer cursor only applies on the web (see the `.web` counterpart); other
4
+ // platforms contribute nothing.
5
+ export const pointerStyle = {};
6
+ //# sourceMappingURL=pointerStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["pointerStyle"],"sourceRoot":"../../../../src","sources":["v3/components/pointerStyle.ts"],"mappings":";;AAEA;AACA;AACA,OAAO,MAAMA,YAAuB,GAAG,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ // react-native-web sets `cursor: 'pointer'` on its interactive components
4
+ // (Pressable, TouchableOpacity, …) but not on `View`, which the native button
5
+ // renders — so the Touchable-based Pressable adds it here to match RN Pressable.
6
+ export const pointerStyle = {
7
+ cursor: 'pointer'
8
+ };
9
+ //# sourceMappingURL=pointerStyle.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["pointerStyle","cursor"],"sourceRoot":"../../../../src","sources":["v3/components/pointerStyle.web.ts"],"mappings":";;AAEA;AACA;AACA;AACA,OAAO,MAAMA,YAAuB,GAAG;EAAEC,MAAM,EAAE;AAAU,CAAC","ignoreList":[]}