react-native-gesture-handler 3.0.0-beta.3 → 3.0.0-beta.5

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 (419) hide show
  1. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +42 -38
  2. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +34 -8
  3. package/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt +3 -6
  4. package/android/src/main/java/com/swmansion/gesturehandler/core/ManualGestureHandler.kt +2 -0
  5. package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +68 -7
  6. package/android/src/main/java/com/swmansion/gesturehandler/core/OnJSResponderCancelListener.kt +6 -0
  7. package/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt +2 -0
  8. package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +16 -6
  9. package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt +17 -4
  10. package/android/src/main/java/com/swmansion/gesturehandler/core/ViewConfigurationHelper.kt +0 -1
  11. package/android/src/main/java/com/swmansion/gesturehandler/react/Extensions.kt +21 -0
  12. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +160 -55
  13. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerDetectorView.kt +75 -98
  14. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +1 -1
  15. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +7 -10
  16. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +64 -2
  17. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +18 -8
  18. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +15 -4
  19. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +0 -6
  20. package/apple/Handlers/RNForceTouchHandler.m +1 -1
  21. package/apple/Handlers/RNHoverHandler.m +11 -11
  22. package/apple/Handlers/RNLongPressHandler.m +2 -2
  23. package/apple/Handlers/RNManualHandler.m +5 -0
  24. package/apple/Handlers/RNNativeViewHandler.mm +114 -53
  25. package/apple/Handlers/RNPanHandler.m +7 -3
  26. package/apple/Handlers/RNPinchHandler.m +9 -3
  27. package/apple/Handlers/RNRotationHandler.m +7 -2
  28. package/apple/Handlers/RNTapHandler.m +1 -1
  29. package/apple/RNGestureHandler.h +18 -0
  30. package/apple/RNGestureHandler.mm +82 -33
  31. package/apple/RNGestureHandlerButton.h +12 -2
  32. package/apple/RNGestureHandlerButton.mm +208 -38
  33. package/apple/RNGestureHandlerButtonComponentView.mm +102 -6
  34. package/apple/RNGestureHandlerDetector.mm +99 -75
  35. package/apple/RNGestureHandlerModule.mm +11 -14
  36. package/apple/RNGestureHandlerRegistry.h +14 -1
  37. package/apple/RNGestureHandlerRegistry.m +56 -0
  38. package/apple/RNRootViewGestureRecognizer.m +4 -15
  39. package/lib/module/RNGestureHandlerModule.web.js +5 -1
  40. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  41. package/lib/module/components/GestureButtons.js +23 -12
  42. package/lib/module/components/GestureButtons.js.map +1 -1
  43. package/lib/module/components/GestureHandlerButton.js.map +1 -1
  44. package/lib/module/components/GestureHandlerButton.web.js +113 -31
  45. package/lib/module/components/GestureHandlerButton.web.js.map +1 -1
  46. package/lib/module/components/Pressable/Pressable.js +2 -1
  47. package/lib/module/components/Pressable/Pressable.js.map +1 -1
  48. package/lib/module/components/Pressable/stateDefinitions.js +2 -0
  49. package/lib/module/components/Pressable/stateDefinitions.js.map +1 -1
  50. package/lib/module/components/ReanimatedDrawerLayout.js.map +1 -1
  51. package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js +38 -5
  52. package/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js.map +1 -1
  53. package/lib/module/components/touchables/GenericTouchable.js +2 -6
  54. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  55. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +1 -2
  56. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  57. package/lib/module/handlers/gestures/GestureDetector/utils.js +11 -48
  58. package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
  59. package/lib/module/handlers/gestures/flingGesture.js +8 -0
  60. package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
  61. package/lib/module/handlers/gestures/forceTouchGesture.js +3 -3
  62. package/lib/module/handlers/gestures/gesture.js +8 -0
  63. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  64. package/lib/module/handlers/gestures/gestureComposition.js +28 -0
  65. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
  66. package/lib/module/handlers/gestures/gestureObjects.js +27 -1
  67. package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
  68. package/lib/module/handlers/gestures/gestureStateManager.js +9 -0
  69. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
  70. package/lib/module/handlers/gestures/hoverGesture.js +8 -0
  71. package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
  72. package/lib/module/handlers/gestures/longPressGesture.js +8 -0
  73. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
  74. package/lib/module/handlers/gestures/manualGesture.js +8 -0
  75. package/lib/module/handlers/gestures/manualGesture.js.map +1 -1
  76. package/lib/module/handlers/gestures/nativeGesture.js +8 -0
  77. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
  78. package/lib/module/handlers/gestures/panGesture.js +13 -0
  79. package/lib/module/handlers/gestures/panGesture.js.map +1 -1
  80. package/lib/module/handlers/gestures/pinchGesture.js +13 -0
  81. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
  82. package/lib/module/handlers/gestures/reanimatedWrapper.js +14 -2
  83. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
  84. package/lib/module/handlers/gestures/rotationGesture.js +8 -0
  85. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
  86. package/lib/module/handlers/gestures/tapGesture.js +8 -0
  87. package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
  88. package/lib/module/mocks/module.js +3 -2
  89. package/lib/module/mocks/module.js.map +1 -1
  90. package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
  91. package/lib/module/specs/RNGestureHandlerButtonNativeComponent.ts +28 -13
  92. package/lib/module/v3/NativeProxy.js +5 -3
  93. package/lib/module/v3/NativeProxy.js.map +1 -1
  94. package/lib/module/v3/NativeProxy.web.js +2 -2
  95. package/lib/module/v3/NativeProxy.web.js.map +1 -1
  96. package/lib/module/v3/components/GestureButtons.js +11 -6
  97. package/lib/module/v3/components/GestureButtons.js.map +1 -1
  98. package/lib/module/v3/components/Pressable.js +3 -2
  99. package/lib/module/v3/components/Pressable.js.map +1 -1
  100. package/lib/module/v3/components/Touchable/Touchable.js +119 -32
  101. package/lib/module/v3/components/Touchable/Touchable.js.map +1 -1
  102. package/lib/module/v3/detectors/HostGestureDetector.web.js +180 -59
  103. package/lib/module/v3/detectors/HostGestureDetector.web.js.map +1 -1
  104. package/lib/module/v3/detectors/NativeDetector.js +3 -2
  105. package/lib/module/v3/detectors/NativeDetector.js.map +1 -1
  106. package/lib/module/v3/detectors/VirtualDetector/InterceptingGestureDetector.js +3 -4
  107. package/lib/module/v3/detectors/VirtualDetector/InterceptingGestureDetector.js.map +1 -1
  108. package/lib/module/v3/detectors/VirtualDetector/VirtualDetector.js +4 -2
  109. package/lib/module/v3/detectors/VirtualDetector/VirtualDetector.js.map +1 -1
  110. package/lib/module/v3/detectors/useGestureRelationsUpdater.js +23 -0
  111. package/lib/module/v3/detectors/useGestureRelationsUpdater.js.map +1 -0
  112. package/lib/module/v3/detectors/useNativeGestureRole.js +6 -0
  113. package/lib/module/v3/detectors/useNativeGestureRole.js.map +1 -0
  114. package/lib/module/v3/detectors/useNativeGestureRole.web.js +27 -0
  115. package/lib/module/v3/detectors/useNativeGestureRole.web.js.map +1 -0
  116. package/lib/module/v3/detectors/utils.js +10 -8
  117. package/lib/module/v3/detectors/utils.js.map +1 -1
  118. package/lib/module/v3/hooks/callbacks/useReanimatedEventHandler.js +17 -2
  119. package/lib/module/v3/hooks/callbacks/useReanimatedEventHandler.js.map +1 -1
  120. package/lib/module/v3/hooks/gestures/fling/useFlingGesture.js +2 -1
  121. package/lib/module/v3/hooks/gestures/fling/useFlingGesture.js.map +1 -1
  122. package/lib/module/v3/hooks/gestures/hover/useHoverGesture.js +2 -1
  123. package/lib/module/v3/hooks/gestures/hover/useHoverGesture.js.map +1 -1
  124. package/lib/module/v3/hooks/gestures/longPress/useLongPressGesture.js +2 -1
  125. package/lib/module/v3/hooks/gestures/longPress/useLongPressGesture.js.map +1 -1
  126. package/lib/module/v3/hooks/gestures/manual/useManualGesture.js +2 -1
  127. package/lib/module/v3/hooks/gestures/manual/useManualGesture.js.map +1 -1
  128. package/lib/module/v3/hooks/gestures/native/NativeTypes.js +1 -1
  129. package/lib/module/v3/hooks/gestures/native/NativeTypes.js.map +1 -1
  130. package/lib/module/v3/hooks/gestures/native/useNativeGesture.js +2 -1
  131. package/lib/module/v3/hooks/gestures/native/useNativeGesture.js.map +1 -1
  132. package/lib/module/v3/hooks/gestures/pan/usePanGesture.js +2 -1
  133. package/lib/module/v3/hooks/gestures/pan/usePanGesture.js.map +1 -1
  134. package/lib/module/v3/hooks/gestures/pinch/usePinchGesture.js +2 -1
  135. package/lib/module/v3/hooks/gestures/pinch/usePinchGesture.js.map +1 -1
  136. package/lib/module/v3/hooks/gestures/rotation/useRotationGesture.js +2 -1
  137. package/lib/module/v3/hooks/gestures/rotation/useRotationGesture.js.map +1 -1
  138. package/lib/module/v3/hooks/gestures/tap/useTapGesture.js +2 -1
  139. package/lib/module/v3/hooks/gestures/tap/useTapGesture.js.map +1 -1
  140. package/lib/module/v3/hooks/useGesture.js +4 -22
  141. package/lib/module/v3/hooks/useGesture.js.map +1 -1
  142. package/lib/module/v3/hooks/utils/configUtils.js +8 -6
  143. package/lib/module/v3/hooks/utils/configUtils.js.map +1 -1
  144. package/lib/module/v3/hooks/utils/eventHandlersUtils.js +31 -29
  145. package/lib/module/v3/hooks/utils/eventHandlersUtils.js.map +1 -1
  146. package/lib/module/v3/hooks/utils/index.js +1 -1
  147. package/lib/module/v3/hooks/utils/index.js.map +1 -1
  148. package/lib/module/v3/hooks/utils/propsWhiteList.js +1 -1
  149. package/lib/module/v3/hooks/utils/propsWhiteList.js.map +1 -1
  150. package/lib/module/v3/hooks/utils/reanimatedUtils.js +8 -2
  151. package/lib/module/v3/hooks/utils/reanimatedUtils.js.map +1 -1
  152. package/lib/module/web/constants.js +1 -0
  153. package/lib/module/web/constants.js.map +1 -1
  154. package/lib/module/web/detectors/RotationGestureDetector.js +18 -5
  155. package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
  156. package/lib/module/web/detectors/ScaleGestureDetector.js +9 -1
  157. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  158. package/lib/module/web/handlers/GestureHandler.js +25 -5
  159. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  160. package/lib/module/web/handlers/HoverGestureHandler.js +1 -4
  161. package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
  162. package/lib/module/web/handlers/ManualGestureHandler.js +1 -0
  163. package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
  164. package/lib/module/web/handlers/NativeViewGestureHandler.js +65 -17
  165. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  166. package/lib/module/web/handlers/PanGestureHandler.js +1 -0
  167. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  168. package/lib/module/web/handlers/PinchGestureHandler.js +4 -6
  169. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
  170. package/lib/module/web/handlers/RotationGestureHandler.js +4 -3
  171. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
  172. package/lib/module/web/interfaces.js +6 -0
  173. package/lib/module/web/interfaces.js.map +1 -1
  174. package/lib/module/web/tools/GestureHandlerOrchestrator.js +8 -2
  175. package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  176. package/lib/module/web/tools/GestureLifecycleEvents.js +10 -0
  177. package/lib/module/web/tools/GestureLifecycleEvents.js.map +1 -0
  178. package/lib/module/web/tools/NodeManager.js +44 -0
  179. package/lib/module/web/tools/NodeManager.js.map +1 -1
  180. package/lib/module/web/tools/PointerEventManager.js +9 -0
  181. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  182. package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -1
  183. package/lib/typescript/RNGestureHandlerModule.web.d.ts.map +1 -1
  184. package/lib/typescript/components/GestureButtons.d.ts +14 -6
  185. package/lib/typescript/components/GestureButtons.d.ts.map +1 -1
  186. package/lib/typescript/components/GestureHandlerButton.d.ts +62 -8
  187. package/lib/typescript/components/GestureHandlerButton.d.ts.map +1 -1
  188. package/lib/typescript/components/GestureHandlerButton.web.d.ts +14 -3
  189. package/lib/typescript/components/GestureHandlerButton.web.d.ts.map +1 -1
  190. package/lib/typescript/components/Pressable/Pressable.d.ts.map +1 -1
  191. package/lib/typescript/components/Pressable/PressableProps.d.ts +1 -1
  192. package/lib/typescript/components/Pressable/PressableProps.d.ts.map +1 -1
  193. package/lib/typescript/components/Pressable/stateDefinitions.d.ts.map +1 -1
  194. package/lib/typescript/components/ReanimatedDrawerLayout.d.ts +16 -14
  195. package/lib/typescript/components/ReanimatedDrawerLayout.d.ts.map +1 -1
  196. package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeable.d.ts +2 -1
  197. package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeable.d.ts.map +1 -1
  198. package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts +30 -34
  199. package/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts.map +1 -1
  200. package/lib/typescript/components/touchables/GenericTouchable.d.ts.map +1 -1
  201. package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts.map +1 -1
  202. package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +0 -1
  203. package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts.map +1 -1
  204. package/lib/typescript/handlers/gestures/flingGesture.d.ts +6 -0
  205. package/lib/typescript/handlers/gestures/flingGesture.d.ts.map +1 -1
  206. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +3 -3
  207. package/lib/typescript/handlers/gestures/gesture.d.ts +6 -0
  208. package/lib/typescript/handlers/gestures/gesture.d.ts.map +1 -1
  209. package/lib/typescript/handlers/gestures/gestureComposition.d.ts +21 -0
  210. package/lib/typescript/handlers/gestures/gestureComposition.d.ts.map +1 -1
  211. package/lib/typescript/handlers/gestures/gestureObjects.d.ts +27 -1
  212. package/lib/typescript/handlers/gestures/gestureObjects.d.ts.map +1 -1
  213. package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +6 -0
  214. package/lib/typescript/handlers/gestures/gestureStateManager.d.ts.map +1 -1
  215. package/lib/typescript/handlers/gestures/hoverGesture.d.ts +6 -0
  216. package/lib/typescript/handlers/gestures/hoverGesture.d.ts.map +1 -1
  217. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +6 -0
  218. package/lib/typescript/handlers/gestures/longPressGesture.d.ts.map +1 -1
  219. package/lib/typescript/handlers/gestures/manualGesture.d.ts +6 -0
  220. package/lib/typescript/handlers/gestures/manualGesture.d.ts.map +1 -1
  221. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +6 -0
  222. package/lib/typescript/handlers/gestures/nativeGesture.d.ts.map +1 -1
  223. package/lib/typescript/handlers/gestures/panGesture.d.ts +9 -0
  224. package/lib/typescript/handlers/gestures/panGesture.d.ts.map +1 -1
  225. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +9 -0
  226. package/lib/typescript/handlers/gestures/pinchGesture.d.ts.map +1 -1
  227. package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts.map +1 -1
  228. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +6 -0
  229. package/lib/typescript/handlers/gestures/rotationGesture.d.ts.map +1 -1
  230. package/lib/typescript/handlers/gestures/tapGesture.d.ts +6 -0
  231. package/lib/typescript/handlers/gestures/tapGesture.d.ts.map +1 -1
  232. package/lib/typescript/mocks/module.d.ts +1 -1
  233. package/lib/typescript/mocks/module.d.ts.map +1 -1
  234. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +2 -2
  235. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts.map +1 -1
  236. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +19 -11
  237. package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts.map +1 -1
  238. package/lib/typescript/v3/NativeProxy.d.ts +1 -1
  239. package/lib/typescript/v3/NativeProxy.d.ts.map +1 -1
  240. package/lib/typescript/v3/NativeProxy.web.d.ts +1 -1
  241. package/lib/typescript/v3/NativeProxy.web.d.ts.map +1 -1
  242. package/lib/typescript/v3/components/GestureButtons.d.ts +1 -37
  243. package/lib/typescript/v3/components/GestureButtons.d.ts.map +1 -1
  244. package/lib/typescript/v3/components/GestureButtonsProps.d.ts +1 -1
  245. package/lib/typescript/v3/components/GestureButtonsProps.d.ts.map +1 -1
  246. package/lib/typescript/v3/components/GestureComponents.d.ts +3 -0
  247. package/lib/typescript/v3/components/GestureComponents.d.ts.map +1 -1
  248. package/lib/typescript/v3/components/GestureComponents.web.d.ts +4 -0
  249. package/lib/typescript/v3/components/GestureComponents.web.d.ts.map +1 -1
  250. package/lib/typescript/v3/components/Pressable.d.ts.map +1 -1
  251. package/lib/typescript/v3/components/Touchable/Touchable.d.ts.map +1 -1
  252. package/lib/typescript/v3/components/Touchable/TouchableProps.d.ts +48 -1
  253. package/lib/typescript/v3/components/Touchable/TouchableProps.d.ts.map +1 -1
  254. package/lib/typescript/v3/detectors/HostGestureDetector.web.d.ts +1 -1
  255. package/lib/typescript/v3/detectors/HostGestureDetector.web.d.ts.map +1 -1
  256. package/lib/typescript/v3/detectors/NativeDetector.d.ts.map +1 -1
  257. package/lib/typescript/v3/detectors/VirtualDetector/InterceptingGestureDetector.d.ts.map +1 -1
  258. package/lib/typescript/v3/detectors/VirtualDetector/VirtualDetector.d.ts.map +1 -1
  259. package/lib/typescript/v3/detectors/useGestureRelationsUpdater.d.ts +3 -0
  260. package/lib/typescript/v3/detectors/useGestureRelationsUpdater.d.ts.map +1 -0
  261. package/lib/typescript/v3/detectors/useNativeGestureRole.d.ts +3 -0
  262. package/lib/typescript/v3/detectors/useNativeGestureRole.d.ts.map +1 -0
  263. package/lib/typescript/v3/detectors/useNativeGestureRole.web.d.ts +3 -0
  264. package/lib/typescript/v3/detectors/useNativeGestureRole.web.d.ts.map +1 -0
  265. package/lib/typescript/v3/detectors/utils.d.ts +3 -3
  266. package/lib/typescript/v3/detectors/utils.d.ts.map +1 -1
  267. package/lib/typescript/v3/hooks/callbacks/useReanimatedEventHandler.d.ts.map +1 -1
  268. package/lib/typescript/v3/hooks/gestures/fling/useFlingGesture.d.ts +1 -1
  269. package/lib/typescript/v3/hooks/gestures/fling/useFlingGesture.d.ts.map +1 -1
  270. package/lib/typescript/v3/hooks/gestures/hover/useHoverGesture.d.ts +1 -1
  271. package/lib/typescript/v3/hooks/gestures/hover/useHoverGesture.d.ts.map +1 -1
  272. package/lib/typescript/v3/hooks/gestures/longPress/useLongPressGesture.d.ts +1 -1
  273. package/lib/typescript/v3/hooks/gestures/longPress/useLongPressGesture.d.ts.map +1 -1
  274. package/lib/typescript/v3/hooks/gestures/manual/useManualGesture.d.ts +1 -1
  275. package/lib/typescript/v3/hooks/gestures/manual/useManualGesture.d.ts.map +1 -1
  276. package/lib/typescript/v3/hooks/gestures/native/NativeTypes.d.ts +7 -0
  277. package/lib/typescript/v3/hooks/gestures/native/NativeTypes.d.ts.map +1 -1
  278. package/lib/typescript/v3/hooks/gestures/native/useNativeGesture.d.ts +1 -1
  279. package/lib/typescript/v3/hooks/gestures/native/useNativeGesture.d.ts.map +1 -1
  280. package/lib/typescript/v3/hooks/gestures/pan/usePanGesture.d.ts +1 -1
  281. package/lib/typescript/v3/hooks/gestures/pan/usePanGesture.d.ts.map +1 -1
  282. package/lib/typescript/v3/hooks/gestures/pinch/usePinchGesture.d.ts +1 -1
  283. package/lib/typescript/v3/hooks/gestures/pinch/usePinchGesture.d.ts.map +1 -1
  284. package/lib/typescript/v3/hooks/gestures/rotation/useRotationGesture.d.ts +1 -1
  285. package/lib/typescript/v3/hooks/gestures/rotation/useRotationGesture.d.ts.map +1 -1
  286. package/lib/typescript/v3/hooks/gestures/tap/useTapGesture.d.ts +1 -1
  287. package/lib/typescript/v3/hooks/gestures/tap/useTapGesture.d.ts.map +1 -1
  288. package/lib/typescript/v3/hooks/useGesture.d.ts.map +1 -1
  289. package/lib/typescript/v3/hooks/utils/configUtils.d.ts +2 -2
  290. package/lib/typescript/v3/hooks/utils/configUtils.d.ts.map +1 -1
  291. package/lib/typescript/v3/hooks/utils/eventHandlersUtils.d.ts.map +1 -1
  292. package/lib/typescript/v3/hooks/utils/index.d.ts +1 -1
  293. package/lib/typescript/v3/hooks/utils/index.d.ts.map +1 -1
  294. package/lib/typescript/v3/hooks/utils/propsWhiteList.d.ts +2 -2
  295. package/lib/typescript/v3/hooks/utils/propsWhiteList.d.ts.map +1 -1
  296. package/lib/typescript/v3/hooks/utils/reanimatedUtils.d.ts +1 -0
  297. package/lib/typescript/v3/hooks/utils/reanimatedUtils.d.ts.map +1 -1
  298. package/lib/typescript/v3/types/ConfigTypes.d.ts +1 -0
  299. package/lib/typescript/v3/types/ConfigTypes.d.ts.map +1 -1
  300. package/lib/typescript/web/constants.d.ts +1 -0
  301. package/lib/typescript/web/constants.d.ts.map +1 -1
  302. package/lib/typescript/web/detectors/RotationGestureDetector.d.ts.map +1 -1
  303. package/lib/typescript/web/detectors/ScaleGestureDetector.d.ts.map +1 -1
  304. package/lib/typescript/web/handlers/GestureHandler.d.ts +8 -2
  305. package/lib/typescript/web/handlers/GestureHandler.d.ts.map +1 -1
  306. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -1
  307. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts.map +1 -1
  308. package/lib/typescript/web/handlers/IGestureHandler.d.ts +2 -0
  309. package/lib/typescript/web/handlers/IGestureHandler.d.ts.map +1 -1
  310. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -0
  311. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts.map +1 -1
  312. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +13 -3
  313. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts.map +1 -1
  314. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +1 -0
  315. package/lib/typescript/web/handlers/PanGestureHandler.d.ts.map +1 -1
  316. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -0
  317. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts.map +1 -1
  318. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -0
  319. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts.map +1 -1
  320. package/lib/typescript/web/interfaces.d.ts +6 -0
  321. package/lib/typescript/web/interfaces.d.ts.map +1 -1
  322. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +1 -0
  323. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts.map +1 -1
  324. package/lib/typescript/web/tools/GestureLifecycleEvents.d.ts +7 -0
  325. package/lib/typescript/web/tools/GestureLifecycleEvents.d.ts.map +1 -0
  326. package/lib/typescript/web/tools/NodeManager.d.ts +7 -0
  327. package/lib/typescript/web/tools/NodeManager.d.ts.map +1 -1
  328. package/lib/typescript/web/tools/PointerEventManager.d.ts.map +1 -1
  329. package/package.json +3 -3
  330. package/src/RNGestureHandlerModule.web.ts +5 -1
  331. package/src/components/GestureButtons.tsx +33 -16
  332. package/src/components/GestureHandlerButton.tsx +70 -8
  333. package/src/components/GestureHandlerButton.web.tsx +184 -48
  334. package/src/components/Pressable/Pressable.tsx +3 -1
  335. package/src/components/Pressable/PressableProps.tsx +2 -1
  336. package/src/components/Pressable/stateDefinitions.ts +3 -0
  337. package/src/components/ReanimatedDrawerLayout.tsx +27 -23
  338. package/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx +51 -5
  339. package/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts +31 -39
  340. package/src/components/touchables/GenericTouchable.tsx +2 -5
  341. package/src/handlers/gestures/GestureDetector/useDetectorUpdater.ts +1 -2
  342. package/src/handlers/gestures/GestureDetector/utils.ts +11 -53
  343. package/src/handlers/gestures/flingGesture.ts +6 -0
  344. package/src/handlers/gestures/forceTouchGesture.ts +3 -3
  345. package/src/handlers/gestures/gesture.ts +6 -0
  346. package/src/handlers/gestures/gestureComposition.ts +21 -0
  347. package/src/handlers/gestures/gestureObjects.ts +27 -1
  348. package/src/handlers/gestures/gestureStateManager.ts +6 -0
  349. package/src/handlers/gestures/hoverGesture.ts +6 -0
  350. package/src/handlers/gestures/longPressGesture.ts +6 -0
  351. package/src/handlers/gestures/manualGesture.ts +6 -0
  352. package/src/handlers/gestures/nativeGesture.ts +6 -0
  353. package/src/handlers/gestures/panGesture.ts +9 -0
  354. package/src/handlers/gestures/pinchGesture.ts +9 -0
  355. package/src/handlers/gestures/reanimatedWrapper.ts +20 -2
  356. package/src/handlers/gestures/rotationGesture.ts +6 -0
  357. package/src/handlers/gestures/tapGesture.ts +6 -0
  358. package/src/mocks/module.tsx +4 -2
  359. package/src/specs/NativeRNGestureHandlerModule.ts +2 -4
  360. package/src/specs/RNGestureHandlerButtonNativeComponent.ts +28 -13
  361. package/src/v3/NativeProxy.ts +9 -7
  362. package/src/v3/NativeProxy.web.ts +2 -2
  363. package/src/v3/components/GestureButtons.tsx +18 -10
  364. package/src/v3/components/GestureButtonsProps.ts +1 -0
  365. package/src/v3/components/Pressable.tsx +2 -1
  366. package/src/v3/components/Touchable/Touchable.tsx +144 -50
  367. package/src/v3/components/Touchable/TouchableProps.ts +64 -2
  368. package/src/v3/detectors/HostGestureDetector.web.tsx +268 -108
  369. package/src/v3/detectors/NativeDetector.tsx +3 -2
  370. package/src/v3/detectors/VirtualDetector/InterceptingGestureDetector.tsx +3 -4
  371. package/src/v3/detectors/VirtualDetector/VirtualDetector.tsx +5 -2
  372. package/src/v3/detectors/useGestureRelationsUpdater.ts +30 -0
  373. package/src/v3/detectors/useNativeGestureRole.ts +8 -0
  374. package/src/v3/detectors/useNativeGestureRole.web.ts +42 -0
  375. package/src/v3/detectors/utils.ts +28 -12
  376. package/src/v3/hooks/callbacks/useReanimatedEventHandler.ts +23 -7
  377. package/src/v3/hooks/gestures/fling/useFlingGesture.ts +5 -1
  378. package/src/v3/hooks/gestures/hover/useHoverGesture.ts +5 -1
  379. package/src/v3/hooks/gestures/longPress/useLongPressGesture.ts +3 -1
  380. package/src/v3/hooks/gestures/manual/useManualGesture.ts +5 -1
  381. package/src/v3/hooks/gestures/native/NativeTypes.ts +13 -1
  382. package/src/v3/hooks/gestures/native/useNativeGesture.ts +5 -1
  383. package/src/v3/hooks/gestures/pan/usePanGesture.ts +5 -1
  384. package/src/v3/hooks/gestures/pinch/usePinchGesture.ts +5 -1
  385. package/src/v3/hooks/gestures/rotation/useRotationGesture.ts +3 -1
  386. package/src/v3/hooks/gestures/tap/useTapGesture.ts +5 -1
  387. package/src/v3/hooks/useGesture.ts +4 -18
  388. package/src/v3/hooks/utils/configUtils.ts +18 -8
  389. package/src/v3/hooks/utils/eventHandlersUtils.ts +43 -32
  390. package/src/v3/hooks/utils/index.ts +0 -1
  391. package/src/v3/hooks/utils/propsWhiteList.ts +1 -0
  392. package/src/v3/hooks/utils/reanimatedUtils.ts +10 -10
  393. package/src/v3/types/ConfigTypes.ts +1 -0
  394. package/src/web/constants.ts +1 -0
  395. package/src/web/detectors/RotationGestureDetector.ts +19 -5
  396. package/src/web/detectors/ScaleGestureDetector.ts +9 -3
  397. package/src/web/handlers/GestureHandler.ts +36 -6
  398. package/src/web/handlers/HoverGestureHandler.ts +2 -5
  399. package/src/web/handlers/IGestureHandler.ts +2 -0
  400. package/src/web/handlers/ManualGestureHandler.ts +2 -0
  401. package/src/web/handlers/NativeViewGestureHandler.ts +122 -19
  402. package/src/web/handlers/PanGestureHandler.ts +2 -0
  403. package/src/web/handlers/PinchGestureHandler.ts +5 -7
  404. package/src/web/handlers/RotationGestureHandler.ts +5 -5
  405. package/src/web/interfaces.ts +7 -0
  406. package/src/web/tools/GestureHandlerOrchestrator.ts +11 -3
  407. package/src/web/tools/GestureLifecycleEvents.ts +14 -0
  408. package/src/web/tools/NodeManager.ts +57 -0
  409. package/src/web/tools/PointerEventManager.ts +12 -0
  410. package/lib/module/RNRenderer.js +0 -6
  411. package/lib/module/RNRenderer.js.map +0 -1
  412. package/lib/module/RNRenderer.web.js +0 -6
  413. package/lib/module/RNRenderer.web.js.map +0 -1
  414. package/lib/typescript/RNRenderer.d.ts +0 -2
  415. package/lib/typescript/RNRenderer.d.ts.map +0 -1
  416. package/lib/typescript/RNRenderer.web.d.ts +0 -4
  417. package/lib/typescript/RNRenderer.web.d.ts.map +0 -1
  418. package/src/RNRenderer.ts +0 -3
  419. package/src/RNRenderer.web.ts +0 -3
