react-native-gesture-handler 3.5.0-nightly-20261104-754229cba → 3.5.1

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 (156) hide show
  1. package/apple/Handlers/RNManualHandler.m +5 -0
  2. package/apple/RNGestureHandler.h +2 -0
  3. package/apple/RNGestureHandler.mm +23 -2
  4. package/apple/RNGestureHandlerManager.mm +32 -15
  5. package/apple/RNGestureHandlerModule.mm +21 -4
  6. package/lib/module/RNGestureHandlerModule.web.js +3 -0
  7. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  8. package/lib/module/components/Pressable/utils.js.map +1 -1
  9. package/lib/module/components/ReanimatedDrawerLayout.js.map +1 -1
  10. package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js.map +1 -1
  11. package/lib/module/v3/components/GestureButtons.js +7 -0
  12. package/lib/module/v3/components/GestureButtons.js.map +1 -1
  13. package/lib/module/v3/components/GestureComponents.js +10 -0
  14. package/lib/module/v3/components/GestureComponents.js.map +1 -1
  15. package/lib/module/v3/components/GestureComponents.web.js +8 -0
  16. package/lib/module/v3/components/GestureComponents.web.js.map +1 -1
  17. package/lib/module/v3/components/PressableWithTouchable.js +15 -6
  18. package/lib/module/v3/components/PressableWithTouchable.js.map +1 -1
  19. package/lib/module/v3/components/ScrollViewResponderInterceptor.js +45 -1
  20. package/lib/module/v3/components/ScrollViewResponderInterceptor.js.map +1 -1
  21. package/lib/module/v3/components/StatefulPressable.js +18 -7
  22. package/lib/module/v3/components/StatefulPressable.js.map +1 -1
  23. package/lib/module/v3/components/Touchable/Touchable.js +27 -8
  24. package/lib/module/v3/components/Touchable/Touchable.js.map +1 -1
  25. package/lib/module/v3/detectors/NativeDetector.js +7 -2
  26. package/lib/module/v3/detectors/NativeDetector.js.map +1 -1
  27. package/lib/module/v3/detectors/VirtualDetector/InterceptingGestureDetector.js +7 -2
  28. package/lib/module/v3/detectors/VirtualDetector/InterceptingGestureDetector.js.map +1 -1
  29. package/lib/module/v3/detectors/VirtualDetector/VirtualDetector.js +2 -0
  30. package/lib/module/v3/detectors/VirtualDetector/VirtualDetector.js.map +1 -1
  31. package/lib/module/v3/hooks/gestures/fling/FlingTypes.js +2 -0
  32. package/lib/module/v3/hooks/gestures/fling/FlingTypes.js.map +1 -1
  33. package/lib/module/v3/hooks/gestures/hover/HoverTypes.js +2 -0
  34. package/lib/module/v3/hooks/gestures/hover/HoverTypes.js.map +1 -1
  35. package/lib/module/v3/hooks/gestures/index.js.map +1 -1
  36. package/lib/module/v3/hooks/gestures/longPress/LongPressTypes.js +2 -0
  37. package/lib/module/v3/hooks/gestures/longPress/LongPressTypes.js.map +1 -1
  38. package/lib/module/v3/hooks/gestures/native/NativeTypes.js +2 -0
  39. package/lib/module/v3/hooks/gestures/native/NativeTypes.js.map +1 -1
  40. package/lib/module/v3/hooks/gestures/pan/PanTypes.js +2 -0
  41. package/lib/module/v3/hooks/gestures/pan/PanTypes.js.map +1 -1
  42. package/lib/module/v3/hooks/gestures/tap/TapTypes.js +2 -0
  43. package/lib/module/v3/hooks/gestures/tap/TapTypes.js.map +1 -1
  44. package/lib/module/v3/index.js.map +1 -1
  45. package/lib/module/v3/nativeWrapperGuard.js +48 -0
  46. package/lib/module/v3/nativeWrapperGuard.js.map +1 -0
  47. package/lib/module/v3/scrollViewInterop.js +9 -0
  48. package/lib/module/v3/scrollViewInterop.js.map +1 -1
  49. package/lib/module/web/constants.js +3 -1
  50. package/lib/module/web/constants.js.map +1 -1
  51. package/lib/module/web/handlers/GestureHandler.js +16 -5
  52. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  53. package/lib/module/web/handlers/LongPressGestureHandler.js +6 -6
  54. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
  55. package/lib/module/web/tools/GestureHandlerOrchestrator.js +6 -2
  56. package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  57. package/lib/module/web/tools/GestureHandlerWebDelegate.js +42 -9
  58. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  59. package/lib/module/web/tools/PointerTracker.js +15 -8
  60. package/lib/module/web/tools/PointerTracker.js.map +1 -1
  61. package/lib/typescript/RNGestureHandlerModule.web.d.ts.map +1 -1
  62. package/lib/typescript/components/Pressable/utils.d.ts +2 -3
  63. package/lib/typescript/components/Pressable/utils.d.ts.map +1 -1
  64. package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeable.d.ts.map +1 -1
  65. package/lib/typescript/v3/components/GestureButtons.d.ts.map +1 -1
  66. package/lib/typescript/v3/components/GestureComponents.d.ts.map +1 -1
  67. package/lib/typescript/v3/components/GestureComponents.web.d.ts.map +1 -1
  68. package/lib/typescript/v3/components/PressableWithTouchable.d.ts.map +1 -1
  69. package/lib/typescript/v3/components/ScrollViewResponderInterceptor.d.ts +2 -1
  70. package/lib/typescript/v3/components/ScrollViewResponderInterceptor.d.ts.map +1 -1
  71. package/lib/typescript/v3/components/StatefulPressable.d.ts.map +1 -1
  72. package/lib/typescript/v3/components/Touchable/Touchable.d.ts.map +1 -1
  73. package/lib/typescript/v3/components/Touchable/TouchableProps.d.ts +0 -4
  74. package/lib/typescript/v3/components/Touchable/TouchableProps.d.ts.map +1 -1
  75. package/lib/typescript/v3/detectors/NativeDetector.d.ts.map +1 -1
  76. package/lib/typescript/v3/detectors/VirtualDetector/InterceptingGestureDetector.d.ts.map +1 -1
  77. package/lib/typescript/v3/detectors/VirtualDetector/VirtualDetector.d.ts.map +1 -1
  78. package/lib/typescript/v3/hooks/gestures/fling/FlingTypes.d.ts +7 -3
  79. package/lib/typescript/v3/hooks/gestures/fling/FlingTypes.d.ts.map +1 -1
  80. package/lib/typescript/v3/hooks/gestures/hover/HoverTypes.d.ts +6 -2
  81. package/lib/typescript/v3/hooks/gestures/hover/HoverTypes.d.ts.map +1 -1
  82. package/lib/typescript/v3/hooks/gestures/index.d.ts +19 -19
  83. package/lib/typescript/v3/hooks/gestures/index.d.ts.map +1 -1
  84. package/lib/typescript/v3/hooks/gestures/longPress/LongPressTypes.d.ts +7 -3
  85. package/lib/typescript/v3/hooks/gestures/longPress/LongPressTypes.d.ts.map +1 -1
  86. package/lib/typescript/v3/hooks/gestures/manual/ManualTypes.d.ts +7 -3
  87. package/lib/typescript/v3/hooks/gestures/manual/ManualTypes.d.ts.map +1 -1
  88. package/lib/typescript/v3/hooks/gestures/native/NativeTypes.d.ts +7 -3
  89. package/lib/typescript/v3/hooks/gestures/native/NativeTypes.d.ts.map +1 -1
  90. package/lib/typescript/v3/hooks/gestures/pan/PanTypes.d.ts +6 -2
  91. package/lib/typescript/v3/hooks/gestures/pan/PanTypes.d.ts.map +1 -1
  92. package/lib/typescript/v3/hooks/gestures/pinch/PinchTypes.d.ts +6 -2
  93. package/lib/typescript/v3/hooks/gestures/pinch/PinchTypes.d.ts.map +1 -1
  94. package/lib/typescript/v3/hooks/gestures/rotation/RotationTypes.d.ts +6 -2
  95. package/lib/typescript/v3/hooks/gestures/rotation/RotationTypes.d.ts.map +1 -1
  96. package/lib/typescript/v3/hooks/gestures/tap/TapTypes.d.ts +7 -3
  97. package/lib/typescript/v3/hooks/gestures/tap/TapTypes.d.ts.map +1 -1
  98. package/lib/typescript/v3/index.d.ts +1 -1
  99. package/lib/typescript/v3/index.d.ts.map +1 -1
  100. package/lib/typescript/v3/nativeWrapperGuard.d.ts +5 -0
  101. package/lib/typescript/v3/nativeWrapperGuard.d.ts.map +1 -0
  102. package/lib/typescript/v3/scrollViewInterop.d.ts +1 -0
  103. package/lib/typescript/v3/scrollViewInterop.d.ts.map +1 -1
  104. package/lib/typescript/web/constants.d.ts +1 -1
  105. package/lib/typescript/web/constants.d.ts.map +1 -1
  106. package/lib/typescript/web/handlers/GestureHandler.d.ts +4 -3
  107. package/lib/typescript/web/handlers/GestureHandler.d.ts.map +1 -1
  108. package/lib/typescript/web/handlers/IGestureHandler.d.ts +1 -1
  109. package/lib/typescript/web/handlers/IGestureHandler.d.ts.map +1 -1
  110. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +2 -3
  111. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts.map +1 -1
  112. package/lib/typescript/web/interfaces.d.ts +1 -1
  113. package/lib/typescript/web/interfaces.d.ts.map +1 -1
  114. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +1 -1
  115. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts.map +1 -1
  116. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +3 -0
  117. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts.map +1 -1
  118. package/lib/typescript/web/tools/PointerTracker.d.ts +2 -1
  119. package/lib/typescript/web/tools/PointerTracker.d.ts.map +1 -1
  120. package/package.json +12 -4
  121. package/src/RNGestureHandlerModule.web.ts +3 -0
  122. package/src/components/Pressable/utils.ts +8 -8
  123. package/src/components/ReanimatedDrawerLayout.tsx +2 -2
  124. package/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx +5 -2
  125. package/src/v3/components/GestureButtons.tsx +13 -9
  126. package/src/v3/components/GestureComponents.tsx +11 -1
  127. package/src/v3/components/GestureComponents.web.tsx +9 -0
  128. package/src/v3/components/PressableWithTouchable.tsx +16 -6
  129. package/src/v3/components/ScrollViewResponderInterceptor.tsx +57 -0
  130. package/src/v3/components/StatefulPressable.tsx +20 -6
  131. package/src/v3/components/Touchable/Touchable.tsx +33 -8
  132. package/src/v3/components/Touchable/TouchableProps.ts +0 -5
  133. package/src/v3/detectors/NativeDetector.tsx +5 -1
  134. package/src/v3/detectors/VirtualDetector/InterceptingGestureDetector.tsx +5 -1
  135. package/src/v3/detectors/VirtualDetector/VirtualDetector.tsx +2 -0
  136. package/src/v3/hooks/gestures/fling/FlingTypes.ts +7 -2
  137. package/src/v3/hooks/gestures/hover/HoverTypes.ts +7 -1
  138. package/src/v3/hooks/gestures/index.ts +83 -9
  139. package/src/v3/hooks/gestures/longPress/LongPressTypes.ts +9 -2
  140. package/src/v3/hooks/gestures/manual/ManualTypes.ts +7 -2
  141. package/src/v3/hooks/gestures/native/NativeTypes.ts +7 -2
  142. package/src/v3/hooks/gestures/pan/PanTypes.ts +6 -1
  143. package/src/v3/hooks/gestures/pinch/PinchTypes.ts +7 -1
  144. package/src/v3/hooks/gestures/rotation/RotationTypes.ts +7 -1
  145. package/src/v3/hooks/gestures/tap/TapTypes.ts +7 -2
  146. package/src/v3/index.ts +27 -0
  147. package/src/v3/nativeWrapperGuard.ts +74 -0
  148. package/src/v3/scrollViewInterop.ts +10 -0
  149. package/src/web/constants.ts +3 -1
  150. package/src/web/handlers/GestureHandler.ts +20 -7
  151. package/src/web/handlers/IGestureHandler.ts +1 -1
  152. package/src/web/handlers/LongPressGestureHandler.ts +7 -20
  153. package/src/web/interfaces.ts +1 -1
  154. package/src/web/tools/GestureHandlerOrchestrator.ts +14 -2
  155. package/src/web/tools/GestureHandlerWebDelegate.ts +65 -14
  156. package/src/web/tools/PointerTracker.ts +19 -8
