react-native-gesture-handler 2.17.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/ReanimatedSwipeable/package.json +6 -0
  2. package/android/build.gradle +0 -105
  3. package/android/gradle.properties +0 -7
  4. package/android/paper/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.java +22 -10
  5. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +1 -1
  6. package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +16 -0
  7. package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +7 -8
  8. package/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureDetector.kt +14 -4
  9. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +3 -1
  10. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +3 -1
  11. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +2 -1
  12. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +8 -7
  13. package/android/src/main/jni/cpp-adapter.cpp +5 -3
  14. package/apple/Handlers/RNFlingHandler.m +1 -0
  15. package/apple/Handlers/RNForceTouchHandler.m +2 -0
  16. package/apple/Handlers/RNLongPressHandler.m +2 -1
  17. package/apple/Handlers/RNManualHandler.m +1 -0
  18. package/apple/Handlers/RNNativeViewHandler.mm +31 -27
  19. package/apple/Handlers/RNPanHandler.m +1 -0
  20. package/apple/Handlers/RNPinchHandler.m +1 -0
  21. package/apple/Handlers/RNRotationHandler.m +1 -0
  22. package/apple/Handlers/RNTapHandler.m +1 -0
  23. package/apple/RNGestureHandlerModule.mm +3 -2
  24. package/apple/RNRootViewGestureRecognizer.m +5 -0
  25. package/lib/commonjs/Directions.js +2 -2
  26. package/lib/commonjs/Directions.js.map +1 -1
  27. package/lib/commonjs/RNGestureHandlerModule.web.js +2 -2
  28. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
  29. package/lib/commonjs/components/DrawerLayout.js +2 -2
  30. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  31. package/lib/commonjs/components/GestureButtons.js +3 -3
  32. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  33. package/lib/commonjs/components/GestureButtonsProps.js +6 -0
  34. package/lib/commonjs/components/GestureButtonsProps.js.map +1 -0
  35. package/lib/commonjs/components/GestureComponents.js +1 -1
  36. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  37. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
  38. package/lib/commonjs/components/GestureHandlerRootView.android.js +1 -1
  39. package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -1
  40. package/lib/commonjs/components/GestureHandlerRootView.js +1 -1
  41. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  42. package/lib/commonjs/components/Pressable/Pressable.js +334 -0
  43. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -0
  44. package/lib/commonjs/components/Pressable/PressableProps.js +6 -0
  45. package/lib/commonjs/components/Pressable/PressableProps.js.map +1 -0
  46. package/lib/commonjs/components/Pressable/index.js +24 -0
  47. package/lib/commonjs/components/Pressable/index.js.map +1 -0
  48. package/lib/commonjs/components/Pressable/utils.js +136 -0
  49. package/lib/commonjs/components/Pressable/utils.js.map +1 -0
  50. package/lib/commonjs/components/ReanimatedSwipeable.js +317 -0
  51. package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -0
  52. package/lib/commonjs/components/Swipeable.js +3 -3
  53. package/lib/commonjs/components/Swipeable.js.map +1 -1
  54. package/lib/commonjs/components/touchables/GenericTouchable.js +4 -4
  55. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  56. package/lib/commonjs/components/touchables/GenericTouchableProps.js +6 -0
  57. package/lib/commonjs/components/touchables/GenericTouchableProps.js.map +1 -0
  58. package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -1
  59. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +1 -1
  60. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  61. package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js +6 -0
  62. package/lib/commonjs/components/touchables/TouchableNativeFeedbackProps.js.map +1 -0
  63. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -1
  64. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  65. package/lib/commonjs/getShadowNodeFromRef.js +2 -2
  66. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  67. package/lib/commonjs/ghQueueMicrotask.js +3 -4
  68. package/lib/commonjs/ghQueueMicrotask.js.map +1 -1
  69. package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -1
  70. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
  71. package/lib/commonjs/handlers/GestureHandlerEventPayload.js +2 -0
  72. package/lib/commonjs/handlers/GestureHandlerEventPayload.js.map +1 -0
  73. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
  74. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -1
  75. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
  76. package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -1
  77. package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -1
  78. package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
  79. package/lib/commonjs/handlers/createHandler.js +21 -19
  80. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  81. package/lib/commonjs/handlers/createNativeWrapper.js +3 -3
  82. package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -1
  83. package/lib/commonjs/handlers/gestureHandlerCommon.js +0 -86
  84. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  85. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  86. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +9 -9
  87. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  88. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +2 -2
  89. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  90. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +1 -1
  91. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -1
  92. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +21 -31
  93. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  94. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +1 -1
  95. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  96. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +5 -5
  97. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
  98. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
  99. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
  100. package/lib/commonjs/handlers/gestures/gesture.js +7 -7
  101. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  102. package/lib/commonjs/handlers/gestures/gestureComposition.js +5 -5
  103. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
  104. package/lib/commonjs/handlers/gestures/gestureStateManager.js +1 -1
  105. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
  106. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
  107. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
  108. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
  109. package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -1
  110. package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -1
  111. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
  112. package/lib/commonjs/handlers/getNextHandlerTag.js +12 -0
  113. package/lib/commonjs/handlers/getNextHandlerTag.js.map +1 -0
  114. package/lib/commonjs/handlers/handlersRegistry.js +0 -6
  115. package/lib/commonjs/handlers/handlersRegistry.js.map +1 -1
  116. package/lib/commonjs/handlers/utils.js +91 -0
  117. package/lib/commonjs/handlers/utils.js.map +1 -0
  118. package/lib/commonjs/index.js +8 -0
  119. package/lib/commonjs/index.js.map +1 -1
  120. package/lib/commonjs/init.js +1 -1
  121. package/lib/commonjs/init.js.map +1 -1
  122. package/lib/commonjs/jestUtils/jestUtils.js +2 -2
  123. package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
  124. package/lib/commonjs/mocks.js +2 -2
  125. package/lib/commonjs/mocks.js.map +1 -1
  126. package/lib/commonjs/utils.js +1 -1
  127. package/lib/commonjs/utils.js.map +1 -1
  128. package/lib/commonjs/web/Gestures.js +1 -1
  129. package/lib/commonjs/web/Gestures.js.map +1 -1
  130. package/lib/commonjs/web/detectors/RotationGestureDetector.js +1 -1
  131. package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
  132. package/lib/commonjs/web/detectors/ScaleGestureDetector.js +4 -4
  133. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
  134. package/lib/commonjs/web/handlers/FlingGestureHandler.js +1 -1
  135. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  136. package/lib/commonjs/web/handlers/GestureHandler.js +6 -11
  137. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  138. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +1 -1
  139. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  140. package/lib/commonjs/web/handlers/PanGestureHandler.js +1 -1
  141. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  142. package/lib/commonjs/web/handlers/TapGestureHandler.js +1 -1
  143. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  144. package/lib/commonjs/web/tools/EventManager.js +2 -2
  145. package/lib/commonjs/web/tools/EventManager.js.map +1 -1
  146. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +4 -11
  147. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  148. package/lib/commonjs/web/tools/LeastSquareSolver.js +18 -18
  149. package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -1
  150. package/lib/commonjs/web/tools/PointerEventManager.js +2 -2
  151. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  152. package/lib/commonjs/web/tools/PointerTracker.js +1 -1
  153. package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
  154. package/lib/commonjs/web/tools/TouchEventManager.js +4 -4
  155. package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
  156. package/lib/commonjs/web/tools/VelocityTracker.js +6 -6
  157. package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -1
  158. package/lib/commonjs/web_hammer/NodeManager.js +2 -0
  159. package/lib/commonjs/web_hammer/NodeManager.js.map +1 -1
  160. package/lib/module/Directions.js +2 -2
  161. package/lib/module/Directions.js.map +1 -1
  162. package/lib/module/RNGestureHandlerModule.web.js +2 -2
  163. package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
  164. package/lib/module/components/DrawerLayout.js +2 -2
  165. package/lib/module/components/DrawerLayout.js.map +1 -1
  166. package/lib/module/components/GestureButtons.js +3 -3
  167. package/lib/module/components/GestureButtons.js.map +1 -1
  168. package/lib/module/components/GestureButtonsProps.js +2 -0
  169. package/lib/module/components/GestureButtonsProps.js.map +1 -0
  170. package/lib/module/components/GestureComponents.js +1 -1
  171. package/lib/module/components/GestureComponents.js.map +1 -1
  172. package/lib/module/components/GestureHandlerButton.js.map +1 -1
  173. package/lib/module/components/GestureHandlerRootView.android.js +1 -1
  174. package/lib/module/components/GestureHandlerRootView.android.js.map +1 -1
  175. package/lib/module/components/GestureHandlerRootView.js +1 -1
  176. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  177. package/lib/module/components/Pressable/Pressable.js +309 -0
  178. package/lib/module/components/Pressable/Pressable.js.map +1 -0
  179. package/lib/module/components/Pressable/PressableProps.js +2 -0
  180. package/lib/module/components/Pressable/PressableProps.js.map +1 -0
  181. package/lib/module/components/Pressable/index.js +3 -0
  182. package/lib/module/components/Pressable/index.js.map +1 -0
  183. package/lib/module/components/Pressable/utils.js +120 -0
  184. package/lib/module/components/Pressable/utils.js.map +1 -0
  185. package/lib/module/components/ReanimatedSwipeable.js +293 -0
  186. package/lib/module/components/ReanimatedSwipeable.js.map +1 -0
  187. package/lib/module/components/Swipeable.js +3 -3
  188. package/lib/module/components/Swipeable.js.map +1 -1
  189. package/lib/module/components/touchables/GenericTouchable.js +4 -4
  190. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  191. package/lib/module/components/touchables/GenericTouchableProps.js +2 -0
  192. package/lib/module/components/touchables/GenericTouchableProps.js.map +1 -0
  193. package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
  194. package/lib/module/components/touchables/TouchableNativeFeedback.android.js +1 -1
  195. package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  196. package/lib/module/components/touchables/TouchableNativeFeedbackProps.js +2 -0
  197. package/lib/module/components/touchables/TouchableNativeFeedbackProps.js.map +1 -0
  198. package/lib/module/components/touchables/TouchableOpacity.js.map +1 -1
  199. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
  200. package/lib/module/getShadowNodeFromRef.js +2 -2
  201. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  202. package/lib/module/ghQueueMicrotask.js +3 -4
  203. package/lib/module/ghQueueMicrotask.js.map +1 -1
  204. package/lib/module/handlers/FlingGestureHandler.js.map +1 -1
  205. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
  206. package/lib/module/handlers/GestureHandlerEventPayload.js +2 -0
  207. package/lib/module/handlers/GestureHandlerEventPayload.js.map +1 -0
  208. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
  209. package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -1
  210. package/lib/module/handlers/PanGestureHandler.js.map +1 -1
  211. package/lib/module/handlers/PinchGestureHandler.js.map +1 -1
  212. package/lib/module/handlers/RotationGestureHandler.js.map +1 -1
  213. package/lib/module/handlers/TapGestureHandler.js.map +1 -1
  214. package/lib/module/handlers/createHandler.js +6 -5
  215. package/lib/module/handlers/createHandler.js.map +1 -1
  216. package/lib/module/handlers/createNativeWrapper.js +3 -3
  217. package/lib/module/handlers/createNativeWrapper.js.map +1 -1
  218. package/lib/module/handlers/gestureHandlerCommon.js +0 -72
  219. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  220. package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -1
  221. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +4 -4
  222. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -1
  223. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +1 -1
  224. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -1
  225. package/lib/module/handlers/gestures/GestureDetector/index.js +1 -1
  226. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -1
  227. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +18 -28
  228. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -1
  229. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +1 -1
  230. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -1
  231. package/lib/module/handlers/gestures/GestureDetector/utils.js +5 -5
  232. package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
  233. package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
  234. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
  235. package/lib/module/handlers/gestures/gesture.js +6 -6
  236. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  237. package/lib/module/handlers/gestures/gestureComposition.js +5 -5
  238. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
  239. package/lib/module/handlers/gestures/gestureStateManager.js +1 -1
  240. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
  241. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
  242. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
  243. package/lib/module/handlers/gestures/panGesture.js.map +1 -1
  244. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -1
  245. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -1
  246. package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
  247. package/lib/module/handlers/getNextHandlerTag.js +5 -0
  248. package/lib/module/handlers/getNextHandlerTag.js.map +1 -0
  249. package/lib/module/handlers/handlersRegistry.js +0 -4
  250. package/lib/module/handlers/handlersRegistry.js.map +1 -1
  251. package/lib/module/handlers/utils.js +73 -0
  252. package/lib/module/handlers/utils.js.map +1 -0
  253. package/lib/module/index.js +1 -0
  254. package/lib/module/index.js.map +1 -1
  255. package/lib/module/init.js +1 -1
  256. package/lib/module/init.js.map +1 -1
  257. package/lib/module/jestUtils/jestUtils.js +2 -2
  258. package/lib/module/jestUtils/jestUtils.js.map +1 -1
  259. package/lib/module/mocks.js +2 -2
  260. package/lib/module/mocks.js.map +1 -1
  261. package/lib/module/utils.js +1 -1
  262. package/lib/module/utils.js.map +1 -1
  263. package/lib/module/web/Gestures.js +1 -1
  264. package/lib/module/web/Gestures.js.map +1 -1
  265. package/lib/module/web/detectors/RotationGestureDetector.js +1 -1
  266. package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
  267. package/lib/module/web/detectors/ScaleGestureDetector.js +4 -4
  268. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  269. package/lib/module/web/handlers/FlingGestureHandler.js +1 -1
  270. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  271. package/lib/module/web/handlers/GestureHandler.js +6 -11
  272. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  273. package/lib/module/web/handlers/NativeViewGestureHandler.js +1 -1
  274. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  275. package/lib/module/web/handlers/PanGestureHandler.js +1 -1
  276. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  277. package/lib/module/web/handlers/TapGestureHandler.js +1 -1
  278. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  279. package/lib/module/web/tools/EventManager.js +2 -2
  280. package/lib/module/web/tools/EventManager.js.map +1 -1
  281. package/lib/module/web/tools/GestureHandlerWebDelegate.js +4 -11
  282. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  283. package/lib/module/web/tools/LeastSquareSolver.js +18 -18
  284. package/lib/module/web/tools/LeastSquareSolver.js.map +1 -1
  285. package/lib/module/web/tools/PointerEventManager.js +2 -2
  286. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  287. package/lib/module/web/tools/PointerTracker.js +1 -1
  288. package/lib/module/web/tools/PointerTracker.js.map +1 -1
  289. package/lib/module/web/tools/TouchEventManager.js +4 -4
  290. package/lib/module/web/tools/TouchEventManager.js.map +1 -1
  291. package/lib/module/web/tools/VelocityTracker.js +6 -6
  292. package/lib/module/web/tools/VelocityTracker.js.map +1 -1
  293. package/lib/module/web_hammer/NodeManager.js +1 -1
  294. package/lib/module/web_hammer/NodeManager.js.map +1 -1
  295. package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -1
  296. package/lib/typescript/components/GestureButtons.d.ts +2 -85
  297. package/lib/typescript/components/GestureButtonsProps.d.ts +99 -0
  298. package/lib/typescript/components/GestureHandlerButton.d.ts +1 -1
  299. package/lib/typescript/components/Pressable/Pressable.d.ts +3 -0
  300. package/lib/typescript/components/Pressable/PressableProps.d.ts +116 -0
  301. package/lib/typescript/components/Pressable/index.d.ts +2 -0
  302. package/lib/typescript/components/Pressable/utils.d.ts +15 -0
  303. package/lib/typescript/components/ReanimatedSwipeable.d.ts +125 -0
  304. package/lib/typescript/components/touchables/GenericTouchable.d.ts +4 -16
  305. package/lib/typescript/components/touchables/GenericTouchableProps.d.ts +14 -0
  306. package/lib/typescript/components/touchables/TouchableHighlight.d.ts +1 -1
  307. package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +2 -9
  308. package/lib/typescript/components/touchables/TouchableNativeFeedbackProps.d.ts +9 -0
  309. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +1 -1
  310. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +2 -1
  311. package/lib/typescript/handlers/FlingGestureHandler.d.ts +2 -6
  312. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +1 -10
  313. package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +159 -0
  314. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +2 -35
  315. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +2 -6
  316. package/lib/typescript/handlers/PanGestureHandler.d.ts +3 -51
  317. package/lib/typescript/handlers/PinchGestureHandler.d.ts +2 -23
  318. package/lib/typescript/handlers/RotationGestureHandler.d.ts +2 -23
  319. package/lib/typescript/handlers/TapGestureHandler.d.ts +2 -6
  320. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +0 -5
  321. package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +10 -9
  322. package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +1 -0
  323. package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +1 -0
  324. package/lib/typescript/handlers/gestures/flingGesture.d.ts +2 -1
  325. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +2 -1
  326. package/lib/typescript/handlers/gestures/gesture.d.ts +2 -8
  327. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +2 -1
  328. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +2 -1
  329. package/lib/typescript/handlers/gestures/panGesture.d.ts +2 -1
  330. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +1 -1
  331. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +1 -1
  332. package/lib/typescript/handlers/gestures/tapGesture.d.ts +2 -1
  333. package/lib/typescript/handlers/getNextHandlerTag.d.ts +1 -0
  334. package/lib/typescript/handlers/handlersRegistry.d.ts +1 -2
  335. package/lib/typescript/handlers/utils.d.ts +6 -0
  336. package/lib/typescript/index.d.ts +12 -9
  337. package/lib/typescript/jestUtils/jestUtils.d.ts +9 -7
  338. package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +1 -0
  339. package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -0
  340. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +1 -0
  341. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +1 -0
  342. package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +1 -0
  343. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -0
  344. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +1 -0
  345. package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +1 -0
  346. package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +1 -0
  347. package/lib/typescript/web/handlers/TapGestureHandler.d.ts +1 -0
  348. package/lib/typescript/web_hammer/NodeManager.d.ts +4 -5
  349. package/package.json +14 -16
  350. package/src/Directions.ts +2 -2
  351. package/src/RNGestureHandlerModule.web.ts +2 -2
  352. package/src/components/DrawerLayout.tsx +7 -9
  353. package/src/components/GestureButtons.tsx +13 -123
  354. package/src/components/GestureButtonsProps.ts +115 -0
  355. package/src/components/GestureComponents.tsx +1 -1
  356. package/src/components/GestureHandlerButton.tsx +1 -1
  357. package/src/components/GestureHandlerRootView.android.tsx +1 -1
  358. package/src/components/GestureHandlerRootView.tsx +1 -1
  359. package/src/components/Pressable/Pressable.tsx +398 -0
  360. package/src/components/Pressable/PressableProps.tsx +149 -0
  361. package/src/components/Pressable/index.ts +2 -0
  362. package/src/components/Pressable/utils.ts +180 -0
  363. package/src/components/ReanimatedSwipeable.tsx +629 -0
  364. package/src/components/Swipeable.tsx +6 -6
  365. package/src/components/touchables/GenericTouchable.tsx +9 -36
  366. package/src/components/touchables/GenericTouchableProps.ts +26 -0
  367. package/src/components/touchables/TouchableHighlight.tsx +2 -4
  368. package/src/components/touchables/TouchableNativeFeedback.android.tsx +7 -17
  369. package/src/components/touchables/TouchableNativeFeedbackProps.tsx +12 -0
  370. package/src/components/touchables/TouchableOpacity.tsx +3 -5
  371. package/src/components/touchables/TouchableWithoutFeedback.tsx +2 -1
  372. package/src/getShadowNodeFromRef.ts +2 -2
  373. package/src/ghQueueMicrotask.ts +7 -4
  374. package/src/handlers/FlingGestureHandler.ts +1 -6
  375. package/src/handlers/ForceTouchGestureHandler.ts +1 -12
  376. package/src/handlers/GestureHandlerEventPayload.ts +184 -0
  377. package/src/handlers/LongPressGestureHandler.ts +1 -40
  378. package/src/handlers/NativeViewGestureHandler.ts +1 -7
  379. package/src/handlers/PanGestureHandler.ts +1 -58
  380. package/src/handlers/PinchGestureHandler.ts +1 -27
  381. package/src/handlers/RotationGestureHandler.ts +1 -27
  382. package/src/handlers/TapGestureHandler.ts +1 -6
  383. package/src/handlers/createHandler.tsx +6 -11
  384. package/src/handlers/createNativeWrapper.tsx +3 -3
  385. package/src/handlers/gestureHandlerCommon.ts +3 -79
  386. package/src/handlers/gestureHandlerTypesCompat.ts +16 -30
  387. package/src/handlers/gestures/GestureDetector/Wrap.tsx +1 -1
  388. package/src/handlers/gestures/GestureDetector/attachHandlers.ts +4 -7
  389. package/src/handlers/gestures/GestureDetector/dropHandlers.ts +1 -1
  390. package/src/handlers/gestures/GestureDetector/index.tsx +1 -1
  391. package/src/handlers/gestures/GestureDetector/updateHandlers.ts +20 -30
  392. package/src/handlers/gestures/GestureDetector/useDetectorUpdater.ts +1 -1
  393. package/src/handlers/gestures/GestureDetector/utils.ts +5 -5
  394. package/src/handlers/gestures/flingGesture.ts +2 -4
  395. package/src/handlers/gestures/forceTouchGesture.ts +2 -4
  396. package/src/handlers/gestures/gesture.ts +17 -15
  397. package/src/handlers/gestures/gestureComposition.ts +5 -5
  398. package/src/handlers/gestures/gestureStateManager.ts +1 -1
  399. package/src/handlers/gestures/longPressGesture.ts +2 -4
  400. package/src/handlers/gestures/nativeGesture.ts +2 -4
  401. package/src/handlers/gestures/panGesture.ts +2 -4
  402. package/src/handlers/gestures/pinchGesture.ts +1 -1
  403. package/src/handlers/gestures/rotationGesture.ts +1 -1
  404. package/src/handlers/gestures/tapGesture.ts +2 -4
  405. package/src/handlers/getNextHandlerTag.ts +5 -0
  406. package/src/handlers/handlersRegistry.ts +0 -6
  407. package/src/handlers/utils.ts +75 -0
  408. package/src/index.ts +25 -36
  409. package/src/init.ts +1 -1
  410. package/src/jestUtils/jestUtils.ts +12 -10
  411. package/src/mocks.ts +2 -2
  412. package/src/utils.ts +1 -1
  413. package/src/web/Gestures.ts +1 -1
  414. package/src/web/detectors/RotationGestureDetector.ts +1 -1
  415. package/src/web/detectors/ScaleGestureDetector.ts +4 -4
  416. package/src/web/handlers/FlingGestureHandler.ts +1 -1
  417. package/src/web/handlers/GestureHandler.ts +8 -14
  418. package/src/web/handlers/NativeViewGestureHandler.ts +3 -3
  419. package/src/web/handlers/PanGestureHandler.ts +1 -1
  420. package/src/web/handlers/TapGestureHandler.ts +1 -1
  421. package/src/web/tools/EventManager.ts +2 -2
  422. package/src/web/tools/GestureHandlerWebDelegate.ts +3 -8
  423. package/src/web/tools/LeastSquareSolver.ts +18 -18
  424. package/src/web/tools/PointerEventManager.ts +2 -2
  425. package/src/web/tools/PointerTracker.ts +2 -1
  426. package/src/web/tools/TouchEventManager.ts +4 -4
  427. package/src/web/tools/VelocityTracker.ts +6 -6
  428. package/src/web_hammer/NodeManager.ts +2 -11