@@ -113,6 +113,8 @@
113
113
  @implementation RNNativeViewGestureHandler {
114
114
  BOOL _shouldActivateOnStart;
115
115
  BOOL _disallowInterruption;
116
+ BOOL _yieldsToContinuousGestures;
117
+ RNGestureHandlerEventExtraData *_lastActiveExtraData;
116
118
  }
117
119
 
118
120
  - (instancetype)initWithTag:(NSNumber *)tag
@@ -128,6 +130,7 @@
128
130
  [super updateConfig:config];
129
131
  _shouldActivateOnStart = [RCTConvert BOOL:config[@"shouldActivateOnStart"]];
130
132
  _disallowInterruption = [RCTConvert BOOL:config[@"disallowInterruption"]];
133
+ _yieldsToContinuousGestures = [RCTConvert BOOL:config[@"yieldsToContinuousGestures"]];
131
134
  }
132
135
 
133
136
  #if !TARGET_OS_OSX
@@ -138,22 +141,33 @@
138
141
  // for properties like `disallowInterruption` to work.
139
142
  if ([view isKindOfClass:[UIControl class]]) {
140
143
  UIControl *control = (UIControl *)view;
141
- [control addTarget:self action:@selector(handleTouchDown:forEvent:) forControlEvents:UIControlEventTouchDown];
142
- [control addTarget:self
143
- action:@selector(handleTouchUpOutside:forEvent:)
144
- forControlEvents:UIControlEventTouchUpOutside];
145
- [control addTarget:self
146
- action:@selector(handleTouchUpInside:forEvent:)
147
- forControlEvents:UIControlEventTouchUpInside];
148
- [control addTarget:self action:@selector(handleDragExit:forEvent:) forControlEvents:UIControlEventTouchDragExit];
149
- [control addTarget:self
150
- action:@selector(handleDragInside:forEvent:)
151
- forControlEvents:UIControlEventTouchDragInside];
152
- [control addTarget:self
153
- action:@selector(handleDragOutside:forEvent:)
154
- forControlEvents:UIControlEventTouchDragOutside];
155
- [control addTarget:self action:@selector(handleDragEnter:forEvent:) forControlEvents:UIControlEventTouchDragEnter];
156
- [control addTarget:self action:@selector(handleTouchCancel:forEvent:) forControlEvents:UIControlEventTouchCancel];
144
+
145
+ // Pressing UISwitch triggers only touchUp and valueChanged callbacks. In order to align its behavior
146
+ // with other UIControls, we have to dispatch full Gesture Handler events flow in one callback, as
147
+ // touchesDown is not executed.
148
+ if ([view isKindOfClass:[UISwitch class]]) {
149
+ _pointerType = RNGestureHandlerTouch;
150
+ [control addTarget:self action:@selector(handleSwitch:) forControlEvents:UIControlEventValueChanged];
151
+ } else {
152
+ [control addTarget:self action:@selector(handleTouchDown:forEvent:) forControlEvents:UIControlEventTouchDown];
153
+ [control addTarget:self
154
+ action:@selector(handleTouchUpOutside:forEvent:)
155
+ forControlEvents:UIControlEventTouchUpOutside];
156
+ [control addTarget:self
157
+ action:@selector(handleTouchUpInside:forEvent:)
158
+ forControlEvents:UIControlEventTouchUpInside];
159
+ [control addTarget:self action:@selector(handleDragExit:forEvent:) forControlEvents:UIControlEventTouchDragExit];
160
+ [control addTarget:self
161
+ action:@selector(handleDragInside:forEvent:)
162
+ forControlEvents:UIControlEventTouchDragInside];
163
+ [control addTarget:self
164
+ action:@selector(handleDragOutside:forEvent:)
165
+ forControlEvents:UIControlEventTouchDragOutside];
166
+ [control addTarget:self
167
+ action:@selector(handleDragEnter:forEvent:)
168
+ forControlEvents:UIControlEventTouchDragEnter];
169
+ [control addTarget:self action:@selector(handleTouchCancel:forEvent:) forControlEvents:UIControlEventTouchCancel];
170
+ }
157
171
  } else {
158
172
  [super bindToView:view];
159
173
  }