@@ -3,6 +3,7 @@ import type { HoverEffect } from '../../../../HoverEffect';
3
3
  import type {
4
4
  BaseGestureConfig,
5
5
  ExcludeInternalConfigProps,
6
+ GestureEndEvent,
6
7
  GestureEvent,
7
8
  SingleGesture,
8
9
  WithSharedValue,
@@ -66,8 +67,13 @@ export type HoverGestureInternalConfig = BaseGestureConfig<
66
67
  HoverExtendedHandlerData
67
68
  >;
68
69
 
69
- export type HoverGestureEvent = GestureEvent<HoverHandlerData>;
70
+ export type HoverGestureBeginEvent = GestureEvent<HoverHandlerData>;
70
71
  export type HoverGestureActiveEvent = GestureEvent<HoverExtendedHandlerData>;
72
+ export type HoverGestureDeactivateEvent =
73
+ GestureEndEvent<HoverExtendedHandlerData>;
74
+ export type HoverGestureFinalizeEvent = GestureEndEvent<HoverHandlerData>;
75
+ /** @deprecated Use `HoverGestureBeginEvent` instead. */
76
+ export type HoverGestureEvent = HoverGestureBeginEvent;
71
77
 
72
78
  export type HoverGesture = SingleGesture<
73
79
  HoverGestureInternalProperties,
@@ -1,127 +1,181 @@
1
1
  import type {
2
2
  FlingGesture,
3
3
  FlingGestureActiveEvent,
4
+ FlingGestureBeginEvent,
4
5
  FlingGestureConfig,
6
+ FlingGestureDeactivateEvent,
5
7
  FlingGestureEvent,
8
+ FlingGestureFinalizeEvent,
6
9
  } from './fling/FlingTypes';
7
10
  import type {
8
11
  HoverGesture,
9
12
  HoverGestureActiveEvent,
13
+ HoverGestureBeginEvent,
10
14
  HoverGestureConfig,
15
+ HoverGestureDeactivateEvent,
11
16
  HoverGestureEvent,
17
+ HoverGestureFinalizeEvent,
12
18
  } from './hover/HoverTypes';
13
19
  import type {
14
20
  LongPressGesture,
15
21
  LongPressGestureActiveEvent,
22
+ LongPressGestureBeginEvent,
16
23
  LongPressGestureConfig,
24
+ LongPressGestureDeactivateEvent,
17
25
  LongPressGestureEvent,
26
+ LongPressGestureFinalizeEvent,
18
27
  } from './longPress/LongPressTypes';
19
28
  import type {
20
29
  ManualGesture,
21
30
  ManualGestureActiveEvent,
31
+ ManualGestureBeginEvent,
22
32
  ManualGestureConfig,
33
+ ManualGestureDeactivateEvent,
23
34
  ManualGestureEvent,
35
+ ManualGestureFinalizeEvent,
24
36
  } from './manual/ManualTypes';
25
37
  import type {
26
38
  NativeGesture,
27
39
  NativeGestureActiveEvent,
40
+ NativeGestureBeginEvent,
28
41
  NativeGestureConfig,
42
+ NativeGestureDeactivateEvent,
29
43
  NativeGestureEvent,
44
+ NativeGestureFinalizeEvent,
30
45
  } from './native/NativeTypes';
31
46
  import type {
32
47
  PanGesture,
33
48
  PanGestureActiveEvent,
49
+ PanGestureBeginEvent,
34
50
  PanGestureConfig,
51
+ PanGestureDeactivateEvent,
35
52
  PanGestureEvent,
53
+ PanGestureFinalizeEvent,
36
54
  } from './pan/PanTypes';
37
55
  import type {
38
56
  PinchGesture,
39
57
  PinchGestureActiveEvent,
58
+ PinchGestureBeginEvent,
40
59
  PinchGestureConfig,
60
+ PinchGestureDeactivateEvent,
41
61
  PinchGestureEvent,
62
+ PinchGestureFinalizeEvent,
42
63
  } from './pinch/PinchTypes';
43
64
  import type {
44
65
  RotationGesture,
45
66
  RotationGestureActiveEvent,
67
+ RotationGestureBeginEvent,
46
68
  RotationGestureConfig,
69
+ RotationGestureDeactivateEvent,
47
70
  RotationGestureEvent,
71
+ RotationGestureFinalizeEvent,
48
72
  } from './rotation/RotationTypes';
49
73
  import type {
50
74
  TapGesture,
51
75
  TapGestureActiveEvent,
76
+ TapGestureBeginEvent,
52
77
  TapGestureConfig,
78
+ TapGestureDeactivateEvent,
53
79
  TapGestureEvent,
80
+ TapGestureFinalizeEvent,
54
81
  } from './tap/TapTypes';
55
82
 
56
83
  export type {
57
84
  TapGesture,
58
85
  TapGestureActiveEvent,
86
+ TapGestureBeginEvent,
59
87
  TapGestureConfig,
88
+ TapGestureDeactivateEvent,
60
89
  TapGestureEvent,
90
+ TapGestureFinalizeEvent,
61
91
  };
62
92
  export { useTapGesture } from './tap/useTapGesture';
63
93
 
64
94
  export type {
65
95
  FlingGesture,
66
96
  FlingGestureActiveEvent,
97
+ FlingGestureBeginEvent,
67
98
  FlingGestureConfig,
99
+ FlingGestureDeactivateEvent,
68
100
  FlingGestureEvent,
101
+ FlingGestureFinalizeEvent,
69
102
  };
70
103
  export { useFlingGesture } from './fling/useFlingGesture';
71
104
 
72
105
  export type {
73
106
  LongPressGesture,
74
107
  LongPressGestureActiveEvent,
108
+ LongPressGestureBeginEvent,
75
109
  LongPressGestureConfig,
110
+ LongPressGestureDeactivateEvent,
76
111
  LongPressGestureEvent,
112
+ LongPressGestureFinalizeEvent,
77
113
  };
78
114
  export { useLongPressGesture } from './longPress/useLongPressGesture';
79
115
 
80
116
  export type {
81
117
  PinchGesture,
82
118
  PinchGestureActiveEvent,
119
+ PinchGestureBeginEvent,
83
120
  PinchGestureConfig,
121
+ PinchGestureDeactivateEvent,
84
122
  PinchGestureEvent,
123
+ PinchGestureFinalizeEvent,
85
124
  };
86
125
  export { usePinchGesture } from './pinch/usePinchGesture';
87
126
 
88
127
  export type {
89
128
  RotationGesture,
90
129
  RotationGestureActiveEvent,
130
+ RotationGestureBeginEvent,
91
131
  RotationGestureConfig,
132
+ RotationGestureDeactivateEvent,
92
133
  RotationGestureEvent,
134
+ RotationGestureFinalizeEvent,
93
135
  };
94
136
  export { useRotationGesture } from './rotation/useRotationGesture';
95
137
 
96
138
  export type {
97
139
  HoverGesture,
98
140
  HoverGestureActiveEvent,
141
+ HoverGestureBeginEvent,
99
142
  HoverGestureConfig,
143
+ HoverGestureDeactivateEvent,
100
144
  HoverGestureEvent,
145
+ HoverGestureFinalizeEvent,
101
146
  };
102
147
  export { useHoverGesture } from './hover/useHoverGesture';
103
148
 
104
149
  export type {
105
150
  ManualGesture,
106
151
  ManualGestureActiveEvent,
152
+ ManualGestureBeginEvent,
107
153
  ManualGestureConfig,
154
+ ManualGestureDeactivateEvent,
108
155
  ManualGestureEvent,
156
+ ManualGestureFinalizeEvent,
109
157
  };
110
158
  export { useManualGesture } from './manual/useManualGesture';
111
159
 
112
160
  export type {
113
161
  NativeGesture,
114
162
  NativeGestureActiveEvent,
163
+ NativeGestureBeginEvent,
115
164
  NativeGestureConfig,
165
+ NativeGestureDeactivateEvent,
116
166
  NativeGestureEvent,
167
+ NativeGestureFinalizeEvent,
117
168
  };
118
169
  export { useNativeGesture } from './native/useNativeGesture';
119
170
 
120
171
  export type {
121
172
  PanGesture,
122
173
  PanGestureActiveEvent,
174
+ PanGestureBeginEvent,
123
175
  PanGestureConfig,
176
+ PanGestureDeactivateEvent,
124
177
  PanGestureEvent,
178
+ PanGestureFinalizeEvent,
125
179
  };
126
180
  export { usePanGesture } from './pan/usePanGesture';
127
181
 
@@ -138,20 +192,40 @@ export type SingleGesture =
138
192
 
139
193
  /* eslint-disable @typescript-eslint/no-duplicate-type-constituents */
140
194
  export type SingleGestureEvent =
141
- | TapGestureEvent
195
+ | TapGestureBeginEvent
142
196
  | TapGestureActiveEvent
143
- | FlingGestureEvent
197
+ | TapGestureDeactivateEvent
198
+ | TapGestureFinalizeEvent
199
+ | FlingGestureBeginEvent
144
200
  | FlingGestureActiveEvent
145
- | LongPressGestureEvent
201
+ | FlingGestureDeactivateEvent
202
+ | FlingGestureFinalizeEvent
203
+ | LongPressGestureBeginEvent
146
204
  | LongPressGestureActiveEvent
147
- | RotationGestureEvent
205
+ | LongPressGestureDeactivateEvent
206
+ | LongPressGestureFinalizeEvent
207
+ | PinchGestureBeginEvent
208
+ | PinchGestureActiveEvent
209
+ | PinchGestureDeactivateEvent
210
+ | PinchGestureFinalizeEvent
211
+ | RotationGestureBeginEvent
148
212
  | RotationGestureActiveEvent
149
- | HoverGestureEvent
213
+ | RotationGestureDeactivateEvent
214
+ | RotationGestureFinalizeEvent
215
+ | HoverGestureBeginEvent
150
216
  | HoverGestureActiveEvent
151
- | ManualGestureEvent
217
+ | HoverGestureDeactivateEvent
218
+ | HoverGestureFinalizeEvent
219
+ | ManualGestureBeginEvent
152
220
  | ManualGestureActiveEvent
153
- | NativeGestureEvent
221
+ | ManualGestureDeactivateEvent
222
+ | ManualGestureFinalizeEvent
223
+ | NativeGestureBeginEvent
154
224
  | NativeGestureActiveEvent
155
- | PanGestureEvent
156
- | PanGestureActiveEvent;
225
+ | NativeGestureDeactivateEvent
226
+ | NativeGestureFinalizeEvent
227
+ | PanGestureBeginEvent
228
+ | PanGestureActiveEvent
229
+ | PanGestureDeactivateEvent
230
+ | PanGestureFinalizeEvent;
157
231
  /* eslint-enable @typescript-eslint/no-duplicate-type-constituents */
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  BaseDiscreteGestureConfig,
3
3
  ExcludeInternalConfigProps,
4
+ GestureEndEvent,
4
5
  GestureEvent,
5
6
  SingleGesture,
6
7
  WithSharedValue,
@@ -63,8 +64,14 @@ export type LongPressGestureInternalConfig = BaseDiscreteGestureConfig<
63
64
  LongPressHandlerData
64
65
  >;
65
66
 
66
- export type LongPressGestureEvent = GestureEvent<LongPressHandlerData>;
67
- export type LongPressGestureActiveEvent = LongPressGestureEvent;
67
+ export type LongPressGestureBeginEvent = GestureEvent<LongPressHandlerData>;
68
+ export type LongPressGestureActiveEvent = LongPressGestureBeginEvent;
69
+ export type LongPressGestureDeactivateEvent =
70
+ GestureEndEvent<LongPressHandlerData>;
71
+ export type LongPressGestureFinalizeEvent =
72
+ GestureEndEvent<LongPressHandlerData>;
73
+ /** @deprecated Use `LongPressGestureBeginEvent` instead. */
74
+ export type LongPressGestureEvent = LongPressGestureBeginEvent;
68
75
 
69
76
  export type LongPressGesture = SingleGesture<
70
77
  LongPressGestureProperties,
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  BaseGestureConfig,
3
3
  ExcludeInternalConfigProps,
4
+ GestureEndEvent,
4
5
  GestureEvent,
5
6
  SingleGesture,
6
7
  } from '../../../types';