@@ -0,0 +1,6 @@
1
+ {
2
+ "main": "../lib/commonjs/components/ReanimatedSwipeable",
3
+ "module": "../lib/module/components/ReanimatedSwipeable",
4
+ "react-native": "../src/components/ReanimatedSwipeable",
5
+ "types": "../lib/typescript/components/ReanimatedSwipeable.d.ts"
6
+ }
@@ -207,108 +207,3 @@ dependencies {
207
207
  implementation "androidx.core:core-ktx:1.6.0"
208
208
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
209
209
  }
210
-
211
- def isGHExampleApp() {
212
- return project.hasProperty('isGHExampleApp') && project.property('isGHExampleApp') == "true"
213
- }
214
-
215
- def getAbsoluteCodegenArtifactsPaperDestination() {
216
- if (!project.hasProperty('codegenArtifactsPaperDestination')) {
217
- throw new Exception('[react-native-gesture-handler] Please fill codegenArtifactsPaperDestination variable in android/gradle.properties to point to the correct path to generated specs for paper')
218
- }
219
-
220
- return "${project.rootDir}/../../${project.property('codegenArtifactsPaperDestination')}"
221
- }
222
-
223
- def getAbsoluteCodegenArtifactsSource() {
224
- if (!project.hasProperty('codegenArtifactsSource')) {
225
- throw new Exception('[react-native-gesture-handler] Please fill codegenArtifactsSource variable in android/gradle.properties to point to the correct path to codegenerated artifacts')
226
- }
227
-
228
- return "${project.rootDir}/../../${project.property('codegenArtifactsSource')}"
229
- }
230
-
231
-
232
- tasks.register('copyCodegenArtifacts') {
233
- group 'After build tasks'
234
- description 'Task which copies codegen artifacts to paper architecture'
235
-
236
- if (!isGHExampleApp() || !isNewArchitectureEnabled()) {
237
- return
238
- }
239
-
240
- dependsOn tasks.generateCodegenArtifactsFromSchema
241
-
242
- doLast {
243
-
244
- def absoluteCodegenArtifactsPaperDestination = getAbsoluteCodegenArtifactsPaperDestination()
245
- def absoluteCodegenArtifactsSource = getAbsoluteCodegenArtifactsSource()
246
-
247
- def existingFiles = fileTree(absoluteCodegenArtifactsPaperDestination).matching {
248
- include '**/*.java'
249
- }
250
-
251
- def generatedFiles = fileTree(absoluteCodegenArtifactsSource).matching {
252
- include '**/*.java'
253
- }
254
-
255
- def existingFilesMap = [:]
256
-
257
- existingFiles.forEach { existingFile ->
258
- println existingFile
259
- existingFilesMap[existingFile.name] = 1
260
- }
261
-
262
- generatedFiles.forEach { generatedFile ->
263
- if (!existingFilesMap.containsKey(generatedFile.name)) {
264
- logger.warn("[react-native-gesture-handler] ${generatedFile.name} not found in paper dir, if it's used on Android you need to copy it manually and implement yourself before using auto-copy feature.")
265
- }
266
- }
267
-
268
- if (existingFiles.size() == 0) {
269
- logger.warn("[react-native-gesture-handler] Paper destination with codegen interfaces is empty. This might be okay if you don't have any interfaces/delegates used on Android, but if that's not the case please check if codegenArtifactsPaperDestination property in android/gradle.properties is correct.")
270
- }
271
-
272
- existingFiles.forEach { existingFile ->
273
- def generatedFile = new File("${absoluteCodegenArtifactsSource}/${existingFile.name}")
274
-
275
- if (!generatedFile.exists()) {
276
- logger.warn("[react-native-gesture-handler] ${existingFile.name} file does not exist in codegen artifacts source destination. Please check if you still need this interface/delagete.")
277
- }
278
- }
279
-
280
- copy {
281
- from absoluteCodegenArtifactsSource
282
- include existingFiles.collect { it.name }
283
- into absoluteCodegenArtifactsPaperDestination
284
- }
285
- }
286
- }
287
-
288
- if (isGHExampleApp() && isNewArchitectureEnabled() && !project.hasProperty('skipCodegenCopyTask')) {
289
- tasks.generateCodegenArtifactsFromSchema.finalizedBy('copyCodegenArtifacts')
290
- }
291
-
292
- tasks.register('checkIntegrityBetweenArchitectures') {
293
- group 'Verification tasks'
294
- description 'Task to check integrity between fabric and paper architecture in terms of codegen generated interfaces/delegates'
295
-
296
- if (isGHExampleApp()) {
297
- return
298
- }
299
-
300
- def absoluteCodegenArtifactsPaperDestination = "../${project.property('codegenArtifactsPaperDestination')}"
301
- def absoluteCodegenArtifactsSource = "../${project.property('codegenArtifactsSource')}"
302
-
303
- def existingFiles = fileTree(absoluteCodegenArtifactsPaperDestination).matching {
304
- include '**/*.java'
305
- }
306
-
307
- existingFiles.forEach { existingFile ->
308
- def generatedFile = new File("${absoluteCodegenArtifactsSource}/${existingFile.name}")
309
-
310
- if (existingFile.text != generatedFile.text) {
311
- throw new RuntimeException("[react-native-gesture-handler] The source of ${existingFile.name} does not match with the one generated by codegen. Please check if you commited changes produced by copyCodegenArtifacts task.")
312
- }
313
- }
314
- }
@@ -17,10 +17,3 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemor
17
17
  # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