@@ -180,6 +194,46 @@
180
194
  [super unbindFromView];
181
195
  }
182
196
 
197
+ - (BOOL)shouldSuppressActiveEvent:(RNGestureHandlerEventExtraData *)extraData
198
+ {
199
+ if (_lastActiveExtraData != nil && [_lastActiveExtraData.data isEqualToDictionary:extraData.data]) {
200
+ return YES;
201
+ }
202
+
203
+ _lastActiveExtraData = extraData;
204
+ return NO;
205
+ }
206
+
207
+ - (void)sendActiveStateEventIfChangedForView:(UIView *)sender extraData:(RNGestureHandlerEventExtraData *)extraData
208
+ {
209
+ if ([self shouldSuppressActiveEvent:extraData]) {
210
+ return;
211
+ }
212
+
213
+ [self sendEventsInState:RNGestureHandlerStateActive forViewWithTag:sender.reactTag withExtraData:extraData];
214
+ }
215
+
216
+ - (void)handleSwitch:(UIView *)sender
217
+ {
218
+ [self sendEventsInState:RNGestureHandlerStateBegan
219
+ forViewWithTag:sender.reactTag
220
+ withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
221
+ withNumberOfTouches:1
222
+ withPointerType:_pointerType]];
223
+ [self sendEventsInState:RNGestureHandlerStateActive
224
+ forViewWithTag:sender.reactTag
225
+ withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
226
+ withNumberOfTouches:1
227
+ withPointerType:_pointerType]];
228
+ [self sendEventsInState:RNGestureHandlerStateEnd
229
+ forViewWithTag:sender.reactTag
230
+ withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
231
+ withNumberOfTouches:1
232
+ withPointerType:_pointerType]];
233
+
234
+ [self reset];
235
+ }
236
+
183
237
  - (void)handleTouchDown:(UIView *)sender forEvent:(UIEvent *)event