@@ -19,8 +20,12 @@ export type ManualGestureInternalConfig = BaseGestureConfig<
19
20
  export type ManualGestureConfig =
20
21
  ExcludeInternalConfigProps<ManualGestureInternalConfig>;
21
22
 
22
- export type ManualGestureEvent = GestureEvent<ManualHandlerData>;
23
- export type ManualGestureActiveEvent = ManualGestureEvent;
23
+ export type ManualGestureBeginEvent = GestureEvent<ManualHandlerData>;
24
+ export type ManualGestureActiveEvent = ManualGestureBeginEvent;
25
+ export type ManualGestureDeactivateEvent = GestureEndEvent<ManualHandlerData>;
26
+ export type ManualGestureFinalizeEvent = GestureEndEvent<ManualHandlerData>;
27
+ /** @deprecated Use `ManualGestureBeginEvent` instead. */
28
+ export type ManualGestureEvent = ManualGestureBeginEvent;
24
29
 
25
30
  export type ManualGesture = SingleGesture<
26
31
  ManualGestureProperties,
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  BaseGestureConfig,
3
3
  ExcludeInternalConfigProps,
4
+ GestureEndEvent,
4
5
  GestureEvent,
5
6
  SingleGesture,
6
7
  WithSharedValue,
@@ -73,8 +74,12 @@ export type NativeGestureInternalConfig = BaseGestureConfig<
73
74
  export type NativeGestureConfig =