18
  # org.gradle.parallel=true
19
19
  RNGH_kotlinVersion=1.6.21
20
-
21
- # Path to codegen output directory with this library view managers' interfaces & delegates. Used by `copyCodegenArtifacts` task that helps to synchronize newly generated files with their Paper counterparts.
22
- codegenArtifactsSource=android/build/generated/source/codegen/java/com/facebook/react/viewmanagers
23
-
24
- # Path to directory with view managers' interfaces & delegates used while running on Paper architecture. This property is used as the output path for `copyCodegenArtifacts` task.
25
- # Used by copyCodegenArtifacts task that automates copying those interfaces/delegates after codegen is run.
26
- codegenArtifactsPaperDestination=android/paper/src/main/java/com/facebook/react/viewmanagers
@@ -1,15 +1,27 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
1
13
  package com.swmansion.gesturehandler;
2
14
 
3
15
  import com.facebook.proguard.annotations.DoNotStrip;
4
16
  import com.facebook.react.bridge.ReactApplicationContext;
5
17
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
6
18
  import com.facebook.react.bridge.ReactMethod;
19
+ import com.facebook.react.bridge.ReactModuleWithSpec;
7
20
  import com.facebook.react.bridge.ReadableMap;
8
21
  import com.facebook.react.turbomodule.core.interfaces.TurboModule;