184
238
  {
185
239
  [self setCurrentPointerTypeForEvent:event];
@@ -187,11 +241,18 @@
187
241
 
188
242
  if (_disallowInterruption) {
189
243
  // When `disallowInterruption` is set we cancel all gesture handlers when this UIControl
190
- // gets DOWN event
244
+ // gets DOWN event. When `yieldsToContinuousGestures` is also set we leave alone:
245
+ // - non-RNGH recognizers (e.g. UIScrollView's pan), so native containers can take over
246
+ // - continuous RNGH recognizers, so other continuous gestures wrapping the touchable can still take over
191
247
  for (RNGHUITouch *touch in [event allTouches]) {
192
- for (UIGestureRecognizer *recogn in [touch gestureRecognizers]) {
193
- recogn.enabled = NO;
194
- recogn.enabled = YES;
248
+ for (UIGestureRecognizer *recognizer in [touch gestureRecognizers]) {
249
+ if (_yieldsToContinuousGestures &&
250
+ (recognizer.gestureHandler == nil || [recognizer.gestureHandler isContinuous])) {
251
+ continue;
252
+ }
253
+
254
+ recognizer.enabled = NO;
255
+ recognizer.enabled = YES;
195
256
  }
196
257
  }
197
258
  }
@@ -201,12 +262,6 @@
201
262
  withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
202
263
  withNumberOfTouches:event.allTouches.count
203
264
  withPointerType:_pointerType]];