74
75
  ExcludeInternalConfigProps<NativeGestureInternalConfig>;
75
76
 
76
- export type NativeGestureEvent = GestureEvent<NativeHandlerData>;
77
- export type NativeGestureActiveEvent = NativeGestureEvent;
77
+ export type NativeGestureBeginEvent = GestureEvent<NativeHandlerData>;
78
+ export type NativeGestureActiveEvent = NativeGestureBeginEvent;
79
+ export type NativeGestureDeactivateEvent = GestureEndEvent<NativeHandlerData>;
80
+ export type NativeGestureFinalizeEvent = GestureEndEvent<NativeHandlerData>;
81
+ /** @deprecated Use `NativeGestureBeginEvent` instead. */
82
+ export type NativeGestureEvent = NativeGestureBeginEvent;
78
83
 
79
84
  export type NativeGesture = SingleGesture<
80
85
  NativeGestureProperties,
@@ -2,6 +2,7 @@ import type { StylusData } from '../../../../handlers/gestureHandlerCommon';
2
2
  import type {
3
3
  BaseGestureConfig,
4
4
  ExcludeInternalConfigProps,
5
+ GestureEndEvent,
5
6
  GestureEvent,
6
7
  SingleGesture,
7
8
  WithSharedValue,
@@ -179,8 +180,12 @@ export type PanGestureInternalConfig = BaseGestureConfig<
179
180
  PanExtendedHandlerData
180
181
  >;
181
182
 
182
- export type PanGestureEvent = GestureEvent<PanHandlerData>;
183
+ export type PanGestureBeginEvent = GestureEvent<PanHandlerData>;
183
184
  export type PanGestureActiveEvent = GestureEvent<PanExtendedHandlerData>;
185
+ export type PanGestureDeactivateEvent = GestureEndEvent<PanExtendedHandlerData>;
186
+ export type PanGestureFinalizeEvent = GestureEndEvent<PanHandlerData>;
187
+ /** @deprecated Use `PanGestureBeginEvent` instead. */
188
+ export type PanGestureEvent = PanGestureBeginEvent;
184
189
 
185
190
  export type PanGesture = SingleGesture<
186
191
  PanGestureInternalProperties,
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  BaseGestureConfig,
3
3
  ExcludeInternalConfigProps,
4
+ GestureEndEvent,
4
5
  GestureEvent,
5
6
  SingleGesture,
6
7
  } from '../../../types';