9
22
  import javax.annotation.Nonnull;
10
- import com.facebook.react.bridge.ReactMethod;
11
23
 
12
- public abstract class NativeRNGestureHandlerModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
24
+ public abstract class NativeRNGestureHandlerModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule {
13
25
  public static final String NAME = "RNGestureHandlerModule";
14
26
 
15
27
  public NativeRNGestureHandlerModuleSpec(ReactApplicationContext reactContext) {
@@ -21,35 +33,35 @@ public abstract class NativeRNGestureHandlerModuleSpec extends ReactContextBaseJ
21
33
  return NAME;
22
34
  }
23
35
 
24
- @DoNotStrip
25
36
  @ReactMethod
37
+ @DoNotStrip
26
38
  public abstract void handleSetJSResponder(double tag, boolean blockNativeResponder);
27
39
 
28
- @DoNotStrip
29
40
  @ReactMethod
41
+ @DoNotStrip
30
42
  public abstract void handleClearJSResponder();
31
43
 
32
- @DoNotStrip
33
44
  @ReactMethod
45
+ @DoNotStrip
34
46
  public abstract void createGestureHandler(String handlerName, double handlerTag, ReadableMap config);
35
47
 
36
- @DoNotStrip
37
48
  @ReactMethod
49
+ @DoNotStrip
38
50
  public abstract void attachGestureHandler(double handlerTag, double newView, double actionType);
39
51
 
40
- @DoNotStrip
41
52
  @ReactMethod
53
+ @DoNotStrip
42
54
  public abstract void updateGestureHandler(double handlerTag, ReadableMap newConfig);
43
55
 
44
- @DoNotStrip
45
56
  @ReactMethod
57
+ @DoNotStrip
46
58
  public abstract void dropGestureHandler(double handlerTag);
47
59
 
60
+ @ReactMethod(isBlockingSynchronousMethod = true)
48
61
  @DoNotStrip
49
- @ReactMethod
50
62
  public abstract boolean install();
51
63
 
52
- @DoNotStrip
53
64
  @ReactMethod
65
+ @DoNotStrip
54
66
  public abstract void flushOperations();
55
67
  }