204
-
205
- [self sendEventsInState:RNGestureHandlerStateActive
206
- forViewWithTag:sender.reactTag
207
- withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
208
- withNumberOfTouches:event.allTouches.count
209
- withPointerType:_pointerType]];
210
265
  }
211
266
 
212
267
  - (void)handleTouchUpOutside:(UIView *)sender forEvent:(UIEvent *)event
@@ -224,11 +279,12 @@
224
279
 
225
280
  - (void)handleTouchUpInside:(UIView *)sender forEvent:(UIEvent *)event
226
281
  {
227
- [self sendEventsInState:RNGestureHandlerStateEnd
228
- forViewWithTag:sender.reactTag
229
- withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
230
- withNumberOfTouches:event.allTouches.count
231
- withPointerType:_pointerType]];
282
+ RNGestureHandlerEventExtraData *extraData = [RNGestureHandlerEventExtraData forPointerInside:YES
283
+ withNumberOfTouches:event.allTouches.count
284
+ withPointerType:_pointerType];
285
+
286
+ [self sendActiveStateEventIfChangedForView:sender extraData:extraData];
287
+ [self sendEventsInState:RNGestureHandlerStateEnd forViewWithTag:sender.reactTag withExtraData:extraData];
232
288
  }
233
289
 
234
290
  - (void)handleDragExit:(UIView *)sender forEvent:(UIEvent *)event
@@ -238,30 +294,27 @@
238
294
  UIControl *control = (UIControl *)sender;
239
295
  [control cancelTrackingWithEvent:event];
240
296
  } else {
241
- [self sendEventsInState:RNGestureHandlerStateActive
242
- forViewWithTag:sender.reactTag
243
- withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
244
- withNumberOfTouches:event.allTouches.count
245
- withPointerType:_pointerType]];
297
+ [self sendActiveStateEventIfChangedForView:sender
298
+ extraData:[RNGestureHandlerEventExtraData forPointerInside:NO
299
+ withNumberOfTouches:event.allTouches.count
300
+ withPointerType:_pointerType]];
246
301
  }