@@ -30,8 +31,13 @@ export type PinchGestureInternalConfig = BaseGestureConfig<
30
31
  export type PinchGestureConfig =
31
32
  ExcludeInternalConfigProps<PinchGestureInternalConfig>;
32
33
 
33
- export type PinchGestureEvent = GestureEvent<PinchHandlerData>;
34
+ export type PinchGestureBeginEvent = GestureEvent<PinchHandlerData>;
34
35
  export type PinchGestureActiveEvent = GestureEvent<PinchExtendedHandlerData>;
36
+ export type PinchGestureDeactivateEvent =
37
+ GestureEndEvent<PinchExtendedHandlerData>;
38
+ export type PinchGestureFinalizeEvent = GestureEndEvent<PinchHandlerData>;
39
+ /** @deprecated Use `PinchGestureBeginEvent` instead. */
40
+ export type PinchGestureEvent = PinchGestureBeginEvent;
35
41
 
36
42
  export type PinchGesture = SingleGesture<
37
43
  PinchGestureProperties,
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  BaseGestureConfig,
3
3
  ExcludeInternalConfigProps,
4
+ GestureEndEvent,
4
5
  GestureEvent,
5
6
  SingleGesture,
6
7
  } from '../../../types';
@@ -30,9 +31,14 @@ export type RotationGestureInternalConfig = BaseGestureConfig<
30
31
  export type RotationGestureConfig =