@@ -615,7 +615,7 @@ class GestureHandlerOrchestrator(
615
615
  private val matrixTransformCoords = FloatArray(2)
616
616
  private val inverseMatrix = Matrix()
617
617
  private val tempCoords = FloatArray(2)
618
- private val handlersComparator = Comparator<GestureHandler<*>?> { a, b ->
618
+ private val handlersComparator = Comparator<GestureHandler<*>> { a, b ->
619
619
  return@Comparator if (a.isActive && b.isActive || a.isAwaiting && b.isAwaiting) {
620
620
  // both A and B are either active or awaiting activation, in which case we prefer one that
621
621
  // has activated (or turned into "awaiting" state) earlier
@@ -9,6 +9,8 @@ import android.widget.ScrollView
9
9
  import com.facebook.react.views.scroll.ReactScrollView
10
10
  import com.facebook.react.views.swiperefresh.ReactSwipeRefreshLayout
11
11
  import com.facebook.react.views.textinput.ReactEditText
12
+ import com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager
13
+ import com.swmansion.gesturehandler.react.isScreenReaderOn
12
14
 
13
15
  class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
14
16
  private var shouldActivateOnStart = false
@@ -82,6 +84,17 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
82
84
 
83
85
  override fun onHandle(event: MotionEvent, sourceEvent: MotionEvent) {
84
86
  val view = view!!
87
+
88
+ val isTouchExplorationEnabled = view.context.isScreenReaderOn()
89
+
90
+ if (view is RNGestureHandlerButtonViewManager.ButtonViewGroup && isTouchExplorationEnabled) {
91
+ // Fix for: https://github.com/software-mansion/react-native-gesture-handler/issues/2808
92
+ // When TalkBack is enabled, events are often not being sent to the orchestrator for processing.
93
+ // Instead, states will be changed directly by an alternative mechanism added in this PR:
94
+ // https://github.com/software-mansion/react-native-gesture-handler/pull/2234
95
+ return
96
+ }
97
+
85
98
  if (event.actionMasked == MotionEvent.ACTION_UP) {
86
99
  if (state == STATE_UNDETERMINED && !hook.canBegin(event)) {
87
100
  cancel()
@@ -106,13 +119,16 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
106
119
  view.onTouchEvent(event)
107
120
  activate()
108
121
  }
122
+
109
123
  tryIntercept(view, event) -> {
110
124
  view.onTouchEvent(event)
111
125
  activate()
112
126
  }
127
+
113
128
  hook.wantsToHandleEventBeforeActivation() -> {
114
129
  hook.handleEventBeforeActivation(event)
115
130
  }
131
+
116
132
  state != STATE_BEGAN -> {
117
133
  if (hook.canBegin(event)) {
118
134
  begin()
@@ -70,14 +70,13 @@ class PinchGestureHandler : GestureHandler<PinchGestureHandler>() {
70
70
  this.focalPointX = point.x
71
71
  this.focalPointY = point.y
72
72
  }
73
- var activePointers = sourceEvent.pointerCount
74
- if (sourceEvent.actionMasked == MotionEvent.ACTION_POINTER_UP) {
75
- activePointers -= 1
76
- }
77
- if (state == STATE_ACTIVE && activePointers < 2) {
78
- end()
79
- } else if (sourceEvent.actionMasked == MotionEvent.ACTION_UP) {
80
- fail()
73
+
74
+ if (sourceEvent.actionMasked == MotionEvent.ACTION_UP) {
75
+ if (state == STATE_ACTIVE) {
76
+ end()
77
+ } else {
78
+ fail()
79
+ }
81
80
  }
82
81
  }
83
82
 
@@ -111,11 +111,21 @@ class RotationGestureDetector(private val gestureListener: OnRotationGestureList
111
111
  updateCurrent(event)
112
112
  gestureListener?.onRotation(this)
113
113
  }
114
- MotionEvent.ACTION_POINTER_UP -> if (isInProgress) {
114
+ MotionEvent.ACTION_POINTER_UP -> {
115
115
  val pointerId = event.getPointerId(event.actionIndex)
116
- if (pointerId == pointerIds[0] || pointerId == pointerIds[1]) {
117
- // One of the key pointer has been lifted up, we have to end the gesture
118
- finish()
116
+
117
+ // All key pointers are up
118
+ if (!isInProgress && pointerId == pointerIds[0]) {
119
+ gestureListener?.onRotationEnd(this)
120
+ }
121
+
122
+ // One of the key pointers is up
123
+ if (isInProgress && pointerIds.contains(pointerId)) {
124
+ if (pointerId == pointerIds[0]) {
125
+ pointerIds[0] = pointerIds[1]
126
+ }
127
+ pointerIds[1] = MotionEvent.INVALID_POINTER_ID
128
+ isInProgress = false
119
129
  }
120
130
  }
121
131
  MotionEvent.ACTION_UP -> finish()
@@ -9,6 +9,7 @@ package com.swmansion.gesturehandler.react
9
9
  import androidx.core.util.Pools
10
10
  import com.facebook.react.bridge.Arguments
11
11
  import com.facebook.react.bridge.WritableMap
12
+ import com.facebook.react.uimanager.UIManagerHelper
12
13
  import com.facebook.react.uimanager.events.Event
13
14
  import com.swmansion.gesturehandler.core.GestureHandler
14
15
  import com.swmansion.gesturehandler.react.eventbuilders.GestureHandlerEventDataBuilder
@@ -29,7 +30,8 @@ class RNGestureHandlerEvent private constructor() : Event<RNGestureHandlerEvent>
29
30
  dataBuilder: GestureHandlerEventDataBuilder<T>,
30
31
  useNativeAnimatedName: Boolean
31
32
  ) {
32
- super.init(handler.view!!.id)
33
+ val view = handler.view!!
34
+ super.init(UIManagerHelper.getSurfaceId(view), view.id)
33
35
  this.dataBuilder = dataBuilder
34
36
  this.useTopPrefixedName = useNativeAnimatedName
35
37
  coalescingKey = handler.eventCoalescingKey
@@ -9,6 +9,7 @@ package com.swmansion.gesturehandler.react
9
9
  import androidx.core.util.Pools
10
10
  import com.facebook.react.bridge.Arguments
11
11
  import com.facebook.react.bridge.WritableMap
12
+ import com.facebook.react.uimanager.UIManagerHelper
12
13
  import com.facebook.react.uimanager.events.Event
13
14
  import com.swmansion.gesturehandler.core.GestureHandler
14
15
  import com.swmansion.gesturehandler.react.eventbuilders.GestureHandlerEventDataBuilder
@@ -24,7 +25,8 @@ class RNGestureHandlerStateChangeEvent private constructor() : Event<RNGestureHa
24
25
  oldState: Int,
25
26
  dataBuilder: GestureHandlerEventDataBuilder<T>,
26
27
  ) {
27
- super.init(handler.view!!.id)
28
+ val view = handler.view!!
29
+ super.init(UIManagerHelper.getSurfaceId(view), view.id)
28
30
  this.dataBuilder = dataBuilder
29
31
  this.newState = newState
30
32
  this.oldState = oldState
@@ -11,7 +11,8 @@ class RNGestureHandlerTouchEvent private constructor() : Event<RNGestureHandlerT
11
11
  private var extraData: WritableMap? = null
12
12
  private var coalescingKey: Short = 0
13
13
  private fun <T : GestureHandler<T>> init(handler: T) {
14
- super.init(UIManagerHelper.getSurfaceId(handler.view), handler.view!!.id)
14
+ val view = handler.view!!
15
+ super.init(UIManagerHelper.getSurfaceId(view), view.id)
15
16
  extraData = createEventData(handler)
16
17
  coalescingKey = handler.eventCoalescingKey
17
18
  }
@@ -4,6 +4,8 @@ import android.view.View
4
4
  import android.view.ViewGroup
5
5
  import com.facebook.react.uimanager.PointerEvents
6
6
  import com.facebook.react.uimanager.ReactPointerEventsView
7
+ import com.facebook.react.views.scroll.ReactHorizontalScrollView
8
+ import com.facebook.react.views.scroll.ReactScrollView
7
9
  import com.facebook.react.views.view.ReactViewGroup
8
10
  import com.swmansion.gesturehandler.core.PointerEventsConfig
9
11
  import com.swmansion.gesturehandler.core.ViewConfigurationHelper
@@ -40,12 +42,11 @@ class RNViewConfigurationHelper : ViewConfigurationHelper {
40
42
  } else parent.getChildAt(index)
41
43
  }
42
44
 
43
- override fun isViewClippingChildren(view: ViewGroup): Boolean {
44
- if (view.clipChildren) {
45
- return true
46
- }
47
- return if (view is ReactViewGroup) {
48
- "hidden" == view.overflow
49
- } else false
45
+ override fun isViewClippingChildren(view: ViewGroup) = when {
46
+ view.clipChildren -> true
47
+ view is ReactScrollView -> view.overflow != "visible"
48
+ view is ReactHorizontalScrollView -> view.overflow != "visible"
49
+ view is ReactViewGroup -> view.overflow == "hidden"
50
+ else -> false
50
51
  }
51
52
  }
@@ -18,9 +18,11 @@ void decorateRuntime(jsi::Runtime &runtime) {
18
18
  if (!arguments[0].isObject()) {
19
19
  return jsi::Value::null();
20
20
  }
21
- auto shadowNode = arguments[0]
22
- .asObject(runtime).getNativeState<ShadowNode>(runtime);
23
- bool isFormsStackingContext = shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);
21
+
22
+ auto shadowNodeWrapper = arguments[0]
23
+ .asObject(runtime).getNativeState<ShadowNodeWrapper>(runtime);
24
+ bool isFormsStackingContext = shadowNodeWrapper->shadowNode->getTraits()
25
+ .check(ShadowNodeTraits::FormsStackingContext);
24
26
 
25
27
  return jsi::Value(isFormsStackingContext);
26
28
  });
@@ -60,6 +60,7 @@
60
60
  _lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
61
61
  [super touchesCancelled:touches withEvent:event];
62
62
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
63
+ [self reset];
63
64
  }
64
65
 
65
66
  - (void)triggerAction
@@ -115,6 +115,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
115
115
  {
116
116
  [super touchesCancelled:touches withEvent:event];
117
117
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
118
+ [self reset];
118
119
  }
119
120
 
120
121
  - (void)handleForceWithTouches:(NSSet<RNGHUITouch *> *)touches
@@ -184,6 +185,7 @@ static const BOOL defaultFeedbackOnActivation = NO;
184
185
 
185
186
  - (instancetype)initWithTag:(NSNumber *)tag
186
187
  {
188
+ RCTLogWarn(@"ForceTouchHandler is not supported on macOS");
187
189
  if ((self = [super initWithTag:tag])) {
188
190
  _recognizer = [NSGestureRecognizer alloc];
189
191
  }
@@ -75,7 +75,7 @@
75
75
  CGPoint trans = [self translationInView];
76
76
  if ((_gestureHandler.shouldCancelWhenOutside && ![_gestureHandler containsPointInView]) ||
77
77
  (TEST_MAX_IF_NOT_NAN(
78
- fabs(trans.y * trans.y + trans.x + trans.x), self.allowableMovement * self.allowableMovement))) {
78
+ fabs(trans.y * trans.y + trans.x * trans.x), self.allowableMovement * self.allowableMovement))) {
79
79
  self.enabled = NO;
80
80
  self.enabled = YES;
81
81
  }
@@ -91,6 +91,7 @@
91
91
  {
92
92
  [super touchesCancelled:touches withEvent:event];
93
93
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
94
+ [self reset];
94
95
  }
95
96
 
96
97
  - (void)reset
@@ -57,6 +57,7 @@
57
57
  {
58
58
  [super touchesCancelled:touches withEvent:event];
59
59
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
60
+ [self reset];
60
61
  }
61
62
 
62
63
  - (void)reset
@@ -21,8 +21,6 @@
21
21
  #import <React/RCTScrollView.h>
22
22
  #endif // RCT_NEW_ARCH_ENABLED
23
23
 
24
- #if !TARGET_OS_OSX
25
-
26
24
  #pragma mark RNDummyGestureRecognizer
27
25
 
28
26
  @implementation RNDummyGestureRecognizer {
@@ -37,6 +35,7 @@
37
35
  return self;
38
36
  }
39
37
 
38
+ #if !TARGET_OS_OSX
40
39
  - (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
41
40
  {
42
41
  [_gestureHandler setCurrentPointerType:event];
@@ -62,6 +61,30 @@
62
61
  [self reset];
63
62
  }
64
63
 
64
+ #else
65
+ - (void)mouseDown:(NSEvent *)event
66
+ {
67
+ [_gestureHandler setCurrentPointerTypeToMouse];
68
+
69
+ self.state = NSGestureRecognizerStateBegan;
70
+ [_gestureHandler.pointerTracker touchesBegan:[NSSet setWithObject:event] withEvent:event];
71
+ }
72
+
73
+ - (void)mouseDragged:(NSEvent *)event
74
+ {
75
+ self.state = NSGestureRecognizerStateChanged;
76
+ [_gestureHandler.pointerTracker touchesMoved:[NSSet setWithObject:event] withEvent:event];
77
+ }
78
+
79
+ - (void)mouseUp:(NSEvent *)event
80
+ {
81
+ self.state = NSGestureRecognizerStateEnded;
82
+ [_gestureHandler.pointerTracker touchesEnded:[NSSet setWithObject:event] withEvent:event];
83
+ [self reset];
84
+ }
85
+
86
+ #endif
87
+
65
88
  - (void)reset
66
89
  {
67
90
  [_gestureHandler.pointerTracker reset];
@@ -93,6 +116,8 @@
93
116
  _disallowInterruption = [RCTConvert BOOL:config[@"disallowInterruption"]];
94
117
  }
95
118
 
119
+ #if !TARGET_OS_OSX
120
+
96
121
  - (void)bindToView:(UIView *)view
97
122
  {
98
123
  // For UIControl based views (UIButton, UISwitch) we provide special handling that would allow
@@ -197,35 +222,14 @@
197
222
  withExtraData:[RNGestureHandlerEventExtraData forPointerInside:NO withPointerType:_pointerType]];
198
223
  }
199
224
 
200
- @end
201
-
202
225
  #else
203
226
 
204
- #pragma mark RNDummyGestureRecognizer
205
-
206
- @implementation RNDummyGestureRecognizer
207
-
208
- - (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
227
+ - (RNGestureHandlerEventExtraData *)eventExtraData:(RNDummyGestureRecognizer *)recognizer
209
228
  {
210
- self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)];
211
- return self;
229
+ return [RNGestureHandlerEventExtraData forPointerInside:[self containsPointInView]
230
+ withPointerType:RNGestureHandlerMouse];
212
231
  }
213
232
 
214
- @end
215
-
216
- #pragma mark RNNativeViewGestureHandler
217
-
218
- @implementation RNNativeViewGestureHandler
219
-
220
- - (instancetype)initWithTag:(NSNumber *)tag
221
- {
222
- RCTLogWarn(@"NativeViewGestureHandler is not supported on macOS");
223
- if ((self = [super initWithTag:tag])) {
224
- _recognizer = [NSGestureRecognizer alloc];
225
- }
226
- return self;
227
- }
233
+ #endif
228
234
 
229
235
  @end
230
-
231
- #endif
@@ -161,6 +161,7 @@
161
161
  - (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event
162
162
  {
163
163
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
164
+ [self reset];
164
165
  }
165
166
 
166
167
  #if TARGET_OS_OSX
@@ -73,6 +73,7 @@
73
73
  - (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event
74
74
  {
75
75
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
76
+ [self reset];
76
77
  }
77
78
 
78
79
  #if TARGET_OS_OSX
@@ -67,6 +67,7 @@
67
67
  - (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event
68
68
  {
69
69
  [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
70
+ [self reset];
70
71
  }
71
72
 
72
73
  #if TARGET_OS_OSX
@@ -206,6 +206,7 @@ static const NSTimeInterval defaultMaxDuration = 0.5;
206
206
  {
207
207
  [super touchesCancelled:touches withEvent:event];
208
208
  [self interactionsCancelled:touches withEvent:event];
209
+ [self reset];
209
210
  }
210
211
 
211
212
  #endif
@@ -99,9 +99,10 @@ void decorateRuntime(jsi::Runtime &runtime)
99
99
  if (!arguments[0].isObject()) {
100
100
  return jsi::Value::null();
101
101
  }
102
- auto shadowNode = arguments[0].asObject(runtime).getNativeState<ShadowNode>(runtime);
103
- bool isFormsStackingContext = shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);
104
102
 
103
+ auto shadowNodeWrapper = arguments[0].asObject(runtime).getNativeState<ShadowNodeWrapper>(runtime);
104
+ bool isFormsStackingContext =
105
+ shadowNodeWrapper->shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);
105
106
  return jsi::Value(isFormsStackingContext);
106
107
  });
107
108
  runtime.global().setProperty(runtime, "isFormsStackingContext", std::move(isFormsStackingContext));
@@ -113,6 +113,11 @@
113
113
  {
114
114
  [super rightMouseDown:event];
115
115
  [self interactionsBegan:[NSSet setWithObject:event] withEvent:event];
116
+
117
+ // This line fixes issue in which handlers couldn't react to mouse clicks after right click.
118
+ // Right click opens context menu, which prevents RootView from receiving rightMouseUp. This leads
119
+ // to a situation where RootView is left in Possible state, instead of Failed, thus blocking other handlers.
120
+ self.state = NSGestureRecognizerStateFailed;
116
121
  }
117
122
 
118
123
  - (void)mouseDragged:(NSEvent *)event
@@ -7,14 +7,14 @@ exports.DiagonalDirections = exports.Directions = void 0;
7
7
  const RIGHT = 1;
8
8
  const LEFT = 2;
9
9
  const UP = 4;
10
- const DOWN = 8; // public interface
10
+ const DOWN = 8; // Public interface
11
11
 
12
12
  const Directions = {
13
13
  RIGHT: RIGHT,
14
14
  LEFT: LEFT,
15
15
  UP: UP,
16
16
  DOWN: DOWN
17
- }; // internal interface
17
+ }; // Internal interface
18
18
 
19
19
  exports.Directions = Directions;
20
20
  const DiagonalDirections = {
@@ -1 +1 @@
1
- {"version":3,"sources":["Directions.ts"],"names":["RIGHT","LEFT","UP","DOWN","Directions","DiagonalDirections","UP_RIGHT","DOWN_RIGHT","UP_LEFT","DOWN_LEFT"],"mappings":";;;;;;AAAA,MAAMA,KAAK,GAAG,CAAd;AACA,MAAMC,IAAI,GAAG,CAAb;AACA,MAAMC,EAAE,GAAG,CAAX;AACA,MAAMC,IAAI,GAAG,CAAb,C,CAEA;;AACO,MAAMC,UAAU,GAAG;AACxBJ,EAAAA,KAAK,EAAEA,KADiB;AAExBC,EAAAA,IAAI,EAAEA,IAFkB;AAGxBC,EAAAA,EAAE,EAAEA,EAHoB;AAIxBC,EAAAA,IAAI,EAAEA;AAJkB,CAAnB,C,CAOP;;;AACO,MAAME,kBAAkB,GAAG;AAChCC,EAAAA,QAAQ,EAAEJ,EAAE,GAAGF,KADiB;AAEhCO,EAAAA,UAAU,EAAEJ,IAAI,GAAGH,KAFa;AAGhCQ,EAAAA,OAAO,EAAEN,EAAE,GAAGD,IAHkB;AAIhCQ,EAAAA,SAAS,EAAEN,IAAI,GAAGF;AAJc,CAA3B,C,CAOP","sourcesContent":["const RIGHT = 1;\nconst LEFT = 2;\nconst UP = 4;\nconst DOWN = 8;\n\n// public interface\nexport const Directions = {\n RIGHT: RIGHT,\n LEFT: LEFT,\n UP: UP,\n DOWN: DOWN,\n} as const;\n\n// internal interface\nexport const DiagonalDirections = {\n UP_RIGHT: UP | RIGHT,\n DOWN_RIGHT: DOWN | RIGHT,\n UP_LEFT: UP | LEFT,\n DOWN_LEFT: DOWN | LEFT,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type Directions = typeof Directions[keyof typeof Directions];\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DiagonalDirections =\n typeof DiagonalDirections[keyof typeof DiagonalDirections];\n"]}
1
+ {"version":3,"sources":["Directions.ts"],"names":["RIGHT","LEFT","UP","DOWN","Directions","DiagonalDirections","UP_RIGHT","DOWN_RIGHT","UP_LEFT","DOWN_LEFT"],"mappings":";;;;;;AAAA,MAAMA,KAAK,GAAG,CAAd;AACA,MAAMC,IAAI,GAAG,CAAb;AACA,MAAMC,EAAE,GAAG,CAAX;AACA,MAAMC,IAAI,GAAG,CAAb,C,CAEA;;AACO,MAAMC,UAAU,GAAG;AACxBJ,EAAAA,KAAK,EAAEA,KADiB;AAExBC,EAAAA,IAAI,EAAEA,IAFkB;AAGxBC,EAAAA,EAAE,EAAEA,EAHoB;AAIxBC,EAAAA,IAAI,EAAEA;AAJkB,CAAnB,C,CAOP;;;AACO,MAAME,kBAAkB,GAAG;AAChCC,EAAAA,QAAQ,EAAEJ,EAAE,GAAGF,KADiB;AAEhCO,EAAAA,UAAU,EAAEJ,IAAI,GAAGH,KAFa;AAGhCQ,EAAAA,OAAO,EAAEN,EAAE,GAAGD,IAHkB;AAIhCQ,EAAAA,SAAS,EAAEN,IAAI,GAAGF;AAJc,CAA3B,C,CAOP","sourcesContent":["const RIGHT = 1;\nconst LEFT = 2;\nconst UP = 4;\nconst DOWN = 8;\n\n// Public interface\nexport const Directions = {\n RIGHT: RIGHT,\n LEFT: LEFT,\n UP: UP,\n DOWN: DOWN,\n} as const;\n\n// Internal interface\nexport const DiagonalDirections = {\n UP_RIGHT: UP | RIGHT,\n DOWN_RIGHT: DOWN | RIGHT,\n UP_LEFT: UP | LEFT,\n DOWN_LEFT: DOWN | LEFT,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type Directions = typeof Directions[keyof typeof Directions];\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DiagonalDirections =\n typeof DiagonalDirections[keyof typeof DiagonalDirections];\n"]}
@@ -67,10 +67,10 @@ var _default = {
67
67
  }
68
68
 
69
69
  if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
70
- //@ts-ignore Types should be HTMLElement or React.Component
70
+ // @ts-ignore Types should be HTMLElement or React.Component
71
71
  _NodeManager.default.getHandler(handlerTag).init(newView, propsRef);
72
72
  } else {
73
- //@ts-ignore Types should be HTMLElement or React.Component
73
+ // @ts-ignore Types should be HTMLElement or React.Component
74
74
  HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
75
75
  }
76
76
  },