247
302
  }
248
303
 
249
304
  - (void)handleDragEnter:(UIView *)sender forEvent:(UIEvent *)event
250
305
  {
251
- [self sendEventsInState:RNGestureHandlerStateActive
252
- forViewWithTag:sender.reactTag
253
- withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
254
- withNumberOfTouches:event.allTouches.count
255
- withPointerType:_pointerType]];
306
+ [self sendActiveStateEventIfChangedForView:sender
307
+ extraData:[RNGestureHandlerEventExtraData forPointerInside:YES
308
+ withNumberOfTouches:event.allTouches.count
309
+ withPointerType:_pointerType]];
256
310
  }
257
311
 
258
312
  - (void)handleDragInside:(UIView *)sender forEvent:(UIEvent *)event
259
313
  {
260
- [self sendEventsInState:RNGestureHandlerStateActive
261
- forViewWithTag:sender.reactTag
262
- withExtraData:[RNGestureHandlerEventExtraData forPointerInside:YES
263
- withNumberOfTouches:event.allTouches.count
264
- withPointerType:_pointerType]];
314
+ [self sendActiveStateEventIfChangedForView:sender
315
+ extraData:[RNGestureHandlerEventExtraData forPointerInside:YES
316
+ withNumberOfTouches:event.allTouches.count
317
+ withPointerType:_pointerType]];
265
318
  }
266
319
 
267
320
  - (void)handleDragOutside:(UIView *)sender forEvent:(UIEvent *)event
@@ -270,11 +323,10 @@
270
323
  return;
271
324
  }
272
325
 
273
- [self sendEventsInState:RNGestureHandlerStateActive
274
- forViewWithTag:sender.reactTag
275
- withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO
276
- withNumberOfTouches:event.allTouches.count
277
- withPointerType:_pointerType]];
326
+ [self sendActiveStateEventIfChangedForView:sender
327
+ extraData:[RNGestureHandlerEventExtraData forPointerInside:NO
328
+ withNumberOfTouches:event.allTouches.count
329
+ withPointerType:_pointerType]];
278
330
  }
279
331
 
280
332
  - (void)handleTouchCancel:(UIView *)sender forEvent:(UIEvent *)event
@@ -291,7 +343,13 @@
291
343
  return YES;
292
344
  }
293
345
 
294
- #else
346
+ - (void)reset
347
+ {
348
+ [super reset];
349
+ _lastActiveExtraData = nil;
350
+ }
351
+
352
+ #endif
295
353
 
296
354
  - (RNGestureHandlerEventExtraData *)eventExtraData:(RNDummyGestureRecognizer *)recognizer
297
355
  {
@@ -300,6 +358,9 @@
300
358
  withPointerType:RNGestureHandlerMouse];
301
359
  }
302
360
 
303
- #endif
361
+ - (BOOL)isContinuous
362
+ {
363
+ return YES;
364
+ }
304
365
 
305
366
  @end
@@ -269,7 +269,6 @@
269
269
  [self triggerActionFromReset];
270
270
  [_gestureHandler.pointerTracker reset];
271
271
  [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(activateAfterLongPress) object:nil];
272
- self.enabled = YES;
273
272
  [super reset];
274
273
  [_gestureHandler reset];
275
274
 
@@ -363,6 +362,11 @@
363
362
  return self;
364
363
  }
365
364
 
365
+ - (BOOL)isContinuous
366
+ {
367
+ return YES;
368
+ }
369
+
366
370
  - (void)resetConfig