31
32
  ExcludeInternalConfigProps<RotationGestureInternalConfig>;
32
33
 
33
- export type RotationGestureEvent = GestureEvent<RotationHandlerData>;
34
+ export type RotationGestureBeginEvent = GestureEvent<RotationHandlerData>;
34
35
  export type RotationGestureActiveEvent =
35
36
  GestureEvent<RotationExtendedHandlerData>;
37
+ export type RotationGestureDeactivateEvent =
38
+ GestureEndEvent<RotationExtendedHandlerData>;
39
+ export type RotationGestureFinalizeEvent = GestureEndEvent<RotationHandlerData>;
40
+ /** @deprecated Use `RotationGestureBeginEvent` instead. */
41
+ export type RotationGestureEvent = RotationGestureBeginEvent;
36
42
 
37
43
  export type RotationGesture = SingleGesture<
38
44
  RotationGestureProperties,
@@ -2,6 +2,7 @@ import type {
2
2
  BaseDiscreteGestureConfig,
3
3
  DiscreteSingleGesture,
4
4
  ExcludeInternalConfigProps,
5
+ GestureEndEvent,
5
6
  GestureEvent,
6
7
  WithSharedValue,
7
8
  } from '../../../types';
@@ -96,8 +97,12 @@ export type TapGestureInternalConfig = BaseDiscreteGestureConfig<
96
97
  TapHandlerData
97
98
  >;
98
99
 
99
- export type TapGestureEvent = GestureEvent<TapHandlerData>;
100
- export type TapGestureActiveEvent = TapGestureEvent;
100
+ export type TapGestureBeginEvent = GestureEvent<TapHandlerData>;
101
+ export type TapGestureActiveEvent = TapGestureBeginEvent;
102
+ export type TapGestureDeactivateEvent = GestureEndEvent<TapHandlerData>;
103
+ export type TapGestureFinalizeEvent = GestureEndEvent<TapHandlerData>;
104
+ /** @deprecated Use `TapGestureBeginEvent` instead. */
105
+ export type TapGestureEvent = TapGestureBeginEvent;
101
106
 
102
107
  export type TapGesture = DiscreteSingleGesture<
103
108
  TapGestureInternalProperties,
