react-native-gesture-handler 2.17.1 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (428) hide show
  1. package/ReanimatedSwipeable/package.json +6 -0
  2. package/android/build.gradle +0 -103
  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
@@ -29,8 +29,8 @@ export class ComposedGesture extends Gesture {
29
29
  if (gesture instanceof BaseGesture) {
30
30
  const newConfig = { ...gesture.config };
31
31
 
32
- // no need to extend `blocksHandlers` here, because it's not changed in composition
33
- // the same effect is achieved by reversing the order of 2 gestures in `Exclusive`
32
+ // No need to extend `blocksHandlers` here, because it's not changed in composition.
33
+ // The same effect is achieved by reversing the order of 2 gestures in `Exclusive`
34
34
  newConfig.simultaneousWith = extendRelation(
35
35
  newConfig.simultaneousWith,
36
36
  simultaneousGestures
@@ -71,7 +71,7 @@ export class ComposedGesture extends Gesture {
71
71
 
72
72
  export class SimultaneousGesture extends ComposedGesture {
73
73
  prepare() {
74
- // this piece of magic works something like this:
74
+ // This piece of magic works something like this:
75
75
  // for every gesture in the array
76
76
  const simultaneousArrays = this.gestures.map((gesture) =>
77
77
  // we take the array it's in
@@ -97,7 +97,7 @@ export class SimultaneousGesture extends ComposedGesture {
97
97
 
98
98
  export class ExclusiveGesture extends ComposedGesture {
99
99
  prepare() {
100
- // transforms the array of gestures into array of grouped raw (not composed) gestures
100
+ // Transforms the array of gestures into array of grouped raw (not composed) gestures
101
101
  // i.e. [gesture1, gesture2, ComposedGesture(gesture3, gesture4)] -> [[gesture1], [gesture2], [gesture3, gesture4]]
102
102
  const gestureArrays = this.gestures.map((gesture) =>
103
103
  gesture.toGestureArray()
@@ -112,7 +112,7 @@ export class ExclusiveGesture extends ComposedGesture {
112
112
  this.requireGesturesToFail.concat(requireToFail)
113
113
  );
114
114
 
115
- // every group gets to wait for all groups before it
115
+ // Every group gets to wait for all groups before it
116
116
  requireToFail = requireToFail.concat(gestureArrays[i]);
117
117
  }
118
118
  }
@@ -13,7 +13,7 @@ const warningMessage = tagMessage(
13
13
  'react-native-reanimated is required in order to use synchronous state management'
14
14
  );
15
15
 
16
- // check if reanimated module is available, but look for useSharedValue as conditional
16
+ // Check if reanimated module is available, but look for useSharedValue as conditional
17
17
  // require of reanimated can sometimes return content of `utils.ts` file (?)
18
18
  const REANIMATED_AVAILABLE = Reanimated?.useSharedValue !== undefined;
19
19
  const setGestureState = Reanimated?.setGestureState;
@@ -1,8 +1,6 @@
1
1
  import { BaseGesture, BaseGestureConfig } from './gesture';
2
- import {
3
- LongPressGestureConfig,
4
- LongPressGestureHandlerEventPayload,
5
- } from '../LongPressGestureHandler';
2
+ import { LongPressGestureConfig } from '../LongPressGestureHandler';
3
+ import type { LongPressGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
6
4
 
7
5
  export class LongPressGesture extends BaseGesture<LongPressGestureHandlerEventPayload> {
8
6
  public config: BaseGestureConfig & LongPressGestureConfig = {};
@@ -1,8 +1,6 @@
1
1
  import { BaseGestureConfig, BaseGesture } from './gesture';
2
- import {
3
- NativeViewGestureConfig,
4
- NativeViewGestureHandlerPayload,
5
- } from '../NativeViewGestureHandler';
2
+ import { NativeViewGestureConfig } from '../NativeViewGestureHandler';
3
+ import type { NativeViewGestureHandlerPayload } from '../GestureHandlerEventPayload';
6
4
 
7
5
  export class NativeGesture extends BaseGesture<NativeViewGestureHandlerPayload> {
8
6
  public config: BaseGestureConfig & NativeViewGestureConfig = {};
@@ -1,9 +1,7 @@
1
1
  import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
2
2
  import { GestureUpdateEvent } from '../gestureHandlerCommon';
3
- import {
4
- PanGestureConfig,
5
- PanGestureHandlerEventPayload,
6
- } from '../PanGestureHandler';
3
+ import { PanGestureConfig } from '../PanGestureHandler';
4
+ import type { PanGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
7
5
 
8
6
  export type PanGestureChangeEventPayload = {
9
7
  changeX: number;
@@ -1,5 +1,5 @@
1
1
  import { ContinousBaseGesture } from './gesture';
2
- import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';
2
+ import type { PinchGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
3
3
  import { GestureUpdateEvent } from '../gestureHandlerCommon';
4
4
 
5
5
  export type PinchGestureChangeEventPayload = {
@@ -1,5 +1,5 @@
1
1
  import { ContinousBaseGesture } from './gesture';
2
- import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
2
+ import type { RotationGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
3
3
  import { GestureUpdateEvent } from '../gestureHandlerCommon';
4
4
 
5
5
  type RotationGestureChangeEventPayload = {
@@ -1,8 +1,6 @@
1
1
  import { BaseGestureConfig, BaseGesture } from './gesture';
2
- import {
3
- TapGestureConfig,
4
- TapGestureHandlerEventPayload,
5
- } from '../TapGestureHandler';
2
+ import { TapGestureConfig } from '../TapGestureHandler';
3
+ import type { TapGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
6
4
 
7
5
  export class TapGesture extends BaseGesture<TapGestureHandlerEventPayload> {
8
6
  public config: BaseGestureConfig & TapGestureConfig = {};
@@ -0,0 +1,5 @@
1
+ let handlerTag = 1;
2
+
3
+ export function getNextHandlerTag(): number {
4
+ return handlerTag++;
5
+ }
@@ -7,12 +7,6 @@ const gestures = new Map<number, GestureType>();
7
7
  const oldHandlers = new Map<number, GestureHandlerCallbacks>();
8
8
  const testIDs = new Map<string, number>();
9
9
 
10
- let handlerTag = 1;
11
-
12
- export function getNextHandlerTag(): number {
13
- return handlerTag++;
14
- }
15
-
16
10
  export function registerHandler(
17
11
  handlerTag: number,
18
12
  handler: GestureType,
@@ -0,0 +1,75 @@
1
+ import * as React from 'react';
2
+ import { Platform, findNodeHandle as findNodeHandleRN } from 'react-native';
3
+ import { handlerIDToTag } from './handlersRegistry';
4
+ import { toArray } from '../utils';
5
+ import RNGestureHandlerModule from '../RNGestureHandlerModule';
6
+ import { ghQueueMicrotask } from '../ghQueueMicrotask';
7
+
8
+ function isConfigParam(param: unknown, name: string) {
9
+ // param !== Object(param) returns false if `param` is a function
10
+ // or an object and returns true if `param` is null
11
+ return (
12
+ param !== undefined &&
13
+ (param !== Object(param) ||
14
+ !('__isNative' in (param as Record<string, unknown>))) &&
15
+ name !== 'onHandlerStateChange' &&
16
+ name !== 'onGestureEvent'
17
+ );
18
+ }
19
+
20
+ export function filterConfig(
21
+ props: Record<string, unknown>,
22
+ validProps: string[],
23
+ defaults: Record<string, unknown> = {}
24
+ ) {
25
+ const filteredConfig = { ...defaults };
26
+ for (const key of validProps) {
27
+ let value = props[key];
28
+ if (isConfigParam(value, key)) {
29
+ if (key === 'simultaneousHandlers' || key === 'waitFor') {
30
+ value = transformIntoHandlerTags(props[key]);
31
+ } else if (key === 'hitSlop' && typeof value !== 'object') {
32
+ value = { top: value, left: value, bottom: value, right: value };
33
+ }
34
+ filteredConfig[key] = value;
35
+ }
36
+ }
37
+ return filteredConfig;
38
+ }
39
+ function transformIntoHandlerTags(handlerIDs: any) {
40
+ handlerIDs = toArray(handlerIDs);
41
+
42
+ if (Platform.OS === 'web') {
43
+ return handlerIDs
44
+ .map(({ current }: { current: any }) => current)
45
+ .filter((handle: any) => handle);
46
+ }
47
+ // converts handler string IDs into their numeric tags
48
+ return handlerIDs
49
+ .map(
50
+ (handlerID: any) =>
51
+ handlerIDToTag[handlerID] || handlerID.current?.handlerTag || -1
52
+ )
53
+ .filter((handlerTag: number) => handlerTag > 0);
54
+ }
55
+
56
+ export function findNodeHandle(
57
+ node: null | number | React.Component<any, any> | React.ComponentClass<any>
58
+ ): null | number | React.Component<any, any> | React.ComponentClass<any> {
59
+ if (Platform.OS === 'web') {
60
+ return node;
61
+ }
62
+ return findNodeHandleRN(node);
63
+ }
64
+ let flushOperationsScheduled = false;
65
+
66
+ export function scheduleFlushOperations() {
67
+ if (!flushOperationsScheduled) {
68
+ flushOperationsScheduled = true;
69
+ ghQueueMicrotask(() => {
70
+ RNGestureHandlerModule.flushOperations();
71
+
72
+ flushOperationsScheduled = false;
73
+ });
74
+ }
75
+ }
package/src/index.ts CHANGED
@@ -6,16 +6,16 @@ export { PointerType } from './PointerType';
6
6
  export { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';
7
7
  export { default as GestureHandlerRootView } from './components/GestureHandlerRootView';
8
8
  export type {
9
- // event types
9
+ // Event types
10
10
  GestureEvent,
11
11
  HandlerStateChangeEvent,
12
- // event payloads types
12
+ // Event payloads types
13
13
  GestureEventPayload,
14
14
  HandlerStateChangeEventPayload,
15
- // pointer events
15
+ // Pointer events
16
16
  GestureTouchEvent,
17
17
  TouchData,
18
- // new api event types
18
+ // New api event types
19
19
  GestureUpdateEvent,
20
20
  GestureStateChangeEvent,
21
21
  } from './handlers/gestureHandlerCommon';
@@ -23,35 +23,24 @@ export { MouseButton } from './handlers/gestureHandlerCommon';
23
23
  export type { GestureType } from './handlers/gestures/gesture';
24
24
  export type {
25
25
  TapGestureHandlerEventPayload,
26
- TapGestureHandlerProps,
27
- } from './handlers/TapGestureHandler';
28
- export type {
29
26
  ForceTouchGestureHandlerEventPayload,
30
- ForceTouchGestureHandlerProps,
31
- } from './handlers/ForceTouchGestureHandler';
32
- export type { ForceTouchGestureChangeEventPayload } from './handlers/gestures/forceTouchGesture';
33
- export type {
34
27
  LongPressGestureHandlerEventPayload,
35
- LongPressGestureHandlerProps,
36
- } from './handlers/LongPressGestureHandler';
37
- export type {
38
28
  PanGestureHandlerEventPayload,
39
- PanGestureHandlerProps,
40
- } from './handlers/PanGestureHandler';
41
- export type { PanGestureChangeEventPayload } from './handlers/gestures/panGesture';
42
- export type {
43
29
  PinchGestureHandlerEventPayload,
44
- PinchGestureHandlerProps,
45
- } from './handlers/PinchGestureHandler';
46
- export type { PinchGestureChangeEventPayload } from './handlers/gestures/pinchGesture';
47
- export type {
48
30
  RotationGestureHandlerEventPayload,
49
- RotationGestureHandlerProps,
50
- } from './handlers/RotationGestureHandler';
51
- export type {
31
+ NativeViewGestureHandlerPayload,
52
32
  FlingGestureHandlerEventPayload,
53
- FlingGestureHandlerProps,
54
- } from './handlers/FlingGestureHandler';
33
+ } from './handlers/GestureHandlerEventPayload';
34
+ export type { TapGestureHandlerProps } from './handlers/TapGestureHandler';
35
+ export type { ForceTouchGestureHandlerProps } from './handlers/ForceTouchGestureHandler';
36
+ export type { ForceTouchGestureChangeEventPayload } from './handlers/gestures/forceTouchGesture';
37
+ export type { LongPressGestureHandlerProps } from './handlers/LongPressGestureHandler';
38
+ export type { PanGestureHandlerProps } from './handlers/PanGestureHandler';
39
+ export type { PanGestureChangeEventPayload } from './handlers/gestures/panGesture';
40
+ export type { PinchGestureHandlerProps } from './handlers/PinchGestureHandler';
41
+ export type { PinchGestureChangeEventPayload } from './handlers/gestures/pinchGesture';
42
+ export type { RotationGestureHandlerProps } from './handlers/RotationGestureHandler';
43
+ export type { FlingGestureHandlerProps } from './handlers/FlingGestureHandler';
55
44
  export { TapGestureHandler } from './handlers/TapGestureHandler';
56
45
  export { ForceTouchGestureHandler } from './handlers/ForceTouchGestureHandler';
57
46
  export { LongPressGestureHandler } from './handlers/LongPressGestureHandler';
@@ -60,10 +49,7 @@ export { PinchGestureHandler } from './handlers/PinchGestureHandler';
60
49
  export { RotationGestureHandler } from './handlers/RotationGestureHandler';
61
50
  export { FlingGestureHandler } from './handlers/FlingGestureHandler';
62
51
  export { default as createNativeWrapper } from './handlers/createNativeWrapper';
63
- export type {
64
- NativeViewGestureHandlerPayload,
65
- NativeViewGestureHandlerProps,
66
- } from './handlers/NativeViewGestureHandler';
52
+ export type { NativeViewGestureHandlerProps } from './handlers/NativeViewGestureHandler';
67
53
  export { GestureDetector } from './handlers/gestures/GestureDetector';
68
54
  export { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';
69
55
  export type { TapGestureType as TapGesture } from './handlers/gestures/tapGesture';
@@ -89,7 +75,7 @@ export type {
89
75
  BaseButtonProps,
90
76
  RectButtonProps,
91
77
  BorderlessButtonProps,
92
- } from './components/GestureButtons';
78
+ } from './components/GestureButtonsProps';
93
79
  export {
94
80
  RawButton,
95
81
  BaseButton,
@@ -118,10 +104,10 @@ export {
118
104
  } from './components/GestureComponents';
119
105
  export { HoverEffect } from './handlers/gestures/hoverGesture';
120
106
  export type {
121
- //events
107
+ // Events
122
108
  GestureHandlerGestureEvent,
123
109
  GestureHandlerStateChangeEvent,
124
- //event payloads
110
+ // Event payloads
125
111
  GestureHandlerGestureEventNativeEvent,
126
112
  GestureHandlerStateChangeNativeEvent,
127
113
  NativeViewGestureHandlerGestureEvent,
@@ -140,7 +126,7 @@ export type {
140
126
  RotationGestureHandlerStateChangeEvent,
141
127
  FlingGestureHandlerGestureEvent,
142
128
  FlingGestureHandlerStateChangeEvent,
143
- // handlers props
129
+ // Handlers props
144
130
  NativeViewGestureHandlerProperties,
145
131
  TapGestureHandlerProperties,
146
132
  LongPressGestureHandlerProperties,
@@ -149,7 +135,7 @@ export type {
149
135
  RotationGestureHandlerProperties,
150
136
  FlingGestureHandlerProperties,
151
137
  ForceTouchGestureHandlerProperties,
152
- // buttons props
138
+ // Buttons props
153
139
  RawButtonProperties,
154
140
  BaseButtonProperties,
155
141
  RectButtonProperties,
@@ -158,6 +144,9 @@ export type {
158
144
 
159
145
  export type { SwipeableProps } from './components/Swipeable';
160
146
  export { default as Swipeable } from './components/Swipeable';
147
+ export type { PressableProps } from './components/Pressable';
148
+ export { default as Pressable } from './components/Pressable';
149
+
161
150
  export type {
162
151
  DrawerLayoutProps,
163
152
  DrawerPosition,
package/src/init.ts CHANGED
@@ -8,7 +8,7 @@ export function initialize() {
8
8
  startListening();
9
9
  }
10
10
 
11
- // since isFabric() may give wrong results before the first render, we call this
11
+ // Since isFabric() may give wrong results before the first render, we call this
12
12
  // method during render of GestureHandlerRootView
13
13
  export function maybeInitializeFabric() {
14
14
  if (isFabric() && !fabricInitialized) {
@@ -3,12 +3,10 @@ import { DeviceEventEmitter } from 'react-native';
3
3
  import { ReactTestInstance } from 'react-test-renderer';
4
4
  import {
5
5
  FlingGestureHandler,
6
- FlingGestureHandlerEventPayload,
7
6
  flingHandlerName,
8
7
  } from '../handlers/FlingGestureHandler';
9
8
  import {
10
9
  ForceTouchGestureHandler,
11
- ForceTouchGestureHandlerEventPayload,
12
10
  forceTouchHandlerName,
13
11
  } from '../handlers/ForceTouchGestureHandler';
14
12
  import {
@@ -28,38 +26,42 @@ import { TapGesture } from '../handlers/gestures/tapGesture';
28
26
  import { findHandlerByTestID } from '../handlers/handlersRegistry';
29
27
  import {
30
28
  LongPressGestureHandler,
31
- LongPressGestureHandlerEventPayload,
32
29
  longPressHandlerName,
33
30
  } from '../handlers/LongPressGestureHandler';
31
+ import type {
32
+ FlingGestureHandlerEventPayload,
33
+ ForceTouchGestureHandlerEventPayload,
34
+ LongPressGestureHandlerEventPayload,
35
+ NativeViewGestureHandlerPayload,
36
+ PanGestureHandlerEventPayload,
37
+ PinchGestureHandlerEventPayload,
38
+ RotationGestureHandlerEventPayload,
39
+ TapGestureHandlerEventPayload,
40
+ } from '../handlers/GestureHandlerEventPayload';
34
41
  import {
35
42
  NativeViewGestureHandler,
36
- NativeViewGestureHandlerPayload,
37
43
  nativeViewHandlerName,
38
44
  } from '../handlers/NativeViewGestureHandler';
39
45
  import {
40
46
  PanGestureHandler,
41
- PanGestureHandlerEventPayload,
42
47
  panHandlerName,
43
48
  } from '../handlers/PanGestureHandler';
44
49
  import {
45
50
  PinchGestureHandler,
46
- PinchGestureHandlerEventPayload,
47
51
  pinchHandlerName,
48
52
  } from '../handlers/PinchGestureHandler';
49
53
  import {
50
54
  RotationGestureHandler,
51
- RotationGestureHandlerEventPayload,
52
55
  rotationHandlerName,
53
56
  } from '../handlers/RotationGestureHandler';
54
57
  import {
55
58
  TapGestureHandler,
56
- TapGestureHandlerEventPayload,
57
59
  tapHandlerName,
58
60
  } from '../handlers/TapGestureHandler';
59
61
  import { State } from '../State';
60
62
  import { hasProperty, withPrevAndCurrent } from '../utils';
61
63
 
62
- // load fireEvent conditionally, so RNGH may be used in setups without testing-library
64
+ // Load fireEvent conditionally, so RNGH may be used in setups without testing-library
63
65
  let fireEvent = (
64
66
  _element: ReactTestInstance,
65
67
  _name: string,
@@ -72,7 +74,7 @@ try {
72
74
  // eslint-disable-next-line @typescript-eslint/no-var-requires
73
75
  fireEvent = require('@testing-library/react-native').fireEvent;
74
76
  } catch (_e) {
75
- // do nothing if not available
77
+ // Do nothing if not available
76
78
  }
77
79
 
78
80
  type GestureHandlerTestEvent<
package/src/mocks.ts CHANGED
@@ -14,7 +14,7 @@ import { State } from './State';
14
14
  import { Directions } from './Directions';
15
15
 
16
16
  const NOOP = () => {
17
- // do nothing
17
+ // Do nothing
18
18
  };
19
19
  const PanGestureHandler = View;
20
20
  const attachGestureHandler = NOOP;
@@ -63,7 +63,7 @@ export default {
63
63
  updateGestureHandler,
64
64
  flushOperations,
65
65
  install,
66
- // probably can be removed
66
+ // Probably can be removed
67
67
  Directions,
68
68
  State,
69
69
  } as const;
package/src/utils.ts CHANGED
@@ -43,7 +43,7 @@ export function tagMessage(msg: string) {
43
43
  return `[react-native-gesture-handler] ${msg}`;
44
44
  }
45
45
 
46
- // helper method to check whether Fabric is enabled, however global.nativeFabricUIManager
46
+ // Helper method to check whether Fabric is enabled, however global.nativeFabricUIManager
47
47
  // may not be initialized before the first render
48
48
  export function isFabric(): boolean {
49
49
  // @ts-expect-error nativeFabricUIManager is not yet included in the RN types
@@ -9,7 +9,7 @@ import NativeViewGestureHandler from './handlers/NativeViewGestureHandler';
9
9
  import ManualGestureHandler from './handlers/ManualGestureHandler';
10
10
  import HoverGestureHandler from './handlers/HoverGestureHandler';
11
11
 
12
- //Hammer Handlers
12
+ // Hammer Handlers
13
13
  import HammerNativeViewGestureHandler from '../web_hammer/NativeViewGestureHandler';
14
14
  import HammerPanGestureHandler from '../web_hammer/PanGestureHandler';
15
15
  import HammerTapGestureHandler from '../web_hammer/TapGestureHandler';
@@ -48,7 +48,7 @@ export default class RotationGestureDetector
48
48
  this.anchorX = (firstPointerCoords.x + secondPointerCoords.x) / 2;
49
49
  this.anchorY = (firstPointerCoords.y + secondPointerCoords.y) / 2;
50
50
 
51
- //Angle diff should be positive when rotating in clockwise direction
51
+ // Angle diff should be positive when rotating in clockwise direction
52
52
  const angle: number = -Math.atan2(vectorY, vectorX);
53
53
 
54
54
  this.rotation = Number.isNaN(this.previousAngle)
@@ -72,7 +72,7 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
72
72
  ? event.pointerId
73
73
  : undefined;
74
74
 
75
- //Determine focal point
75
+ // Determine focal point
76
76
 
77
77
  const div: number = pointerUp ? numOfPointers - 1 : numOfPointers;
78
78
 
@@ -81,7 +81,7 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
81
81
  const focusX = coordsSum.x / div;
82
82
  const focusY = coordsSum.y / div;
83
83
 
84
- //Determine average deviation from focal point
84
+ // Determine average deviation from focal point
85
85
 
86
86
  let devSumX = 0;
87
87
  let devSumY = 0;
@@ -103,7 +103,7 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
103
103
 
104
104
  const span = Math.hypot(spanX, spanY);
105
105
 
106
- //Begin/end events
106
+ // Begin/end events
107
107
  const wasInProgress: boolean = this.inProgress;
108
108
  this.focusX = focusX;
109
109
  this.focusY = focusY;
@@ -128,7 +128,7 @@ export default class ScaleGestureDetector implements ScaleGestureListener {
128
128
  this.inProgress = this.onScaleBegin(this);
129
129
  }
130
130
 
131
- //Handle motion
131
+ // Handle motion
132
132
  if (action !== EventTypes.MOVE) {
133
133
  return true;
134
134
  }
@@ -69,7 +69,7 @@ export default class FlingGestureHandler extends GestureHandler {
69
69
  const axialDirectionsList = Object.values(Directions);
70
70
  const diagonalDirectionsList = Object.values(DiagonalDirections);
71
71
 
72
- // list of alignments to all activated directions
72
+ // List of alignments to all activated directions
73
73
  const axialAlignmentList = axialDirectionsList.map((direction) =>
74
74
  getAlignment(direction, AXIAL_DEVIATION_COSINE)
75
75
  );
@@ -333,10 +333,10 @@ export default abstract class GestureHandler implements IGestureHandler {
333
333
  this.tryToSendMoveEvent(true, event);
334
334
  }
335
335
  protected onPointerMoveOver(_event: AdaptedEvent): void {
336
- // used only by hover gesture handler atm
336
+ // Used only by hover gesture handler atm
337
337
  }
338
338
  protected onPointerMoveOut(_event: AdaptedEvent): void {
339
- // used only by hover gesture handler atm
339
+ // Used only by hover gesture handler atm
340
340
  }
341
341
  private tryToSendMoveEvent(out: boolean, event: AdaptedEvent): void {
342
342
  if ((out && this.shouldCancelWhenOutside) || !this.enabled) {
@@ -569,7 +569,7 @@ export default abstract class GestureHandler implements IGestureHandler {
569
569
  }
570
570
 
571
571
  protected transformNativeEvent(): Record<string, unknown> {
572
- // those properties are shared by most handlers and if not this method will be overriden
572
+ // Those properties are shared by most handlers and if not this method will be overriden
573
573
  const lastCoords = this.tracker.getAbsoluteCoordsAverage();
574
574
  const lastRelativeCoords = this.tracker.getRelativeCoordsAverage();
575
575
 
@@ -726,15 +726,9 @@ export default abstract class GestureHandler implements IGestureHandler {
726
726
  const offsetX: number = x - rect.pageX;
727
727
  const offsetY: number = y - rect.pageY;
728
728
 
729
- if (
730
- offsetX >= left &&
731
- offsetX <= right &&
732
- offsetY >= top &&
733
- offsetY <= bottom
734
- ) {
735
- return true;
736
- }
737
- return false;
729
+ return (
730
+ offsetX >= left && offsetX <= right && offsetY >= top && offsetY <= bottom
731
+ );
738
732
  }
739
733
 
740
734
  public isButtonInConfig(mouseButton: MouseButton | undefined) {
@@ -849,11 +843,11 @@ function invokeNullableMethod(
849
843
 
850
844
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
851
845
  if (value?.setValue) {
852
- //Reanimated API
846
+ // Reanimated API
853
847
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
854
848
  value.setValue(nativeValue);
855
849
  } else {
856
- //RN Animated API
850
+ // RN Animated API
857
851
  method.__nodeConfig.argMapping[index] = [key, nativeValue];
858
852
  }
859
853
  }
@@ -7,8 +7,8 @@ import GestureHandler from './GestureHandler';
7
7
  export default class NativeViewGestureHandler extends GestureHandler {
8
8
  private buttonRole!: boolean;
9
9
 
10
- //TODO: Implement logic for activation on start
11
- //@ts-ignore Logic yet to be implemented
10
+ // TODO: Implement logic for activation on start
11
+ // @ts-ignore Logic yet to be implemented
12
12
  private shouldActivateOnStart = false;
13
13
  private disallowInterruption = false;
14
14
 
@@ -28,7 +28,7 @@ export default class NativeViewGestureHandler extends GestureHandler {
28
28
  const view = this.delegate.getView() as HTMLElement;
29
29
 
30
30
  view.style['touchAction'] = 'auto';
31
- //@ts-ignore Turns on defualt touch behavior on Safari
31
+ // @ts-ignore Turns on defualt touch behavior on Safari
32
32
  view.style['WebkitTouchCallout'] = 'auto';
33
33
 
34
34
  this.buttonRole = view.getAttribute('role') === 'button';
@@ -210,7 +210,7 @@ export default class PanGestureHandler extends GestureHandler {
210
210
  clearTimeout(this.activationTimeout);
211
211
  }
212
212
 
213
- //EventsHandling
213
+ // Events Handling
214
214
  protected onPointerDown(event: AdaptedEvent): void {
215
215
  if (!this.isButtonInConfig(event.button)) {
216
216
  return;
@@ -103,7 +103,7 @@ export default class TapGestureHandler extends GestureHandler {
103
103
  }
104
104
  }
105
105
 
106
- //Handling Events
106
+ // Handling Events
107
107
  protected onPointerDown(event: AdaptedEvent): void {
108
108
  if (!this.isButtonInConfig(event.button)) {
109
109
  return;
@@ -28,8 +28,8 @@ export default abstract class EventManager<T> {
28
28
  protected onPointerUp(_event: AdaptedEvent): void {}
29
29
  protected onPointerRemove(_event: AdaptedEvent): void {}
30
30
  protected onPointerMove(_event: AdaptedEvent): void {}
31
- protected onPointerLeave(_event: AdaptedEvent): void {} // called only when pointer is pressed (or touching)
32
- protected onPointerEnter(_event: AdaptedEvent): void {} // called only when pointer is pressed (or touching)
31
+ protected onPointerLeave(_event: AdaptedEvent): void {} // Called only when pointer is pressed (or touching)
32
+ protected onPointerEnter(_event: AdaptedEvent): void {} // Called only when pointer is pressed (or touching)
33
33
  protected onPointerCancel(_event: AdaptedEvent): void {
34
34
  // When pointer cancel is triggered and there are more pointers on the view, only one pointer is cancelled
35
35
  // Because we want all pointers to be cancelled by that event, we are doing it manually by reseting handler and changing activePointersCounter to 0
@@ -37,16 +37,11 @@ export class GestureHandlerWebDelegate
37
37
 
38
38
  this.addContextMenuListeners(config);
39
39
 
40
- if (!config.userSelect) {
41
- this.view.style['webkitUserSelect'] = 'none';
42
- this.view.style['userSelect'] = 'none';
43
- } else {
44
- this.view.style['webkitUserSelect'] = config.userSelect;
45
- this.view.style['userSelect'] = config.userSelect;
46
- }
40
+ this.view.style['userSelect'] = config.userSelect ?? 'none';
41
+ this.view.style['webkitUserSelect'] = config.userSelect ?? 'none';
47
42
 
48
43
  this.view.style['touchAction'] = config.touchAction ?? 'none';
49
- //@ts-ignore This one disables default events on Safari
44
+ // @ts-ignore This one disables default events on Safari
50
45
  this.view.style['WebkitTouchCallout'] = 'none';
51
46
 
52
47
  this.eventManagers.push(new PointerEventManager(this.view));