367
371
  {
368
372
  [super resetConfig];
@@ -452,7 +456,7 @@
452
456
  #if TARGET_OS_OSX
453
457
  - (RNGestureHandlerEventExtraData *)eventExtraData:(NSPanGestureRecognizer *)recognizer
454
458
  {
455
- return [RNGestureHandlerEventExtraData forPan:[recognizer locationInView:recognizer.view]
459
+ return [RNGestureHandlerEventExtraData forPan:[recognizer locationInView:self.coordinateView]
456
460
  withAbsolutePosition:[recognizer locationInView:recognizer.view.window.contentView]
457
461
  withTranslation:[recognizer translationInView:recognizer.view.window.contentView]
458
462
  withVelocity:[recognizer velocityInView:recognizer.view.window.contentView]
@@ -466,7 +470,7 @@
466
470
  RNBetterPanGestureRecognizer *panRecognizer = (RNBetterPanGestureRecognizer *)recognizer;
467
471
 
468
472
  return [RNGestureHandlerEventExtraData
469
- forPan:[recognizer locationInView:recognizer.view]
473
+ forPan:[recognizer locationInView:self.coordinateView]
470
474
  withAbsolutePosition:[recognizer locationInView:recognizer.view.window]
471
475
  withTranslation:[recognizer translationInView:recognizer.view.window]
472
476
  withVelocity:[recognizer velocityInView:recognizer.view.window]
@@ -161,13 +161,18 @@
161
161
  return self;
162
162
  }
163
163
 
164
+ - (BOOL)isContinuous
165
+ {
166
+ return YES;
167
+ }
168
+
164
169
  #if !TARGET_OS_TV
165
170
 
166
171
  #if TARGET_OS_OSX
167
172
  - (RNGestureHandlerEventExtraData *)eventExtraData:(NSMagnificationGestureRecognizer *)recognizer
168
173
  {
169
174
  return [RNGestureHandlerEventExtraData forPinch:recognizer.magnification
170
- withFocalPoint:[recognizer locationInView:recognizer.view]
175
+ withFocalPoint:[recognizer locationInView:self.coordinateView]
171
176
  withVelocity:((RNBetterPinchRecognizer *)recognizer).velocity
172
177
  withNumberOfTouches:2
173
178
  withPointerType:RNGestureHandlerMouse];
@@ -177,12 +182,13 @@
177
182
  {
178
183
  CGPoint focalPoint;
179
184
  NSUInteger numberOfTouches = recognizer.numberOfTouches;
185
+ RNGHUIView *coordinateView = self.coordinateView;
180
186
 
181
187
  if (numberOfTouches > 0) {
182
188
  CGPoint accumulatedPoint = CGPointZero;
183
189
 
184
190
  for (int i = 0; i < numberOfTouches; i++) {
185
- CGPoint location = [recognizer locationOfTouch:i inView:recognizer.view];
191
+ CGPoint location = [recognizer locationOfTouch:i inView:coordinateView];
186
192
  accumulatedPoint.x += location.x;
187
193
  accumulatedPoint.y += location.y;
188
194
  }
@@ -190,7 +196,7 @@
190
196
  focalPoint = CGPointMake(accumulatedPoint.x / numberOfTouches, accumulatedPoint.y / numberOfTouches);
191
197
  } else {
192
198
  // Trackpad pinch gestures may report 0 touches - use the recognizer's location instead
193
- focalPoint = [recognizer locationInView:recognizer.view];
199
+ focalPoint = [recognizer locationInView:coordinateView];
194
200
  }
195
201
 
196
202
  return [RNGestureHandlerEventExtraData forPinch:recognizer.scale
@@ -155,13 +155,18 @@
155
155
  return self;
156
156
  }
157
157
 
158
+ - (BOOL)isContinuous
159
+ {
160
+ return YES;
161
+ }
162
+
158
163
  #if !TARGET_OS_TV
159
164
 
160
165
  #if TARGET_OS_OSX
161
166
  - (RNGestureHandlerEventExtraData *)eventExtraData:(NSRotationGestureRecognizer *)recognizer
162
167
  {
163
168
  return [RNGestureHandlerEventExtraData forRotation:-recognizer.rotation
164
- withAnchorPoint:[recognizer locationInView:recognizer.view]
169
+ withAnchorPoint:[recognizer locationInView:self.coordinateView]
165
170
  withVelocity:((RNBetterRotationRecognizer *)recognizer).velocity
166
171
  withNumberOfTouches:2
167
172
  withPointerType:RNGestureHandlerMouse];
@@ -170,7 +175,7 @@
170
175
  - (RNGestureHandlerEventExtraData *)eventExtraData:(UIRotationGestureRecognizer *)recognizer
171
176
  {
172
177
  return [RNGestureHandlerEventExtraData forRotation:recognizer.rotation
173
- withAnchorPoint:[recognizer locationInView:recognizer.view]
178
+ withAnchorPoint:[recognizer locationInView:self.coordinateView]
174
179
  withVelocity:recognizer.velocity
175
180
  withNumberOfTouches:recognizer.numberOfTouches
176
181
  withPointerType:_pointerType];
@@ -258,7 +258,7 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
258
258
  [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancel) object:nil];
259
259
  _tapsSoFar = 0;
260
260
  _maxNumberOfTouches = 0;
261
- self.enabled = YES;
261
+ self.enabled = _gestureHandler.enabled;
262
262
  [super reset];
263
263
  [_gestureHandler reset];
264
264
  }
@@ -81,6 +81,7 @@
81
81
  @property (nonatomic) BOOL shouldCancelWhenOutside;
82
82
  @property (nonatomic) BOOL needsPointerData;
83
83
  @property (nonatomic) BOOL manualActivation;
84
+ @property (nonatomic) BOOL cancelsJSResponder;
84
85
  @property (nonatomic) BOOL dispatchesAnimatedEvents;
85
86
  @property (nonatomic) BOOL dispatchesReanimatedEvents;
86
87
  @property (nonatomic, weak, nullable) RNGHUIView *hostDetectorView;
@@ -88,6 +89,17 @@
88
89
  @property (nonatomic, copy, nullable) NSNumber *viewTag;
89
90
  @property (nonatomic, readonly) RNGestureHandlerState lastState;
90
91
 
92
+ /**
93
+ The view whose coordinate space should be used when reporting event positions to JS.
94
+ Handlers attached via the V3 NativeDetector are bound to the `RNGestureHandlerDetector` wrapper,
95
+ which never carries user-applied transforms — those live on its child. When the detector has
96
+ exactly one subview we descend into it so reported coordinates match the visible (transformed)
97
+ view, the same coordinate space V2 and the V3 VirtualGestureDetector report in. With multiple
98
+ subviews there is no JS-side way to disambiguate which child caught the pointer, so we keep
99
+ the detector itself as the reference frame.
100
+ */
101
+ @property (nonatomic, readonly, nullable) RNGHUIView *coordinateView;
102
+
91
103
  - (BOOL)isViewParagraphComponent:(nullable RNGHUIView *)view;
92
104
  - (nonnull RNGHUIView *)chooseViewForInteraction:(nonnull UIGestureRecognizer *)recognizer;
93
105
  - (void)bindToView:(nonnull RNGHUIView *)view;
@@ -96,6 +108,7 @@
96
108
  - (void)setConfig:(nullable NSDictionary *)config NS_REQUIRES_SUPER;
97
109
  - (void)updateConfig:(nullable NSDictionary *)config NS_REQUIRES_SUPER;
98
110
  - (void)updateRelations:(nonnull NSDictionary *)relations;
111
+ - (BOOL)shouldSuppressActiveEvent:(nonnull RNGestureHandlerEventExtraData *)extraData;
99
112
  - (void)handleGesture:(nonnull id)recognizer;
100
113
  - (void)handleGesture:(nonnull id)recognizer fromReset:(BOOL)fromReset;
101
114
  - (void)handleGesture:(nonnull id)recognizer
@@ -125,6 +138,7 @@
125
138
  - (nonnull RNGHUIView *)findViewForEvents;
126
139
  - (BOOL)wantsToAttachDirectlyToView;
127
140
  - (BOOL)usesNativeOrVirtualDetector;
141
+ - (BOOL)isContinuous;
128
142
 
129
143
  #if !TARGET_OS_OSX
130
144
  - (BOOL)isUIScrollViewPanGestureRecognizer:(nonnull UIGestureRecognizer *)gestureRecognizer;
@@ -140,3 +154,7 @@
140
154
  #endif
141
155
 
142
156
  @end
157
+
158
+ @interface UIGestureRecognizer (GestureHandler)
159
+ @property (nonatomic, readonly, nullable) RNGestureHandler *gestureHandler;
160
+ @end
@@ -14,10 +14,6 @@
14
14
  #import <React/RCTParagraphComponentView.h>
15
15
  #import <React/RCTScrollViewComponentView.h>
16
16
 
17
- @interface UIGestureRecognizer (GestureHandler)
18
- @property (nonatomic, readonly) RNGestureHandler *gestureHandler;
19
- @end
20
-
21
17
  @implementation UIGestureRecognizer (GestureHandler)
22
18
 
23
19
  - (RNGestureHandler *)gestureHandler
@@ -105,6 +101,7 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
105
101
  self.testID = nil;
106
102
  self.manualActivation = NO;
107
103
  _shouldCancelWhenOutside = NO;
104
+ _cancelsJSResponder = YES;
108
105
  _hitSlop = RNGHHitSlopEmpty;
109
106
  _needsPointerData = NO;
110
107
  _dispatchesAnimatedEvents = NO;
@@ -164,6 +161,11 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
164
161
  self.manualActivation = [RCTConvert BOOL:prop];
165
162
  }
166
163
 
164
+ prop = config[@"cancelsJSResponder"];
165
+ if (prop != nil) {
166
+ _cancelsJSResponder = [RCTConvert BOOL:prop];
167
+ }
168
+
167
169
  prop = config[@"hitSlop"];
168
170
  if ([prop isKindOfClass:[NSNumber class]]) {
169
171
  _hitSlop.left = _hitSlop.right = _hitSlop.top = _hitSlop.bottom = [prop doubleValue];
@@ -252,6 +254,43 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
252
254
  return [view isKindOfClass:[RCTParagraphComponentView class]];
253
255
  }
254
256
 
257
+ /**
258
+ * Recursively searches the view subtree rooted at `view` for any descendant whose
259
+ * `touchEventEmitterAtPoint:` returns an emitter tag matching `virtualViewTag`.
260
+ * `point` must be in `view`'s coordinate space.
261
+ *
262
+ * Most Fabric views inherit a base `touchEventEmitterAtPoint:` that returns their own emitter
263
+ * (tag == their own reactTag). Views that render multiple logical children — like
264
+ * `RCTParagraphComponentView` for inline text spans — override the method to return
265
+ * per-child emitters, making them distinguishable by tag. This helper exploits that
266
+ * property without hardcoding any specific view class.
267
+ */
268
+ - (BOOL)isVirtualViewTag:(NSNumber *)virtualViewTag touchedAtPoint:(CGPoint)point inView:(RNGHUIView *)view
269
+ {
270
+ if (!CGRectContainsPoint(view.bounds, point)) {
271
+ return NO;
272
+ }
273
+
274
+ if ([view respondsToSelector:@selector(touchEventEmitterAtPoint:)]) {
275
+ auto emitter = [(id<RCTTouchableComponentViewProtocol>)view touchEventEmitterAtPoint:point];
276
+ if (emitter) {
277
+ auto eventTarget = emitter->getEventTarget();
278
+ if (eventTarget != nullptr && eventTarget->getTag() == [virtualViewTag intValue]) {
279
+ return YES;
280
+ }
281
+ }
282
+ }
283
+
284
+ for (RNGHUIView *subview in view.subviews) {
285
+ CGPoint pointInSubview = [view convertPoint:point toView:subview];
286
+ if ([self isVirtualViewTag:virtualViewTag touchedAtPoint:pointInSubview inView:subview]) {
287
+ return YES;
288
+ }
289
+ }
290
+
291
+ return NO;
292
+ }
293
+
255
294
  - (void)bindToView:(RNGHUIView *)view
256
295
  {
257
296
  self.recognizer.delegate = self;
@@ -286,12 +325,12 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
286
325
  - (RNGestureHandlerEventExtraData *)eventExtraData:(UIGestureRecognizer *)recognizer
287
326
  {
288
327
  #if TARGET_OS_OSX
289
- return [RNGestureHandlerEventExtraData forPosition:[recognizer locationInView:recognizer.view]
328
+ return [RNGestureHandlerEventExtraData forPosition:[recognizer locationInView:self.coordinateView]
290
329
  withAbsolutePosition:[recognizer locationInView:recognizer.view.window.contentView]
291
330
  withNumberOfTouches:1
292
331
  withPointerType:RNGestureHandlerMouse];
293
332
  #else
294
- return [RNGestureHandlerEventExtraData forPosition:[recognizer locationInView:recognizer.view]
333
+ return [RNGestureHandlerEventExtraData forPosition:[recognizer locationInView:self.coordinateView]
295
334
  withAbsolutePosition:[recognizer locationInView:recognizer.view.window]
296
335
  withNumberOfTouches:recognizer.numberOfTouches
297
336
  withPointerType:_pointerType];
@@ -307,6 +346,21 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
307
346
  return [self isViewParagraphComponent:recognizer.view] ? recognizer.view.subviews[0] : recognizer.view;
308
347
  }
309
348
 
349
+ - (RNGHUIView *)coordinateView
350
+ {
351
+ RNGHUIView *recognizerView = _recognizer.view;
352
+ if ([self usesNativeOrVirtualDetector] && recognizerView == self.hostDetectorView &&
353
+ recognizerView.subviews.count == 1) {
354
+ return recognizerView.subviews[0];
355
+ }
356
+ return recognizerView;
357
+ }
358
+
359
+ - (BOOL)shouldSuppressActiveEvent:(RNGestureHandlerEventExtraData *)extraData
360
+ {
361
+ return NO;
362
+ }
363
+
310
364
  - (void)handleGesture:(UIGestureRecognizer *)recognizer
311
365
  {
312
366
  [self handleGesture:recognizer fromReset:NO];
@@ -368,6 +422,10 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
368
422
 
369
423
  RNGestureHandlerEventExtraData *eventData = [self eventExtraData:recognizer];
370
424
 
425
+ if (state == RNGestureHandlerStateActive && [self shouldSuppressActiveEvent:eventData]) {
426
+ return;
427
+ }
428
+
371
429
  NSNumber *tag = [self chooseViewForInteraction:recognizer].reactTag;
372
430
 
373
431
  if (tag == nil && _actionType == RNGestureHandlerActionTypeNativeDetector) {
@@ -732,6 +790,11 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
732
790
 
733
791
  - (BOOL)containsPointInView
734
792
  {
793
+ if (_actionType == RNGestureHandlerActionTypeVirtualDetector && _virtualViewTag != nil) {
794
+ CGPoint point = [_recognizer locationInView:_recognizer.view];
795
+ return [self isVirtualViewTag:_virtualViewTag touchedAtPoint:point inView:_recognizer.view];
796
+ }
797
+
735
798
  RNGHUIView *viewToHitTest = _recognizer.view;
736
799
 
737
800
  if (_shouldCancelWhenOutside && [self usesNativeOrVirtualDetector] && [_recognizer.view.subviews count] > 0) {
@@ -746,6 +809,11 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
746
809
 
747
810
  - (BOOL)wantsToHandleEventsAtPoint:(CGPoint)point
748
811
  {
812
+ if (_actionType == RNGestureHandlerActionTypeVirtualDetector && _virtualViewTag != nil) {
813
+ // point is in _recognizer.view (detector) coordinate space; search the whole subtree
814
+ return [self isVirtualViewTag:_virtualViewTag touchedAtPoint:point inView:_recognizer.view];
815
+ }
816
+
749
817
  RNGHUIView *viewToHitTest = _recognizer.view;
750
818
 
751
819
  if ([self usesNativeOrVirtualDetector] && [_recognizer.view.subviews count] > 0) {
@@ -753,20 +821,6 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
753
821
  point = [_recognizer.view convertPoint:point toView:viewToHitTest];
754
822
  }
755
823
 
756
- if (_actionType == RNGestureHandlerActionTypeVirtualDetector && _virtualViewTag != nil) {
757
- // In this case, logic detector is attached to the DetectorView, which has a single subview representing
758
- // the actual target view in the RN hierarchy
759
- if ([viewToHitTest respondsToSelector:@selector(touchEventEmitterAtPoint:)]) {
760
- // If the view has touchEventEmitterAtPoint: method, it can be used to determine the viewtag
761
- // of the view under the touch point
762
- facebook::react::SharedTouchEventEmitter eventEmitter =
763
- [(id<RCTTouchableComponentViewProtocol>)viewToHitTest touchEventEmitterAtPoint:point];
764
- auto viewUnderTouch = eventEmitter->getEventTarget()->getTag();
765
-
766
- return viewUnderTouch == [_virtualViewTag intValue];
767
- }
768
- }
769
-
770
824
  CGRect hitFrame = RNGHHitSlopInsetRect(viewToHitTest.bounds, _hitSlop);
771
825
  return CGRectContainsPoint(hitFrame, point);
772
826
  }
@@ -789,19 +843,9 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
789
843
 
790
844
  // Logic detector has a virtual view tag set only if the real hierarchy was folded into a single View
791
845
  if (_actionType == RNGestureHandlerActionTypeVirtualDetector && _virtualViewTag != nil) {
792
- // In this case, logic detector is attached to the DetectorView, which has a single subview representing
793
- // the actual target view in the RN hierarchy
794
- RNGHUIView *view = _recognizer.view.subviews[0];
795
- if ([view respondsToSelector:@selector(touchEventEmitterAtPoint:)]) {
796
- // If the view has touchEventEmitterAtPoint: method, it can be used to determine the viewtag
797
- // of the view under the touch point
798
- facebook::react::SharedTouchEventEmitter eventEmitter =
799
- [(id<RCTTouchableComponentViewProtocol>)view touchEventEmitterAtPoint:[_recognizer locationInView:view]];
800
- auto viewUnderTouch = eventEmitter->getEventTarget()->getTag();
801
-
802
- if (viewUnderTouch != [_virtualViewTag intValue]) {
803
- return NO;
804
- }
846
+ CGPoint point = [_recognizer locationInView:_recognizer.view];
847
+ if (![self isVirtualViewTag:_virtualViewTag touchedAtPoint:point inView:_recognizer.view]) {
848
+ return NO;
805
849
  }
806
850
  }
807
851
 
@@ -833,4 +877,9 @@ static NSHashTable<RNGestureHandler *> *allGestureHandlers;
833
877
  return NO;
834
878
  }
835
879
 
880
+ - (BOOL)isContinuous
881
+ {
882
+ return NO;
883
+ }
884
+
836
885
  @end
@@ -27,8 +27,10 @@
27
27
  @property (nonatomic) BOOL userEnabled;
28
28
  @property (nonatomic, assign) RNGestureHandlerPointerEvents pointerEvents;
29
29
 
30
- @property (nonatomic, assign) NSInteger pressAndHoldAnimationDuration;
31
- @property (nonatomic, assign) NSInteger tapAnimationDuration;
30
+ @property (nonatomic, assign) NSInteger tapAnimationInDuration;
31
+ @property (nonatomic, assign) NSInteger tapAnimationOutDuration;
32
+ @property (nonatomic, assign) NSInteger longPressDuration;
33
+ @property (nonatomic, assign) NSInteger longPressAnimationOutDuration;
32
34
  @property (nonatomic, assign) CGFloat activeOpacity;
33
35
  @property (nonatomic, assign) CGFloat defaultOpacity;
34
36
  @property (nonatomic, assign) CGFloat activeScale;
@@ -49,6 +51,14 @@
49
51
  */
50
52
  - (void)applyStartAnimationState;
51
53
 
54
+ /**
55
+ * Resets all transient press/animation state so the button can be safely reused
56
+ * by Fabric view recycling. Cancels pending press-out blocks, removes in-flight
57
+ * animations, and unconditionally restores the animation target's transform/alpha
58
+ * and the underlay opacity to neutral values.
59
+ */
60
+ - (void)prepareForRecycle;
61
+
52
62
  /**
53
63
  * Updates the underlay layer's corner radii with separate horizontal/vertical
54
64
  * components per corner, supporting elliptical inner corners when border widths