package/src/v3/index.ts CHANGED
@@ -29,42 +29,69 @@ export { GestureStateManager } from './gestureStateManager';
29
29
  export type {
30
30
  FlingGesture,
31
31
  FlingGestureActiveEvent,
32
+ FlingGestureBeginEvent,
32
33
  FlingGestureConfig,
34
+ FlingGestureDeactivateEvent,
33
35
  FlingGestureEvent,
36
+ FlingGestureFinalizeEvent,
34
37
  HoverGesture,
35
38
  HoverGestureActiveEvent,
39
+ HoverGestureBeginEvent,
36
40
  HoverGestureConfig,
41
+ HoverGestureDeactivateEvent,
37
42
  HoverGestureEvent,
43
+ HoverGestureFinalizeEvent,
38
44
  LongPressGesture,
39
45
  LongPressGestureActiveEvent,
46
+ LongPressGestureBeginEvent,
40
47
  LongPressGestureConfig,
48
+ LongPressGestureDeactivateEvent,
41
49
  LongPressGestureEvent,
50
+ LongPressGestureFinalizeEvent,
42
51
  ManualGesture,
43
52
  ManualGestureActiveEvent,
53
+ ManualGestureBeginEvent,
44
54
  ManualGestureConfig,
55
+ ManualGestureDeactivateEvent,
45
56
  ManualGestureEvent,
57
+ ManualGestureFinalizeEvent,
46
58
  NativeGesture,
47
59
  NativeGestureActiveEvent,
60
+ NativeGestureBeginEvent,
48
61
  NativeGestureConfig,
62
+ NativeGestureDeactivateEvent,
49
63
  NativeGestureEvent,
64
+ NativeGestureFinalizeEvent,
50
65
  PanGesture,
51
66
  PanGestureActiveEvent,
67
+ PanGestureBeginEvent,
52
68
  PanGestureConfig,
69
+ PanGestureDeactivateEvent,
53
70
  PanGestureEvent,
71
+ PanGestureFinalizeEvent,
54
72
  PinchGesture,
55
73
  PinchGestureActiveEvent,
74
+ PinchGestureBeginEvent,
56
75
  PinchGestureConfig,
76
+ PinchGestureDeactivateEvent,
57
77
  PinchGestureEvent,
78
+ PinchGestureFinalizeEvent,
58
79
  RotationGesture,
59
80
  RotationGestureActiveEvent,
81
+ RotationGestureBeginEvent,
60
82
  RotationGestureConfig,
83
+ RotationGestureDeactivateEvent,
61
84
  RotationGestureEvent,
85
+ RotationGestureFinalizeEvent,
62
86
  SingleGesture,
63
87
  SingleGestureEvent,
64
88
  TapGesture,
65
89
  TapGestureActiveEvent,
90
+ TapGestureBeginEvent,
66
91
  TapGestureConfig,
92
+ TapGestureDeactivateEvent,
67
93
  TapGestureEvent,
94
+ TapGestureFinalizeEvent,
68
95
  } from './hooks';
69
96
  export {
70
97
  useCompetingGestures,
@@ -0,0 +1,74 @@
1
+ import type { ReactNode } from 'react';
2
+ import React from 'react';
3
+
4
+ import { tagMessage } from '../utils';
5
+ import { isComposedGesture } from './hooks/utils/relationUtils';
6
+ import type { Gesture } from './types';
7
+ import { SingleGestureName } from './types';
8
+
9
+ // Exported components that already come with a Native gesture attached
10
+ const nativeWrappers = new Map<unknown, string>();
11
+ // Places in the app that the warning was already logged for
12
+ const reportedPlaces = new Set<string>();
13
+
14
+ export function registerNativeWrappers(components: Record<string, unknown>) {
15
+ if (__DEV__) {
16
+ for (const [name, Component] of Object.entries(components)) {
17
+ nativeWrappers.set(Component, name);
18
+ }
19
+ }
20
+ }
21
+
22
+ // Turns an owner stack into the `in Component` lines React uses in its warnings
23
+ function describeOwners(ownerStack: string) {
24
+ const owners = [
25
+ ...ownerStack.matchAll(/^\s*at ([A-Z][\w$]*)(?:\.render)? \(/gm),
26
+ ];
27
+
28
+ return owners
29
+ .slice(0, 5)
30
+ .map(([, name]) => `\n in ${name}`)
31
+ .join('');
32
+ }
33
+
34
+ function containsNativeGesture(gesture: Gesture): boolean {
35
+ return isComposedGesture(gesture)
36
+ ? gesture.gestures.some(containsNativeGesture)
37
+ : gesture.type === SingleGestureName.Native;
38
+ }
39
+
40
+ export function warnIfNativeGestureWrapsNativeWrapper<TConfig, THandlerData>(
41
+ gesture: Gesture<TConfig, THandlerData> | undefined,
42
+ children: ReactNode
43
+ ) {
44
+ if (!__DEV__ || !gesture || !containsNativeGesture(gesture as Gesture)) {
45
+ return;
46
+ }
47
+
48
+ const child = (
49
+ Array.isArray(children) && children.length === 1 ? children[0] : children
50
+ ) as { type?: unknown } | null | undefined;
51
+
52
+ const childName = nativeWrappers.get(child?.type);
53
+
54
+ if (!childName) {
55
+ return;
56
+ }
57
+
58
+ // Identifies the place rendering the detector, so each one is reported once
59
+ // eslint-disable-next-line @eslint-react/no-misused-capture-owner-stack -- guarded by __DEV__
60
+ const ownerStack = React.captureOwnerStack?.() ?? '';
61
+ const place = childName + ownerStack;
62
+
63
+ if (reportedPlaces.has(place)) {
64
+ return;
65
+ }
66
+
67
+ reportedPlaces.add(place);
68
+
69
+ console.warn(
70
+ tagMessage(
71
+ `${childName} already has a Native gesture attached by Gesture Handler. Wrapping it with a GestureDetector that uses a Native gesture may result in unexpected behavior. Configure the gesture through the props of ${childName}, or use a component that is not wrapped (e.g. the one exported from \`react-native\`).${describeOwners(ownerStack)}`
72
+ )
73
+ );
74
+ }
@@ -60,3 +60,13 @@ export function isKeyboardDismissingTap(
60
60
  TextInput.State.currentlyFocusedInput?.() != null)
61
61
  );
62
62
  }
63
+
64
+ // A button activating mid-press cancels the JS responder, so RN ScrollView's
65
+ // release-time blur never runs - the button that dropped the press dismisses
66
+ export function dismissKeyboardForDroppedTap() {
67
+ const focusedInput = TextInput.State.currentlyFocusedInput?.();
68
+
69
+ if (focusedInput != null) {
70
+ TextInput.State.blurTextInput(focusedInput);
71
+ }
72
+ }
@@ -6,4 +6,6 @@ export const NATIVE_GESTURE_ROLE_ATTRIBUTE = 'rngh-role';
6
6
  // not set.
7
7
  export const DEFAULT_TOUCH_ACTION = 'none';
8
8
  export const DEFAULT_USER_SELECT = 'none';
9
- export const DEFAULT_ENABLE_CONTEXT_MENU = false;
9
+ // `null` clears `enableContextMenu`, so the handler decides: the browser menu
10
+ // stays unless the gesture listens to the right mouse button.
11
+ export const DEFAULT_ENABLE_CONTEXT_MENU = null;
@@ -60,7 +60,7 @@ export default abstract class GestureHandler implements IGestureHandler {
60
60
  private needsPointerData: boolean = false;
61
61
  private _tracker: PointerTracker = new PointerTracker();
62
62
 
63
- private _enableContextMenu: boolean = false;
63
+ private _enableContextMenu?: boolean | undefined = undefined;
64
64
  private _activeCursor?: ActiveCursor | undefined = undefined;
65
65
  private _touchAction?: TouchAction | undefined = undefined;
66
66
  private _userSelect?: UserSelect | undefined = undefined;
@@ -340,7 +340,10 @@ export default abstract class GestureHandler implements IGestureHandler {
340
340
  //
341
341
 
342
342
  protected onPointerDown(event: AdaptedEvent): void {
343
- GestureHandlerOrchestrator.instance.recordHandlerIfNotPresent(this);
343
+ GestureHandlerOrchestrator.instance.recordHandlerIfNotPresent(
344
+ this,
345
+ event.pointerId
346
+ );
344
347
  this._pointerType = event.pointerType;
345
348
 
346
349
  if (this.pointerType === PointerType.TOUCH) {
@@ -819,6 +822,9 @@ export default abstract class GestureHandler implements IGestureHandler {
819
822
 
820
823
  if (config.mouseButton !== undefined) {
821
824
  this.mouseButton = config.mouseButton;
825
+ // Without `enableContextMenu`, the button decides whether the context
826
+ // menu is blocked, so the listener has to follow it.
827
+ this.needsDOMUpdate = true;
822
828
  }
823
829
 
824
830
  if (config.needsPointerData !== undefined) {
@@ -833,8 +839,9 @@ export default abstract class GestureHandler implements IGestureHandler {
833
839
  this._activeCursor = config.activeCursor;
834
840
  }
835
841
 
842
+ // An explicit `null` clears the value, so the handler's default applies again.
836
843
  if (config.enableContextMenu !== undefined) {
837
- this.enableContextMenu = config.enableContextMenu;
844
+ this.enableContextMenu = config.enableContextMenu ?? undefined;
838
845
  this.needsDOMUpdate = true;
839
846
  }
840
847
 
@@ -964,7 +971,7 @@ export default abstract class GestureHandler implements IGestureHandler {
964
971
  // defaults) through partial updates only. Legacy handlers carry them in the
965
972
  // full config and still get the reset.
966
973
  if (!this.usesNativeOrVirtualDetector()) {
967
- this.enableContextMenu = false;
974
+ this.enableContextMenu = undefined;
968
975
  this._touchAction = undefined;
969
976
  this._userSelect = undefined;
970
977
  }
@@ -1068,10 +1075,16 @@ export default abstract class GestureHandler implements IGestureHandler {
1068
1075
  this._shouldResetProgress = value;
1069
1076
  }
1070
1077
 
1071
- public get enableContextMenu() {
1072
- return this._enableContextMenu;
1078
+ // `undefined` keeps the browser's context menu, unless the gesture listens to
1079
+ // the right mouse button (see `GestureHandlerWebDelegate`).
1080
+ protected get defaultEnableContextMenu(): boolean | undefined {
1081
+ return undefined;
1082
+ }
1083
+
1084
+ public get enableContextMenu(): boolean | undefined {
1085
+ return this._enableContextMenu ?? this.defaultEnableContextMenu;
1073
1086
  }
1074
- protected set enableContextMenu(value) {
1087
+ protected set enableContextMenu(value: boolean | undefined) {
1075
1088
  this._enableContextMenu = value;
1076
1089
  }
1077
1090
 
@@ -32,7 +32,7 @@ export default interface IGestureHandler {
32
32
  shouldResetProgress: boolean;
33
33
  readonly enabled: boolean | null;
34
34
  readonly pointerType: PointerType;
35
- enableContextMenu: boolean;
35
+ readonly enableContextMenu: boolean | undefined;
36
36
  readonly activeCursor?: ActiveCursor | undefined;
37
37
  readonly touchAction?: TouchAction | undefined;
38
38
  readonly userSelect?: UserSelect | undefined;