react-native-gesture-handler 2.16.1 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (369) hide show
  1. package/README.md +9 -3
  2. package/android/build.gradle +105 -0
  3. package/android/gradle.properties +7 -0
  4. package/android/paper/src/main/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +7 -7
  5. package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +16 -8
  6. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +9 -5
  7. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +4 -0
  8. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +1 -1
  9. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +1 -0
  10. package/apple/RNGestureHandlerButtonComponentView.mm +10 -0
  11. package/apple/RNGestureHandlerModule.mm +2 -3
  12. package/lib/commonjs/RNGestureHandlerModule.js +4 -97
  13. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  14. package/lib/commonjs/RNGestureHandlerModule.web.js +109 -0
  15. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
  16. package/lib/commonjs/RNRenderer.js +10 -5
  17. package/lib/commonjs/RNRenderer.js.map +1 -1
  18. package/lib/commonjs/RNRenderer.web.js +11 -0
  19. package/lib/commonjs/RNRenderer.web.js.map +1 -0
  20. package/lib/commonjs/components/GestureButtons.js +27 -12
  21. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  22. package/lib/commonjs/components/GestureComponents.js +82 -19
  23. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  24. package/lib/commonjs/components/GestureComponents.web.js +52 -0
  25. package/lib/commonjs/components/GestureComponents.web.js.map +1 -0
  26. package/lib/commonjs/components/GestureHandlerButton.js +3 -13
  27. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
  28. package/lib/commonjs/components/GestureHandlerButton.web.js +24 -0
  29. package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -0
  30. package/lib/commonjs/components/GestureHandlerRootView.js +6 -0
  31. package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
  32. package/lib/commonjs/components/{GestureHandlerRootView.native.js → GestureHandlerRootView.web.js} +1 -7
  33. package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
  34. package/lib/commonjs/getReactNativeVersion.js +12 -1
  35. package/lib/commonjs/getReactNativeVersion.js.map +1 -1
  36. package/lib/commonjs/getReactNativeVersion.web.js +11 -0
  37. package/lib/commonjs/getReactNativeVersion.web.js.map +1 -0
  38. package/lib/commonjs/getShadowNodeFromRef.js +34 -5
  39. package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
  40. package/lib/commonjs/getShadowNodeFromRef.web.js +15 -0
  41. package/lib/commonjs/getShadowNodeFromRef.web.js.map +1 -0
  42. package/lib/commonjs/handlers/PressabilityDebugView.js +7 -5
  43. package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
  44. package/lib/commonjs/handlers/PressabilityDebugView.web.js +12 -0
  45. package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -0
  46. package/lib/commonjs/handlers/createHandler.js +1 -3
  47. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  48. package/lib/commonjs/handlers/customDirectEventTypes.js +8 -5
  49. package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
  50. package/lib/commonjs/handlers/customDirectEventTypes.web.js +11 -0
  51. package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +1 -0
  52. package/lib/commonjs/handlers/gestureHandlerCommon.js +3 -3
  53. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  54. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js +42 -0
  55. package/lib/commonjs/handlers/gestures/GestureDetector/Wrap.js.map +1 -0
  56. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js +83 -0
  57. package/lib/commonjs/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -0
  58. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js +25 -0
  59. package/lib/commonjs/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -0
  60. package/lib/commonjs/handlers/gestures/GestureDetector/index.js +143 -0
  61. package/lib/commonjs/handlers/gestures/GestureDetector/index.js.map +1 -0
  62. package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js +25 -0
  63. package/lib/commonjs/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -0
  64. package/lib/commonjs/handlers/gestures/GestureDetector/types.js +6 -0
  65. package/lib/commonjs/handlers/gestures/GestureDetector/types.js.map +1 -0
  66. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js +80 -0
  67. package/lib/commonjs/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -0
  68. package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js +180 -0
  69. package/lib/commonjs/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -0
  70. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js +55 -0
  71. package/lib/commonjs/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -0
  72. package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js +47 -0
  73. package/lib/commonjs/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -0
  74. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +176 -0
  75. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -0
  76. package/lib/commonjs/handlers/gestures/gestureComposition.js +3 -1
  77. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -1
  78. package/lib/commonjs/handlers/gestures/gestureStateManager.js +8 -0
  79. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
  80. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
  81. package/lib/commonjs/utils.js +36 -0
  82. package/lib/commonjs/utils.js.map +1 -1
  83. package/lib/commonjs/web/detectors/RotationGestureDetector.js +6 -8
  84. package/lib/commonjs/web/detectors/RotationGestureDetector.js.map +1 -1
  85. package/lib/commonjs/web/detectors/ScaleGestureDetector.js +5 -6
  86. package/lib/commonjs/web/detectors/ScaleGestureDetector.js.map +1 -1
  87. package/lib/commonjs/web/handlers/FlingGestureHandler.js +1 -0
  88. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  89. package/lib/commonjs/web/handlers/GestureHandler.js +56 -64
  90. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  91. package/lib/commonjs/web/handlers/LongPressGestureHandler.js +1 -0
  92. package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
  93. package/lib/commonjs/web/handlers/ManualGestureHandler.js +1 -0
  94. package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
  95. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +7 -4
  96. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  97. package/lib/commonjs/web/handlers/PanGestureHandler.js +28 -18
  98. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  99. package/lib/commonjs/web/handlers/PinchGestureHandler.js +1 -0
  100. package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
  101. package/lib/commonjs/web/handlers/RotationGestureHandler.js +1 -0
  102. package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
  103. package/lib/commonjs/web/handlers/TapGestureHandler.js +18 -12
  104. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  105. package/lib/commonjs/web/interfaces.js.map +1 -1
  106. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +1 -6
  107. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  108. package/lib/commonjs/web/tools/PointerEventManager.js +7 -2
  109. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  110. package/lib/commonjs/web/tools/PointerTracker.js +89 -57
  111. package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
  112. package/lib/commonjs/web/tools/TouchEventManager.js +6 -2
  113. package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
  114. package/lib/commonjs/web/tools/Vector.js +2 -1
  115. package/lib/commonjs/web/tools/Vector.js.map +1 -1
  116. package/lib/commonjs/web/utils.js +31 -0
  117. package/lib/commonjs/web/utils.js.map +1 -1
  118. package/lib/module/RNGestureHandlerModule.js +4 -84
  119. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  120. package/lib/module/RNGestureHandlerModule.web.js +85 -0
  121. package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
  122. package/lib/module/RNRenderer.js +3 -3
  123. package/lib/module/RNRenderer.js.map +1 -1
  124. package/lib/module/RNRenderer.web.js +4 -0
  125. package/lib/module/RNRenderer.web.js.map +1 -0
  126. package/lib/module/components/GestureButtons.js +24 -6
  127. package/lib/module/components/GestureButtons.js.map +1 -1
  128. package/lib/module/components/GestureComponents.js +80 -18
  129. package/lib/module/components/GestureComponents.js.map +1 -1
  130. package/lib/module/components/GestureComponents.web.js +28 -0
  131. package/lib/module/components/GestureComponents.web.js.map +1 -0
  132. package/lib/module/components/GestureHandlerButton.js +2 -8
  133. package/lib/module/components/GestureHandlerButton.js.map +1 -1
  134. package/lib/module/components/GestureHandlerButton.web.js +9 -0
  135. package/lib/module/components/GestureHandlerButton.web.js.map +1 -0
  136. package/lib/module/components/GestureHandlerRootView.js +5 -0
  137. package/lib/module/components/GestureHandlerRootView.js.map +1 -1
  138. package/lib/module/components/{GestureHandlerRootView.native.js → GestureHandlerRootView.web.js} +1 -6
  139. package/lib/module/components/GestureHandlerRootView.web.js.map +1 -0
  140. package/lib/module/getReactNativeVersion.js +7 -1
  141. package/lib/module/getReactNativeVersion.js.map +1 -1
  142. package/lib/module/getReactNativeVersion.web.js +4 -0
  143. package/lib/module/getReactNativeVersion.web.js.map +1 -0
  144. package/lib/module/getShadowNodeFromRef.js +33 -4
  145. package/lib/module/getShadowNodeFromRef.js.map +1 -1
  146. package/lib/module/getShadowNodeFromRef.web.js +8 -0
  147. package/lib/module/getShadowNodeFromRef.web.js.map +1 -0
  148. package/lib/module/handlers/PressabilityDebugView.js +2 -4
  149. package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
  150. package/lib/module/handlers/PressabilityDebugView.web.js +5 -0
  151. package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -0
  152. package/lib/module/handlers/createHandler.js +2 -4
  153. package/lib/module/handlers/createHandler.js.map +1 -1
  154. package/lib/module/handlers/customDirectEventTypes.js +2 -4
  155. package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
  156. package/lib/module/handlers/customDirectEventTypes.web.js +5 -0
  157. package/lib/module/handlers/customDirectEventTypes.web.js.map +1 -0
  158. package/lib/module/handlers/gestureHandlerCommon.js +1 -1
  159. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  160. package/lib/module/handlers/gestures/GestureDetector/Wrap.js +26 -0
  161. package/lib/module/handlers/gestures/GestureDetector/Wrap.js.map +1 -0
  162. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js +65 -0
  163. package/lib/module/handlers/gestures/GestureDetector/attachHandlers.js.map +1 -0
  164. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js +12 -0
  165. package/lib/module/handlers/gestures/GestureDetector/dropHandlers.js.map +1 -0
  166. package/lib/module/handlers/gestures/GestureDetector/index.js +115 -0
  167. package/lib/module/handlers/gestures/GestureDetector/index.js.map +1 -0
  168. package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js +18 -0
  169. package/lib/module/handlers/gestures/GestureDetector/needsToReattach.js.map +1 -0
  170. package/lib/module/handlers/gestures/GestureDetector/types.js +2 -0
  171. package/lib/module/handlers/gestures/GestureDetector/types.js.map +1 -0
  172. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js +64 -0
  173. package/lib/module/handlers/gestures/GestureDetector/updateHandlers.js.map +1 -0
  174. package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js +165 -0
  175. package/lib/module/handlers/gestures/GestureDetector/useAnimatedGesture.js.map +1 -0
  176. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js +41 -0
  177. package/lib/module/handlers/gestures/GestureDetector/useDetectorUpdater.js.map +1 -0
  178. package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js +36 -0
  179. package/lib/module/handlers/gestures/GestureDetector/useViewRefHandler.js.map +1 -0
  180. package/lib/module/handlers/gestures/GestureDetector/utils.js +142 -0
  181. package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -0
  182. package/lib/module/handlers/gestures/gestureComposition.js +3 -1
  183. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -1
  184. package/lib/module/handlers/gestures/gestureStateManager.js +8 -0
  185. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
  186. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
  187. package/lib/module/utils.js +34 -0
  188. package/lib/module/utils.js.map +1 -1
  189. package/lib/module/web/detectors/RotationGestureDetector.js +6 -8
  190. package/lib/module/web/detectors/RotationGestureDetector.js.map +1 -1
  191. package/lib/module/web/detectors/ScaleGestureDetector.js +5 -6
  192. package/lib/module/web/detectors/ScaleGestureDetector.js.map +1 -1
  193. package/lib/module/web/handlers/FlingGestureHandler.js +1 -0
  194. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  195. package/lib/module/web/handlers/GestureHandler.js +56 -64
  196. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  197. package/lib/module/web/handlers/LongPressGestureHandler.js +1 -0
  198. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
  199. package/lib/module/web/handlers/ManualGestureHandler.js +1 -0
  200. package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
  201. package/lib/module/web/handlers/NativeViewGestureHandler.js +7 -4
  202. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  203. package/lib/module/web/handlers/PanGestureHandler.js +28 -18
  204. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  205. package/lib/module/web/handlers/PinchGestureHandler.js +1 -0
  206. package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
  207. package/lib/module/web/handlers/RotationGestureHandler.js +1 -0
  208. package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
  209. package/lib/module/web/handlers/TapGestureHandler.js +18 -12
  210. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  211. package/lib/module/web/interfaces.js.map +1 -1
  212. package/lib/module/web/tools/GestureHandlerOrchestrator.js +1 -6
  213. package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  214. package/lib/module/web/tools/PointerEventManager.js +8 -3
  215. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  216. package/lib/module/web/tools/PointerTracker.js +89 -57
  217. package/lib/module/web/tools/PointerTracker.js.map +1 -1
  218. package/lib/module/web/tools/TouchEventManager.js +7 -3
  219. package/lib/module/web/tools/TouchEventManager.js.map +1 -1
  220. package/lib/module/web/tools/Vector.js +2 -1
  221. package/lib/module/web/tools/Vector.js.map +1 -1
  222. package/lib/module/web/utils.js +29 -0
  223. package/lib/module/web/utils.js.map +1 -1
  224. package/lib/typescript/RNGestureHandlerModule.d.ts +2 -15
  225. package/lib/typescript/RNGestureHandlerModule.web.d.ts +15 -0
  226. package/lib/typescript/RNRenderer.d.ts +1 -3
  227. package/lib/typescript/RNRenderer.web.d.ts +3 -0
  228. package/lib/typescript/components/GestureButtons.d.ts +3 -34
  229. package/lib/typescript/components/GestureComponents.d.ts +21 -7
  230. package/lib/typescript/components/GestureComponents.web.d.ts +8 -0
  231. package/lib/typescript/components/GestureHandlerButton.d.ts +3 -3
  232. package/lib/typescript/components/GestureHandlerButton.web.d.ts +4 -0
  233. package/lib/typescript/getReactNativeVersion.d.ts +4 -1
  234. package/lib/typescript/getReactNativeVersion.web.d.ts +1 -0
  235. package/lib/typescript/getShadowNodeFromRef.d.ts +1 -1
  236. package/lib/typescript/getShadowNodeFromRef.web.d.ts +1 -0
  237. package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -1
  238. package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
  239. package/lib/typescript/handlers/customDirectEventTypes.d.ts +1 -2
  240. package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +2 -0
  241. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +3 -2
  242. package/lib/typescript/handlers/gestures/GestureDetector/Wrap.d.ts +13 -0
  243. package/lib/typescript/handlers/gestures/GestureDetector/attachHandlers.d.ts +13 -0
  244. package/lib/typescript/handlers/gestures/GestureDetector/dropHandlers.d.ts +2 -0
  245. package/lib/typescript/handlers/gestures/{GestureDetector.d.ts → GestureDetector/index.d.ts} +4 -12
  246. package/lib/typescript/handlers/gestures/GestureDetector/needsToReattach.d.ts +3 -0
  247. package/lib/typescript/handlers/gestures/GestureDetector/types.d.ts +20 -0
  248. package/lib/typescript/handlers/gestures/GestureDetector/updateHandlers.d.ts +4 -0
  249. package/lib/typescript/handlers/gestures/GestureDetector/useAnimatedGesture.d.ts +2 -0
  250. package/lib/typescript/handlers/gestures/GestureDetector/useDetectorUpdater.d.ts +5 -0
  251. package/lib/typescript/handlers/gestures/GestureDetector/useViewRefHandler.d.ts +3 -0
  252. package/lib/typescript/handlers/gestures/GestureDetector/utils.d.ts +12 -0
  253. package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +1 -1
  254. package/lib/typescript/utils.d.ts +10 -0
  255. package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -0
  256. package/lib/typescript/web/interfaces.d.ts +1 -0
  257. package/lib/typescript/web/tools/PointerTracker.d.ts +34 -31
  258. package/lib/typescript/web/utils.d.ts +4 -0
  259. package/package.json +5 -5
  260. package/src/RNGestureHandlerModule.ts +4 -104
  261. package/src/RNGestureHandlerModule.web.ts +105 -0
  262. package/src/RNRenderer.ts +3 -3
  263. package/src/RNRenderer.web.ts +3 -0
  264. package/src/components/GestureButtons.tsx +36 -4
  265. package/src/components/GestureComponents.tsx +131 -24
  266. package/src/components/GestureComponents.web.tsx +41 -0
  267. package/src/components/GestureHandlerButton.tsx +4 -5
  268. package/src/components/GestureHandlerButton.web.tsx +6 -0
  269. package/src/components/GestureHandlerRootView.tsx +6 -0
  270. package/src/components/{GestureHandlerRootView.native.tsx → GestureHandlerRootView.web.tsx} +0 -6
  271. package/src/getReactNativeVersion.ts +9 -1
  272. package/src/getReactNativeVersion.web.ts +3 -0
  273. package/src/getShadowNodeFromRef.ts +41 -4
  274. package/src/getShadowNodeFromRef.web.ts +7 -0
  275. package/src/handlers/PressabilityDebugView.tsx +2 -4
  276. package/src/handlers/PressabilityDebugView.web.tsx +4 -0
  277. package/src/handlers/createHandler.tsx +1 -3
  278. package/src/handlers/customDirectEventTypes.ts +2 -5
  279. package/src/handlers/customDirectEventTypes.web.ts +5 -0
  280. package/src/handlers/gestureHandlerCommon.ts +4 -1
  281. package/src/handlers/gestures/GestureDetector/Wrap.tsx +35 -0
  282. package/src/handlers/gestures/GestureDetector/attachHandlers.ts +112 -0
  283. package/src/handlers/gestures/GestureDetector/dropHandlers.ts +14 -0
  284. package/src/handlers/gestures/GestureDetector/index.tsx +187 -0
  285. package/src/handlers/gestures/GestureDetector/needsToReattach.ts +27 -0
  286. package/src/handlers/gestures/GestureDetector/types.ts +32 -0
  287. package/src/handlers/gestures/GestureDetector/updateHandlers.ts +94 -0
  288. package/src/handlers/gestures/GestureDetector/useAnimatedGesture.ts +206 -0
  289. package/src/handlers/gestures/GestureDetector/useDetectorUpdater.ts +69 -0
  290. package/src/handlers/gestures/GestureDetector/useViewRefHandler.ts +54 -0
  291. package/src/handlers/gestures/GestureDetector/utils.ts +185 -0
  292. package/src/handlers/gestures/gestureComposition.ts +2 -0
  293. package/src/handlers/gestures/gestureStateManager.ts +12 -4
  294. package/src/handlers/gestures/reanimatedWrapper.ts +19 -17
  295. package/src/utils.ts +39 -0
  296. package/src/web/detectors/RotationGestureDetector.ts +6 -8
  297. package/src/web/detectors/ScaleGestureDetector.ts +5 -6
  298. package/src/web/handlers/FlingGestureHandler.ts +2 -0
  299. package/src/web/handlers/GestureHandler.ts +53 -62
  300. package/src/web/handlers/LongPressGestureHandler.ts +2 -0
  301. package/src/web/handlers/ManualGestureHandler.ts +2 -0
  302. package/src/web/handlers/NativeViewGestureHandler.ts +8 -4
  303. package/src/web/handlers/PanGestureHandler.ts +32 -19
  304. package/src/web/handlers/PinchGestureHandler.ts +2 -0
  305. package/src/web/handlers/RotationGestureHandler.ts +2 -0
  306. package/src/web/handlers/TapGestureHandler.ts +20 -12
  307. package/src/web/interfaces.ts +1 -0
  308. package/src/web/tools/GestureHandlerOrchestrator.ts +1 -7
  309. package/src/web/tools/PointerEventManager.ts +10 -3
  310. package/src/web/tools/PointerTracker.ts +81 -74
  311. package/src/web/tools/TouchEventManager.ts +5 -3
  312. package/src/web/tools/Vector.ts +2 -4
  313. package/src/web/utils.ts +34 -0
  314. package/lib/commonjs/RNGestureHandlerModule.native.js +0 -16
  315. package/lib/commonjs/RNGestureHandlerModule.native.js.map +0 -1
  316. package/lib/commonjs/RNRenderer.native.js +0 -16
  317. package/lib/commonjs/RNRenderer.native.js.map +0 -1
  318. package/lib/commonjs/components/GestureComponents.native.js +0 -115
  319. package/lib/commonjs/components/GestureComponents.native.js.map +0 -1
  320. package/lib/commonjs/components/GestureHandlerButton.native.js +0 -14
  321. package/lib/commonjs/components/GestureHandlerButton.native.js.map +0 -1
  322. package/lib/commonjs/components/GestureHandlerRootView.native.js.map +0 -1
  323. package/lib/commonjs/getReactNativeVersion.native.js +0 -22
  324. package/lib/commonjs/getReactNativeVersion.native.js.map +0 -1
  325. package/lib/commonjs/getShadowNodeFromRef.native.js +0 -44
  326. package/lib/commonjs/getShadowNodeFromRef.native.js.map +0 -1
  327. package/lib/commonjs/handlers/PressabilityDebugView.native.js +0 -14
  328. package/lib/commonjs/handlers/PressabilityDebugView.native.js.map +0 -1
  329. package/lib/commonjs/handlers/customDirectEventTypes.native.js +0 -14
  330. package/lib/commonjs/handlers/customDirectEventTypes.native.js.map +0 -1
  331. package/lib/commonjs/handlers/gestures/GestureDetector.js +0 -704
  332. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +0 -1
  333. package/lib/module/RNGestureHandlerModule.native.js +0 -5
  334. package/lib/module/RNGestureHandlerModule.native.js.map +0 -1
  335. package/lib/module/RNRenderer.native.js +0 -4
  336. package/lib/module/RNRenderer.native.js.map +0 -1
  337. package/lib/module/components/GestureComponents.native.js +0 -90
  338. package/lib/module/components/GestureComponents.native.js.map +0 -1
  339. package/lib/module/components/GestureHandlerButton.native.js +0 -3
  340. package/lib/module/components/GestureHandlerButton.native.js.map +0 -1
  341. package/lib/module/components/GestureHandlerRootView.native.js.map +0 -1
  342. package/lib/module/getReactNativeVersion.native.js +0 -10
  343. package/lib/module/getReactNativeVersion.native.js.map +0 -1
  344. package/lib/module/getShadowNodeFromRef.native.js +0 -37
  345. package/lib/module/getShadowNodeFromRef.native.js.map +0 -1
  346. package/lib/module/handlers/PressabilityDebugView.native.js +0 -3
  347. package/lib/module/handlers/PressabilityDebugView.native.js.map +0 -1
  348. package/lib/module/handlers/customDirectEventTypes.native.js +0 -3
  349. package/lib/module/handlers/customDirectEventTypes.native.js.map +0 -1
  350. package/lib/module/handlers/gestures/GestureDetector.js +0 -654
  351. package/lib/module/handlers/gestures/GestureDetector.js.map +0 -1
  352. package/lib/typescript/RNGestureHandlerModule.native.d.ts +0 -2
  353. package/lib/typescript/RNRenderer.native.d.ts +0 -1
  354. package/lib/typescript/components/GestureComponents.native.d.ts +0 -22
  355. package/lib/typescript/components/GestureHandlerButton.native.d.ts +0 -4
  356. package/lib/typescript/getReactNativeVersion.native.d.ts +0 -4
  357. package/lib/typescript/getShadowNodeFromRef.native.d.ts +0 -1
  358. package/lib/typescript/handlers/PressabilityDebugView.native.d.ts +0 -1
  359. package/lib/typescript/handlers/customDirectEventTypes.native.d.ts +0 -1
  360. package/src/RNGestureHandlerModule.native.ts +0 -5
  361. package/src/RNRenderer.native.ts +0 -3
  362. package/src/components/GestureComponents.native.tsx +0 -148
  363. package/src/components/GestureHandlerButton.native.tsx +0 -5
  364. package/src/getReactNativeVersion.native.ts +0 -11
  365. package/src/getShadowNodeFromRef.native.ts +0 -44
  366. package/src/handlers/PressabilityDebugView.native.tsx +0 -2
  367. package/src/handlers/customDirectEventTypes.native.ts +0 -2
  368. package/src/handlers/gestures/GestureDetector.tsx +0 -894
  369. /package/lib/typescript/components/{GestureHandlerRootView.native.d.ts → GestureHandlerRootView.web.d.ts} +0 -0
@@ -37,7 +37,7 @@ const RawButton = (0, _createNativeWrapper.default)(_GestureHandlerButton.defaul
37
37
  });
38
38
  exports.RawButton = RawButton;
39
39
 
40
- class BaseButton extends React.Component {
40
+ class InnerBaseButton extends React.Component {
41
41
  constructor(props) {
42
42
  super(props);
43
43
 
@@ -116,6 +116,7 @@ class BaseButton extends React.Component {
116
116
  ...rest
117
117
  } = this.props;
118
118
  return /*#__PURE__*/React.createElement(RawButton, _extends({
119
+ ref: this.props.innerRef,
119
120
  rippleColor: (0, _reactNative.processColor)(rippleColor)
120
121
  }, rest, {
121
122
  onGestureEvent: this.onGestureEvent,
@@ -125,12 +126,15 @@ class BaseButton extends React.Component {
125
126
 
126
127
  }
127
128
 
128
- exports.BaseButton = BaseButton;
129
-
130
- _defineProperty(BaseButton, "defaultProps", {
129
+ _defineProperty(InnerBaseButton, "defaultProps", {
131
130
  delayLongPress: 600
132
131
  });
133
132
 
133
+ const BaseButton = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(InnerBaseButton, _extends({
134
+ innerRef: ref
135
+ }, props)));
136
+ exports.BaseButton = BaseButton;
137
+
134
138
  const AnimatedBaseButton = _reactNative.Animated.createAnimatedComponent(BaseButton);
135
139
 
136
140
  const btnStyles = _reactNative.StyleSheet.create({
@@ -143,7 +147,7 @@ const btnStyles = _reactNative.StyleSheet.create({
143
147
  }
144
148
  });
145
149
 
146
- class RectButton extends React.Component {
150
+ class InnerRectButton extends React.Component {
147
151
  constructor(props) {
148
152
  super(props);
149
153
 
@@ -172,6 +176,7 @@ class RectButton extends React.Component {
172
176
  const resolvedStyle = _reactNative.StyleSheet.flatten(style !== null && style !== void 0 ? style : {});
173
177
 
174
178
  return /*#__PURE__*/React.createElement(BaseButton, _extends({}, rest, {
179
+ ref: this.props.innerRef,
175
180
  style: resolvedStyle,
176
181
  onActiveStateChange: this.onActiveStateChange
177
182
  }), /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
@@ -189,14 +194,17 @@ class RectButton extends React.Component {
189
194
 
190
195
  }
191
196
 
192
- exports.RectButton = RectButton;
193
-
194
- _defineProperty(RectButton, "defaultProps", {
197
+ _defineProperty(InnerRectButton, "defaultProps", {
195
198
  activeOpacity: 0.105,
196
199
  underlayColor: 'black'
197
200
  });
198
201
 
199
- class BorderlessButton extends React.Component {
202
+ const RectButton = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(InnerRectButton, _extends({
203
+ innerRef: ref
204
+ }, props)));
205
+ exports.RectButton = RectButton;
206
+
207
+ class InnerBorderlessButton extends React.Component {
200
208
  constructor(props) {
201
209
  super(props);
202
210
 
@@ -219,9 +227,13 @@ class BorderlessButton extends React.Component {
219
227
  const {
220
228
  children,
221
229
  style,
230
+ innerRef,
222
231
  ...rest
223
232
  } = this.props;
224
233
  return /*#__PURE__*/React.createElement(AnimatedBaseButton, _extends({}, rest, {
234
+ // @ts-ignore We don't want `innerRef` to be accessible from public API.
235
+ // However in this case we need to set it indirectly on `BaseButton`, hence we use ts-ignore
236
+ innerRef: innerRef,
225
237
  onActiveStateChange: this.onActiveStateChange,
226
238
  style: [style, _reactNative.Platform.OS === 'ios' && {
227
239
  opacity: this.opacity
@@ -231,10 +243,13 @@ class BorderlessButton extends React.Component {
231
243
 
232
244
  }
233
245
 
234
- exports.BorderlessButton = BorderlessButton;
235
-
236
- _defineProperty(BorderlessButton, "defaultProps", {
246
+ _defineProperty(InnerBorderlessButton, "defaultProps", {
237
247
  activeOpacity: 0.3,
238
248
  borderless: true
239
249
  });
250
+
251
+ const BorderlessButton = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(InnerBorderlessButton, _extends({
252
+ innerRef: ref
253
+ }, props)));
254
+ exports.BorderlessButton = BorderlessButton;
240
255
  //# sourceMappingURL=GestureButtons.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["GestureButtons.tsx"],"names":["RawButton","GestureHandlerButton","shouldCancelWhenOutside","shouldActivateOnStart","BaseButton","React","Component","constructor","props","nativeEvent","state","oldState","pointerInside","active","State","ACTIVE","lastActive","onActiveStateChange","longPressDetected","CANCELLED","onPress","Platform","OS","BEGAN","onLongPress","longPressTimeout","setTimeout","delayLongPress","undefined","clearTimeout","END","FAILED","e","onHandlerStateChange","handleEvent","onGestureEvent","render","rippleColor","rest","AnimatedBaseButton","Animated","createAnimatedComponent","btnStyles","StyleSheet","create","underlay","position","left","right","bottom","top","RectButton","opacity","setValue","activeOpacity","Value","children","style","resolvedStyle","flatten","backgroundColor","underlayColor","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","BorderlessButton","borderless"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AASA;;AACA;;AACA;;;;;;;;;;;;AA2GO,MAAMA,SAAS,GAAG,kCAAoBC,6BAApB,EAA0C;AACjEC,EAAAA,uBAAuB,EAAE,KADwC;AAEjEC,EAAAA,qBAAqB,EAAE;AAF0C,CAA1C,CAAlB;;;AAKA,MAAMC,UAAN,SAAyBC,KAAK,CAACC,SAA/B,CAA0D;AAS/DC,EAAAA,WAAW,CAACC,KAAD,EAAyB;AAClC,UAAMA,KAAN;;AADkC;;AAAA;;AAAA;;AAAA,yCAMd,CAAC;AACrBC,MAAAA;AADqB,KAAD,KAE0C;AAC9D,YAAM;AAAEC,QAAAA,KAAF;AAASC,QAAAA,QAAT;AA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AADT,MAJF,EAkBGV,QAlBH,CADF;AAsBD;;AAhD8D;;;;gBAApDL,U,kBACW;AACpBG,EAAAA,aAAa,EAAE,KADK;AAEpBO,EAAAA,aAAa,EAAE;AAFK,C;;AAkDjB,MAAMM,gBAAN,SAA+B9D,KAAK,CAACC,SAArC,CAAsE;AAQ3EC,EAAAA,WAAW,CAACC,KAAD,EAA+B;AACxC,UAAMA,KAAN;;AADwC;;AAAA,iDAKXK,MAAD,IAAqB;AAAA;;AACjD,UAAIQ,sBAASC,EAAT,KAAgB,SAApB,EAA+B;AAC7B,aAAK8B,OAAL,CAAaC,QAAb,CAAsBxC,MAAM,GAAG,KAAKL,KAAL,CAAW8C,aAAd,GAA+B,CAA3D;AACD;;AAED,qDAAK9C,KAAL,EAAWS,mBAAX,qGAAiCJ,MAAjC;AACD,KAXyC;;AAExC,SAAKuC,OAAL,GAAe,IAAIZ,sBAASe,KAAb,CAAmB,CAAnB,CAAf;AACD;;AAUDnB,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEoB,MAAAA,QAAF;AAAYC,MAAAA,KAAZ;AAAmB,SAAGnB;AAAtB,QAA+B,KAAK9B,KAA1C;AAEA,wBACE,oBAAC,kBAAD,eACM8B,IADN;AAEE,MAAA,mBAAmB,EAAE,KAAKrB,mBAF5B;AAGE,MAAA,KAAK,EAAE,CAACwC,KAAD,EAAQpC,sBAASC,EAAT,KAAgB,KAAhB,IAAyB;AAAE8B,QAAAA,OAAO,EAAE,KAAKA;AAAhB,OAAjC;AAHT,QAIGI,QAJH,CADF;AAQD;;AAhC0E;;;;gBAAhEW,gB,kBACW;AACpBb,EAAAA,aAAa,EAAE,GADK;AAEpBc,EAAAA,UAAU,EAAE;AAFQ,C","sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n Platform,\n processColor,\n StyleSheet,\n StyleProp,\n ViewStyle,\n} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\nimport GestureHandlerButton from './GestureHandlerButton';\nimport { State } from '../State';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport {\n NativeViewGestureHandlerPayload,\n NativeViewGestureHandlerProps,\n} from '../handlers/NativeViewGestureHandler';\n\nexport interface RawButtonProps extends NativeViewGestureHandlerProps {\n /**\n * Defines if more than one button could be pressed simultaneously. By default\n * set true.\n */\n exclusive?: boolean;\n // TODO: we should transform props in `createNativeWrapper`\n\n /**\n * Android only.\n *\n * Defines color of native ripple animation used since API level 21.\n */\n rippleColor?: any; // it was present in BaseButtonProps before but is used here in code\n\n /**\n * Android only.\n *\n * Defines radius of native ripple animation used since API level 21.\n */\n rippleRadius?: number | null;\n\n /**\n * Android only.\n *\n * Set this to true if you want the ripple animation to render outside the view bounds.\n */\n borderless?: boolean;\n\n /**\n * Android only.\n *\n * Defines whether the ripple animation should be drawn on the foreground of the view.\n */\n foreground?: boolean;\n\n /**\n * Android only.\n *\n * Set this to true if you don't want the system to play sound when the button is pressed.\n */\n touchSoundDisabled?: boolean;\n}\n\nexport interface BaseButtonProps extends RawButtonProps {\n /**\n * Called when the button gets pressed (analogous to `onPress` in\n * `TouchableHighlight` from RN core).\n */\n onPress?: (pointerInside: boolean) => void;\n\n /**\n * Called when the button gets pressed and is held for `delayLongPress`\n * milliseconds.\n */\n onLongPress?: () => void;\n\n /**\n * Called when button changes from inactive to active and vice versa. It\n * passes active state as a boolean variable as a first parameter for that\n * method.\n */\n onActiveStateChange?: (active: boolean) => void;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n\n /**\n * Delay, in milliseconds, after which the `onLongPress` callback gets called.\n * Defaults to 600.\n */\n delayLongPress?: number;\n}\n\nexport interface RectButtonProps extends BaseButtonProps {\n /**\n * Background color that will be dimmed when button is in active state.\n */\n underlayColor?: string;\n\n /**\n * iOS only.\n *\n * Opacity applied to the underlay when button is in active state.\n */\n activeOpacity?: number;\n}\n\nexport interface BorderlessButtonProps extends BaseButtonProps {\n /**\n * iOS only.\n *\n * Opacity applied to the button when it is in an active state.\n */\n activeOpacity?: number;\n}\n\nexport const RawButton = createNativeWrapper(GestureHandlerButton, {\n shouldCancelWhenOutside: false,\n shouldActivateOnStart: false,\n});\n\nexport class BaseButton extends React.Component<BaseButtonProps> {\n static defaultProps = {\n delayLongPress: 600,\n };\n\n private lastActive: boolean;\n private longPressTimeout: ReturnType<typeof setTimeout> | undefined;\n private longPressDetected: boolean;\n\n constructor(props: BaseButtonProps) {\n super(props);\n this.lastActive = false;\n this.longPressDetected = false;\n }\n\n private handleEvent = ({\n nativeEvent,\n }: HandlerStateChangeEvent<NativeViewGestureHandlerPayload>) => {\n const { state, oldState, pointerInside } = nativeEvent;\n const active = pointerInside && state === State.ACTIVE;\n\n if (active !== this.lastActive && this.props.onActiveStateChange) {\n this.props.onActiveStateChange(active);\n }\n\n if (\n !this.longPressDetected &&\n oldState === State.ACTIVE &&\n state !== State.CANCELLED &&\n this.lastActive &&\n this.props.onPress\n ) {\n this.props.onPress(active);\n }\n\n if (\n !this.lastActive &&\n // NativeViewGestureHandler sends different events based on platform\n state === (Platform.OS !== 'android' ? State.ACTIVE : State.BEGAN) &&\n pointerInside\n ) {\n this.longPressDetected = false;\n if (this.props.onLongPress) {\n this.longPressTimeout = setTimeout(\n this.onLongPress,\n this.props.delayLongPress\n );\n }\n } else if (\n // cancel longpress timeout if it's set and the finger moved out of the view\n state === State.ACTIVE &&\n !pointerInside &&\n this.longPressTimeout !== undefined\n ) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = undefined;\n } else if (\n // cancel longpress timeout if it's set and the gesture has finished\n this.longPressTimeout !== undefined &&\n (state === State.END ||\n state === State.CANCELLED ||\n state === State.FAILED)\n ) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = undefined;\n }\n\n this.lastActive = active;\n };\n\n private onLongPress = () => {\n this.longPressDetected = true;\n this.props.onLongPress?.();\n };\n\n // Normally, the parent would execute it's handler first, then forward the\n // event to listeners. However, here our handler is virtually only forwarding\n // events to listeners, so we reverse the order to keep the proper order of\n // the callbacks (from \"raw\" ones to \"processed\").\n private onHandlerStateChange = (\n e: HandlerStateChangeEvent<NativeViewGestureHandlerPayload>\n ) => {\n this.props.onHandlerStateChange?.(e);\n this.handleEvent(e);\n };\n\n private onGestureEvent = (\n e: GestureEvent<NativeViewGestureHandlerPayload>\n ) => {\n this.props.onGestureEvent?.(e);\n this.handleEvent(\n e as HandlerStateChangeEvent<NativeViewGestureHandlerPayload>\n ); // TODO: maybe it is not correct\n };\n\n render() {\n const { rippleColor, ...rest } = this.props;\n\n return (\n <RawButton\n rippleColor={processColor(rippleColor)}\n {...rest}\n onGestureEvent={this.onGestureEvent}\n onHandlerStateChange={this.onHandlerStateChange}\n />\n );\n }\n}\n\nconst AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);\n\nconst btnStyles = StyleSheet.create({\n underlay: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n },\n});\n\nexport class RectButton extends React.Component<RectButtonProps> {\n static defaultProps = {\n activeOpacity: 0.105,\n underlayColor: 'black',\n };\n\n private opacity: Animated.Value;\n\n constructor(props: RectButtonProps) {\n super(props);\n this.opacity = new Animated.Value(0);\n }\n\n private onActiveStateChange = (active: boolean) => {\n if (Platform.OS !== 'android') {\n this.opacity.setValue(active ? this.props.activeOpacity! : 0);\n }\n\n this.props.onActiveStateChange?.(active);\n };\n\n render() {\n const { children, style, ...rest } = this.props;\n\n const resolvedStyle = StyleSheet.flatten(style ?? {});\n\n return (\n <BaseButton\n {...rest}\n style={resolvedStyle}\n onActiveStateChange={this.onActiveStateChange}>\n <Animated.View\n style={[\n btnStyles.underlay,\n {\n opacity: this.opacity,\n backgroundColor: this.props.underlayColor,\n borderRadius: resolvedStyle.borderRadius,\n borderTopLeftRadius: resolvedStyle.borderTopLeftRadius,\n borderTopRightRadius: resolvedStyle.borderTopRightRadius,\n borderBottomLeftRadius: resolvedStyle.borderBottomLeftRadius,\n borderBottomRightRadius: resolvedStyle.borderBottomRightRadius,\n },\n ]}\n />\n {children}\n </BaseButton>\n );\n }\n}\n\nexport class BorderlessButton extends React.Component<BorderlessButtonProps> {\n static defaultProps = {\n activeOpacity: 0.3,\n borderless: true,\n };\n\n private opacity: Animated.Value;\n\n constructor(props: BorderlessButtonProps) {\n super(props);\n this.opacity = new Animated.Value(1);\n }\n\n private onActiveStateChange = (active: boolean) => {\n if (Platform.OS !== 'android') {\n this.opacity.setValue(active ? this.props.activeOpacity! : 1);\n }\n\n this.props.onActiveStateChange?.(active);\n };\n\n render() {\n const { children, style, ...rest } = this.props;\n\n return (\n <AnimatedBaseButton\n {...rest}\n onActiveStateChange={this.onActiveStateChange}\n style={[style, Platform.OS === 'ios' && { opacity: this.opacity }]}>\n {children}\n </AnimatedBaseButton>\n );\n }\n}\n\nexport { default as PureNativeButton } from './GestureHandlerButton';\n"]}
1
+ {"version":3,"sources":["GestureButtons.tsx"],"names":["RawButton","GestureHandlerButton","shouldCancelWhenOutside","shouldActivateOnStart","InnerBaseButton","React","Component","constructor","props","nativeEvent","state","oldState","pointerInside","active","State","ACTIVE","lastActive","onActiveStateChange","longPressDetected","CANCELLED","onPress","Platform","OS","BEGAN","onLongPress","longPressTimeout","setTimeout","delayLongPress","undefined","clearTimeout","END","FAILED","e","onHandlerStateChange","handleEvent","onGestureEvent","render","rippleColor","rest","innerRef","BaseButton","forwardRef","ref","AnimatedBaseButton","Animated","createAnimatedComponent","btnStyles","StyleSheet","create","underlay","position","left","right","bottom","top","InnerRectButton","opacity","setValue","activeOpacity","Value","children","style","resolvedStyle","flatten","backgroundColor","underlayColor","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","RectButton","InnerBorderlessButton","borderless","BorderlessButton"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AASA;;AACA;;AACA;;;;;;;;;;;;AAuHO,MAAMA,SAAS,GAAG,kCAAoBC,6BAApB,EAA0C;AACjEC,EAAAA,uBAAuB,EAAE,KAD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GAAiCJ,MAAjC;AACD,KAXyC;;AAExC,SAAK2C,OAAL,GAAe,IAAIZ,sBAASe,KAAb,CAAmB,CAAnB,CAAf;AACD;;AAUDvB,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEwB,MAAAA,QAAF;AAAYC,MAAAA,KAAZ;AAAmBtB,MAAAA,QAAnB;AAA6B,SAAGD;AAAhC,QAAyC,KAAK9B,KAApD;AAEA,wBACE,oBAAC,kBAAD,eACM8B,IADN;AAEE;AACA;AACA,MAAA,QAAQ,EAAEC,QAJZ;AAKE,MAAA,mBAAmB,EAAE,KAAKtB,mBAL5B;AAME,MAAA,KAAK,EAAE,CAAC4C,KAAD,EAAQxC,sBAASC,EAAT,KAAgB,KAAhB,IAAyB;AAAEkC,QAAAA,OAAO,EAAE,KAAKA;AAAhB,OAAjC;AANT,QAOGI,QAPH,CADF;AAWD;;AAnC+E;;gBAA5EY,qB,kBACkB;AACpBd,EAAAA,aAAa,EAAE,GADK;AAEpBe,EAAAA,UAAU,EAAE;AAFQ,C;;AAqCjB,MAAMC,gBAAgB,gBAAGrE,KAAK,CAACoC,UAAN,CAG9B,CAACjC,KAAD,EAAQkC,GAAR,kBAAgB,oBAAC,qBAAD;AAAuB,EAAA,QAAQ,EAAEA;AAAjC,GAA0ClC,KAA1C,EAHc,CAAzB","sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n Platform,\n processColor,\n StyleSheet,\n StyleProp,\n ViewStyle,\n} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\nimport GestureHandlerButton from './GestureHandlerButton';\nimport { State } from '../State';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport {\n NativeViewGestureHandlerPayload,\n NativeViewGestureHandlerProps,\n} from '../handlers/NativeViewGestureHandler';\n\nexport interface RawButtonProps extends NativeViewGestureHandlerProps {\n /**\n * Defines if more than one button could be pressed simultaneously. By default\n * set true.\n */\n exclusive?: boolean;\n // TODO: we should transform props in `createNativeWrapper`\n\n /**\n * Android only.\n *\n * Defines color of native ripple animation used since API level 21.\n */\n rippleColor?: any; // it was present in BaseButtonProps before but is used here in code\n\n /**\n * Android only.\n *\n * Defines radius of native ripple animation used since API level 21.\n */\n rippleRadius?: number | null;\n\n /**\n * Android only.\n *\n * Set this to true if you want the ripple animation to render outside the view bounds.\n */\n borderless?: boolean;\n\n /**\n * Android only.\n *\n * Defines whether the ripple animation should be drawn on the foreground of the view.\n */\n foreground?: boolean;\n\n /**\n * Android only.\n *\n * Set this to true if you don't want the system to play sound when the button is pressed.\n */\n touchSoundDisabled?: boolean;\n}\n\ninterface ButtonWithRefProps {\n innerRef?: React.ForwardedRef<React.ComponentType<any>>;\n}\n\nexport interface BaseButtonProps extends RawButtonProps {\n /**\n * Called when the button gets pressed (analogous to `onPress` in\n * `TouchableHighlight` from RN core).\n */\n onPress?: (pointerInside: boolean) => void;\n\n /**\n * Called when the button gets pressed and is held for `delayLongPress`\n * milliseconds.\n */\n onLongPress?: () => void;\n\n /**\n * Called when button changes from inactive to active and vice versa. It\n * passes active state as a boolean variable as a first parameter for that\n * method.\n */\n onActiveStateChange?: (active: boolean) => void;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n\n /**\n * Delay, in milliseconds, after which the `onLongPress` callback gets called.\n * Defaults to 600.\n */\n delayLongPress?: number;\n}\n\ninterface BaseButtonWithRefProps extends BaseButtonProps, ButtonWithRefProps {}\n\nexport interface RectButtonProps extends BaseButtonProps {\n /**\n * Background color that will be dimmed when button is in active state.\n */\n underlayColor?: string;\n\n /**\n * iOS only.\n *\n * Opacity applied to the underlay when button is in active state.\n */\n activeOpacity?: number;\n}\n\ninterface RectButtonWithRefProps extends RectButtonProps, ButtonWithRefProps {}\n\nexport interface BorderlessButtonProps extends BaseButtonProps {\n /**\n * iOS only.\n *\n * Opacity applied to the button when it is in an active state.\n */\n activeOpacity?: number;\n}\n\ninterface BorderlessButtonWithRefProps\n extends BorderlessButtonProps,\n ButtonWithRefProps {}\n\nexport const RawButton = createNativeWrapper(GestureHandlerButton, {\n shouldCancelWhenOutside: false,\n shouldActivateOnStart: false,\n});\n\nclass InnerBaseButton extends React.Component<BaseButtonWithRefProps> {\n static defaultProps = {\n delayLongPress: 600,\n };\n\n private lastActive: boolean;\n private longPressTimeout: ReturnType<typeof setTimeout> | undefined;\n private longPressDetected: boolean;\n\n constructor(props: BaseButtonProps) {\n super(props);\n this.lastActive = false;\n this.longPressDetected = false;\n }\n\n private handleEvent = ({\n nativeEvent,\n }: HandlerStateChangeEvent<NativeViewGestureHandlerPayload>) => {\n const { state, oldState, pointerInside } = nativeEvent;\n const active = pointerInside && state === State.ACTIVE;\n\n if (active !== this.lastActive && this.props.onActiveStateChange) {\n this.props.onActiveStateChange(active);\n }\n\n if (\n !this.longPressDetected &&\n oldState === State.ACTIVE &&\n state !== State.CANCELLED &&\n this.lastActive &&\n this.props.onPress\n ) {\n this.props.onPress(active);\n }\n\n if (\n !this.lastActive &&\n // NativeViewGestureHandler sends different events based on platform\n state === (Platform.OS !== 'android' ? State.ACTIVE : State.BEGAN) &&\n pointerInside\n ) {\n this.longPressDetected = false;\n if (this.props.onLongPress) {\n this.longPressTimeout = setTimeout(\n this.onLongPress,\n this.props.delayLongPress\n );\n }\n } else if (\n // cancel longpress timeout if it's set and the finger moved out of the view\n state === State.ACTIVE &&\n !pointerInside &&\n this.longPressTimeout !== undefined\n ) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = undefined;\n } else if (\n // cancel longpress timeout if it's set and the gesture has finished\n this.longPressTimeout !== undefined &&\n (state === State.END ||\n state === State.CANCELLED ||\n state === State.FAILED)\n ) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = undefined;\n }\n\n this.lastActive = active;\n };\n\n private onLongPress = () => {\n this.longPressDetected = true;\n this.props.onLongPress?.();\n };\n\n // Normally, the parent would execute it's handler first, then forward the\n // event to listeners. However, here our handler is virtually only forwarding\n // events to listeners, so we reverse the order to keep the proper order of\n // the callbacks (from \"raw\" ones to \"processed\").\n private onHandlerStateChange = (\n e: HandlerStateChangeEvent<NativeViewGestureHandlerPayload>\n ) => {\n this.props.onHandlerStateChange?.(e);\n this.handleEvent(e);\n };\n\n private onGestureEvent = (\n e: GestureEvent<NativeViewGestureHandlerPayload>\n ) => {\n this.props.onGestureEvent?.(e);\n this.handleEvent(\n e as HandlerStateChangeEvent<NativeViewGestureHandlerPayload>\n ); // TODO: maybe it is not correct\n };\n\n render() {\n const { rippleColor, ...rest } = this.props;\n\n return (\n <RawButton\n ref={this.props.innerRef}\n rippleColor={processColor(rippleColor)}\n {...rest}\n onGestureEvent={this.onGestureEvent}\n onHandlerStateChange={this.onHandlerStateChange}\n />\n );\n }\n}\n\nexport const BaseButton = React.forwardRef<\n any,\n Omit<BaseButtonProps, 'innerRef'>\n>((props, ref) => <InnerBaseButton innerRef={ref} {...props} />);\n\nconst AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);\n\nconst btnStyles = StyleSheet.create({\n underlay: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n },\n});\n\nclass InnerRectButton extends React.Component<RectButtonWithRefProps> {\n static defaultProps = {\n activeOpacity: 0.105,\n underlayColor: 'black',\n };\n\n private opacity: Animated.Value;\n\n constructor(props: RectButtonProps) {\n super(props);\n this.opacity = new Animated.Value(0);\n }\n\n private onActiveStateChange = (active: boolean) => {\n if (Platform.OS !== 'android') {\n this.opacity.setValue(active ? this.props.activeOpacity! : 0);\n }\n\n this.props.onActiveStateChange?.(active);\n };\n\n render() {\n const { children, style, ...rest } = this.props;\n\n const resolvedStyle = StyleSheet.flatten(style ?? {});\n\n return (\n <BaseButton\n {...rest}\n ref={this.props.innerRef}\n style={resolvedStyle}\n onActiveStateChange={this.onActiveStateChange}>\n <Animated.View\n style={[\n btnStyles.underlay,\n {\n opacity: this.opacity,\n backgroundColor: this.props.underlayColor,\n borderRadius: resolvedStyle.borderRadius,\n borderTopLeftRadius: resolvedStyle.borderTopLeftRadius,\n borderTopRightRadius: resolvedStyle.borderTopRightRadius,\n borderBottomLeftRadius: resolvedStyle.borderBottomLeftRadius,\n borderBottomRightRadius: resolvedStyle.borderBottomRightRadius,\n },\n ]}\n />\n {children}\n </BaseButton>\n );\n }\n}\n\nexport const RectButton = React.forwardRef<\n any,\n Omit<RectButtonProps, 'innerRef'>\n>((props, ref) => <InnerRectButton innerRef={ref} {...props} />);\n\nclass InnerBorderlessButton extends React.Component<BorderlessButtonWithRefProps> {\n static defaultProps = {\n activeOpacity: 0.3,\n borderless: true,\n };\n\n private opacity: Animated.Value;\n\n constructor(props: BorderlessButtonProps) {\n super(props);\n this.opacity = new Animated.Value(1);\n }\n\n private onActiveStateChange = (active: boolean) => {\n if (Platform.OS !== 'android') {\n this.opacity.setValue(active ? this.props.activeOpacity! : 1);\n }\n\n this.props.onActiveStateChange?.(active);\n };\n\n render() {\n const { children, style, innerRef, ...rest } = this.props;\n\n return (\n <AnimatedBaseButton\n {...rest}\n // @ts-ignore We don't want `innerRef` to be accessible from public API.\n // However in this case we need to set it indirectly on `BaseButton`, hence we use ts-ignore\n innerRef={innerRef}\n onActiveStateChange={this.onActiveStateChange}\n style={[style, Platform.OS === 'ios' && { opacity: this.opacity }]}>\n {children}\n </AnimatedBaseButton>\n );\n }\n}\n\nexport const BorderlessButton = React.forwardRef<\n any,\n Omit<BorderlessButtonProps, 'innerRef'>\n>((props, ref) => <InnerBorderlessButton innerRef={ref} {...props} />);\n\nexport { default as PureNativeButton } from './GestureHandlerButton';\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.FlatList = exports.RefreshControl = exports.DrawerLayoutAndroid = exports.TextInput = exports.Switch = exports.ScrollView = void 0;
6
+ exports.FlatList = exports.DrawerLayoutAndroid = exports.TextInput = exports.Switch = exports.ScrollView = exports.RefreshControl = void 0;
7
7
 
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
 
@@ -11,6 +11,10 @@ var _reactNative = require("react-native");
11
11
 
12
12
  var _createNativeWrapper = _interopRequireDefault(require("../handlers/createNativeWrapper"));
13
13
 
14
+ var _NativeViewGestureHandler = require("../handlers/NativeViewGestureHandler");
15
+
16
+ var _utils = require("../utils");
17
+
14
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
19
 
16
20
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -19,34 +23,93 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
19
23
 
20
24
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
25
 
22
- const ScrollView = (0, _createNativeWrapper.default)(_reactNative.ScrollView, {
23
- disallowInterruption: false
26
+ const RefreshControl = (0, _createNativeWrapper.default)(_reactNative.RefreshControl, {
27
+ disallowInterruption: true,
28
+ shouldCancelWhenOutside: false
29
+ }); // eslint-disable-next-line @typescript-eslint/no-redeclare
30
+
31
+ exports.RefreshControl = RefreshControl;
32
+ const GHScrollView = (0, _createNativeWrapper.default)(_reactNative.ScrollView, {
33
+ disallowInterruption: true,
34
+ shouldCancelWhenOutside: false
24
35
  });
36
+ const ScrollView = /*#__PURE__*/React.forwardRef((props, ref) => {
37
+ const refreshControlGestureRef = React.useRef(null);
38
+ const {
39
+ refreshControl,
40
+ waitFor,
41
+ ...rest
42
+ } = props;
43
+ return /*#__PURE__*/React.createElement(GHScrollView, _extends({}, rest, {
44
+ // @ts-ignore `ref` exists on `GHScrollView`
45
+ ref: ref,
46
+ waitFor: [...(0, _utils.toArray)(waitFor !== null && waitFor !== void 0 ? waitFor : []), refreshControlGestureRef] // @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
47
+ ,
48
+ refreshControl: refreshControl ? /*#__PURE__*/React.cloneElement(refreshControl, {
49
+ // @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
50
+ ref: refreshControlGestureRef
51
+ }) : undefined
52
+ }));
53
+ }); // backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
54
+ // include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
55
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
56
+
25
57
  exports.ScrollView = ScrollView;
26
58
  const Switch = (0, _createNativeWrapper.default)(_reactNative.Switch, {
27
59
  shouldCancelWhenOutside: false,
28
60
  shouldActivateOnStart: true,
29
61
  disallowInterruption: true
30
- });
62
+ }); // eslint-disable-next-line @typescript-eslint/no-redeclare
63
+
31
64
  exports.Switch = Switch;
32
- const TextInput = (0, _createNativeWrapper.default)(_reactNative.TextInput);
65
+ const TextInput = (0, _createNativeWrapper.default)(_reactNative.TextInput); // eslint-disable-next-line @typescript-eslint/no-redeclare
66
+
33
67
  exports.TextInput = TextInput;
68
+ const DrawerLayoutAndroid = (0, _createNativeWrapper.default)(_reactNative.DrawerLayoutAndroid, {
69
+ disallowInterruption: true
70
+ }); // eslint-disable-next-line @typescript-eslint/no-redeclare
71
+
72
+ exports.DrawerLayoutAndroid = DrawerLayoutAndroid;
73
+ const FlatList = /*#__PURE__*/React.forwardRef((props, ref) => {
74
+ const refreshControlGestureRef = React.useRef(null);
75
+ const {
76
+ waitFor,
77
+ refreshControl,
78
+ ...rest
79
+ } = props;
80
+ const flatListProps = {};
81
+ const scrollViewProps = {};
34
82
 
35
- const DrawerLayoutAndroid = () => {
36
- console.warn('DrawerLayoutAndroid is not supported on web!');
37
- return /*#__PURE__*/React.createElement(_reactNative.View, null);
38
- }; // RefreshControl is implemented as a functional component, rendering a View
39
- // NativeViewGestureHandler needs to set a ref on its child, which cannot be done
40
- // on functional components
83
+ for (const [propName, value] of Object.entries(rest)) {
84
+ // https://github.com/microsoft/TypeScript/issues/26255
85
+ if (_NativeViewGestureHandler.nativeViewProps.includes(propName)) {
86
+ // @ts-ignore - this function cannot have generic type so we have to ignore this error
87
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
88
+ scrollViewProps[propName] = value;
89
+ } else {
90
+ // @ts-ignore - this function cannot have generic type so we have to ignore this error
91
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
92
+ flatListProps[propName] = value;
93
+ }
94
+ }
41
95
 
96
+ return (
97
+ /*#__PURE__*/
98
+ // @ts-ignore - this function cannot have generic type so we have to ignore this error
99
+ React.createElement(_reactNative.FlatList, _extends({
100
+ ref: ref
101
+ }, flatListProps, {
102
+ renderScrollComponent: scrollProps => /*#__PURE__*/React.createElement(ScrollView, _extends({}, scrollProps, scrollViewProps, {
103
+ waitFor: [...(0, _utils.toArray)(waitFor !== null && waitFor !== void 0 ? waitFor : []), refreshControlGestureRef]
104
+ })) // @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
105
+ ,
106
+ refreshControl: refreshControl ? /*#__PURE__*/React.cloneElement(refreshControl, {
107
+ // @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
108
+ ref: refreshControlGestureRef
109
+ }) : undefined
110
+ }))
111
+ );
112
+ }); // eslint-disable-next-line @typescript-eslint/no-redeclare
42
113
 
43
- exports.DrawerLayoutAndroid = DrawerLayoutAndroid;
44
- const RefreshControl = (0, _createNativeWrapper.default)(_reactNative.View);
45
- exports.RefreshControl = RefreshControl;
46
- const FlatList = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(_reactNative.FlatList, _extends({
47
- ref: ref
48
- }, props, {
49
- renderScrollComponent: scrollProps => /*#__PURE__*/React.createElement(ScrollView, scrollProps)
50
- })));
51
114
  exports.FlatList = FlatList;
52
115
  //# sourceMappingURL=GestureComponents.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["GestureComponents.tsx"],"names":["ScrollView","RNScrollView","disallowInterruption","Switch","RNSwitch","shouldCancelWhenOutside","shouldActivateOnStart","TextInput","RNTextInput","DrawerLayoutAndroid","console","warn","RefreshControl","View","FlatList","React","forwardRef","props","ref","scrollProps"],"mappings":";;;;;;;AAAA;;AACA;;AASA;;;;;;;;;;AAEO,MAAMA,UAAU,GAAG,kCAAoBC,uBAApB,EAAkC;AAC1DC,EAAAA,oBAAoB,EAAE;AADoC,CAAlC,CAAnB;;AAIA,MAAMC,MAAM,GAAG,kCAAoBC,mBAApB,EAA8B;AAClDC,EAAAA,uBAAuB,EAAE,KADyB;AAElDC,EAAAA,qBAAqB,EAAE,IAF2B;AAGlDJ,EAAAA,oBAAoB,EAAE;AAH4B,CAA9B,CAAf;;AAKA,MAAMK,SAAS,GAAG,kCAAoBC,sBAApB,CAAlB;;;AACA,MAAMC,mBAAmB,GAAG,MAAM;AACvCC,EAAAA,OAAO,CAACC,IAAR,CAAa,8CAAb;AACA,sBAAO,oBAAC,iBAAD,OAAP;AACD,CAHM,C,CAKP;AACA;AACA;;;;AACO,MAAMC,cAAc,GAAG,kCAAoBC,iBAApB,CAAvB;;AAEA,MAAMC,QAAQ,gBAAGC,KAAK,CAACC,UAAN,CACtB,CAAoBC,KAApB,EAAiDC,GAAjD,kBACE,oBAAC,qBAAD;AACE,EAAA,GAAG,EAAEA;AADP,GAEMD,KAFN;AAGE,EAAA,qBAAqB,EAAGE,WAAD,iBAAiB,oBAAC,UAAD,EAAgBA,WAAhB;AAH1C,GAFoB,CAAjB","sourcesContent":["import * as React from 'react';\nimport {\n FlatList as RNFlatList,\n Switch as RNSwitch,\n TextInput as RNTextInput,\n ScrollView as RNScrollView,\n FlatListProps,\n View,\n} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\n\nexport const ScrollView = createNativeWrapper(RNScrollView, {\n disallowInterruption: false,\n});\n\nexport const Switch = createNativeWrapper(RNSwitch, {\n shouldCancelWhenOutside: false,\n shouldActivateOnStart: true,\n disallowInterruption: true,\n});\nexport const TextInput = createNativeWrapper(RNTextInput);\nexport const DrawerLayoutAndroid = () => {\n console.warn('DrawerLayoutAndroid is not supported on web!');\n return <View />;\n};\n\n// RefreshControl is implemented as a functional component, rendering a View\n// NativeViewGestureHandler needs to set a ref on its child, which cannot be done\n// on functional components\nexport const RefreshControl = createNativeWrapper(View);\n\nexport const FlatList = React.forwardRef(\n <ItemT extends any>(props: FlatListProps<ItemT>, ref: any) => (\n <RNFlatList\n ref={ref}\n {...props}\n renderScrollComponent={(scrollProps) => <ScrollView {...scrollProps} />}\n />\n )\n);\n"]}
1
+ {"version":3,"sources":["GestureComponents.tsx"],"names":["RefreshControl","RNRefreshControl","disallowInterruption","shouldCancelWhenOutside","GHScrollView","RNScrollView","ScrollView","React","forwardRef","props","ref","refreshControlGestureRef","useRef","refreshControl","waitFor","rest","cloneElement","undefined","Switch","RNSwitch","shouldActivateOnStart","TextInput","RNTextInput","DrawerLayoutAndroid","RNDrawerLayoutAndroid","FlatList","flatListProps","scrollViewProps","propName","value","Object","entries","nativeViewProps","includes","scrollProps"],"mappings":";;;;;;;AAAA;;AAOA;;AAcA;;AAEA;;AAKA;;;;;;;;;;AAEO,MAAMA,cAAc,GAAG,kCAAoBC,2BAApB,EAAsC;AAClEC,EAAAA,oBAAoB,EAAE,IAD4C;AAElEC,EAAAA,uBAAuB,EAAE;AAFyC,CAAtC,CAAvB,C,CAIP;;;AAGA,MAAMC,YAAY,GAAG,kCACnBC,uBADmB,EAEnB;AACEH,EAAAA,oBAAoB,EAAE,IADxB;AAEEC,EAAAA,uBAAuB,EAAE;AAF3B,CAFmB,CAArB;AAOO,MAAMG,UAAU,gBAAGC,KAAK,CAACC,UAAN,CAGxB,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAChB,QAAMC,wBAAwB,GAAGJ,KAAK,CAACK,MAAN,CAA6B,IAA7B,CAAjC;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,OAAlB;AAA2B,OA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CC,QAAvC,CAAgDL,QAAhD,CAAJ,EAA+D;AAC7D;AACA;AACAD,MAAAA,eAAe,CAACC,QAAD,CAAf,GAA4BC,KAA5B;AACD,KAJD,MAIO;AACL;AACA;AACAH,MAAAA,aAAa,CAACE,QAAD,CAAb,GAA0BC,KAA1B;AACD;AACF;;AAED;AAAA;AACE;AACA,wBAAC,qBAAD;AACE,MAAA,GAAG,EAAEnB;AADP,OAEMgB,aAFN;AAGE,MAAA,qBAAqB,EAAGQ,WAAD,iBACrB,oBAAC,UAAD,eAEOA,WAFP,EAGOP,eAHP;AAIIb,QAAAA,OAAO,EAAE,CAAC,GAAG,oBAAQA,OAAR,aAAQA,OAAR,cAAQA,OAAR,GAAmB,EAAnB,CAAJ,EAA4BH,wBAA5B;AAJb,SAJJ,CAYE;AAZF;AAaE,MAAA,cAAc,EACZE,cAAc,gBACVN,KAAK,CAACS,YAAN,CAAmBH,cAAnB,EAAmC;AACjC;AACAH,QAAAA,GAAG,EAAEC;AAF4B,OAAnC,CADU,GAKVM;AAnBR;AAFF;AAyBD,CA7CuB,CAAjB,C,CAqDP","sourcesContent":["import * as React from 'react';\nimport {\n PropsWithChildren,\n ForwardedRef,\n RefAttributes,\n ReactElement,\n} from 'react';\nimport {\n ScrollView as RNScrollView,\n ScrollViewProps as RNScrollViewProps,\n Switch as RNSwitch,\n SwitchProps as RNSwitchProps,\n TextInput as RNTextInput,\n TextInputProps as RNTextInputProps,\n DrawerLayoutAndroid as RNDrawerLayoutAndroid,\n DrawerLayoutAndroidProps as RNDrawerLayoutAndroidProps,\n FlatList as RNFlatList,\n FlatListProps as RNFlatListProps,\n RefreshControl as RNRefreshControl,\n} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\n\nimport {\n NativeViewGestureHandlerProps,\n nativeViewProps,\n} from '../handlers/NativeViewGestureHandler';\n\nimport { toArray } from '../utils';\n\nexport const RefreshControl = createNativeWrapper(RNRefreshControl, {\n disallowInterruption: true,\n shouldCancelWhenOutside: false,\n});\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type RefreshControl = typeof RefreshControl & RNRefreshControl;\n\nconst GHScrollView = createNativeWrapper<PropsWithChildren<RNScrollViewProps>>(\n RNScrollView,\n {\n disallowInterruption: true,\n shouldCancelWhenOutside: false,\n }\n);\nexport const ScrollView = React.forwardRef<\n RNScrollView,\n RNScrollViewProps & NativeViewGestureHandlerProps\n>((props, ref) => {\n const refreshControlGestureRef = React.useRef<RefreshControl>(null);\n const { refreshControl, waitFor, ...rest } = props;\n\n return (\n <GHScrollView\n {...rest}\n // @ts-ignore `ref` exists on `GHScrollView`\n ref={ref}\n waitFor={[...toArray(waitFor ?? []), refreshControlGestureRef]}\n // @ts-ignore we don't pass `refreshing` prop as we only want to override the ref\n refreshControl={\n refreshControl\n ? React.cloneElement(refreshControl, {\n // @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS\n ref: refreshControlGestureRef,\n })\n : undefined\n }\n />\n );\n});\n// backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457\n// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type ScrollView = typeof GHScrollView & RNScrollView;\n\nexport const Switch = createNativeWrapper<RNSwitchProps>(RNSwitch, {\n shouldCancelWhenOutside: false,\n shouldActivateOnStart: true,\n disallowInterruption: true,\n});\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type Switch = typeof Switch & RNSwitch;\n\nexport const TextInput = createNativeWrapper<RNTextInputProps>(RNTextInput);\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type TextInput = typeof TextInput & RNTextInput;\n\nexport const DrawerLayoutAndroid = createNativeWrapper<\n PropsWithChildren<RNDrawerLayoutAndroidProps>\n>(RNDrawerLayoutAndroid, { disallowInterruption: true });\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DrawerLayoutAndroid = typeof DrawerLayoutAndroid &\n RNDrawerLayoutAndroid;\n\nexport const FlatList = React.forwardRef((props, ref) => {\n const refreshControlGestureRef = React.useRef<RefreshControl>(null);\n\n const { waitFor, refreshControl, ...rest } = props;\n\n const flatListProps = {};\n const scrollViewProps = {};\n for (const [propName, value] of Object.entries(rest)) {\n // https://github.com/microsoft/TypeScript/issues/26255\n if ((nativeViewProps as readonly string[]).includes(propName)) {\n // @ts-ignore - this function cannot have generic type so we have to ignore this error\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n scrollViewProps[propName] = value;\n } else {\n // @ts-ignore - this function cannot have generic type so we have to ignore this error\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n flatListProps[propName] = value;\n }\n }\n\n return (\n // @ts-ignore - this function cannot have generic type so we have to ignore this error\n <RNFlatList\n ref={ref}\n {...flatListProps}\n renderScrollComponent={(scrollProps) => (\n <ScrollView\n {...{\n ...scrollProps,\n ...scrollViewProps,\n waitFor: [...toArray(waitFor ?? []), refreshControlGestureRef],\n }}\n />\n )}\n // @ts-ignore we don't pass `refreshing` prop as we only want to override the ref\n refreshControl={\n refreshControl\n ? React.cloneElement(refreshControl, {\n // @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS\n ref: refreshControlGestureRef,\n })\n : undefined\n }\n />\n );\n}) as <ItemT = any>(\n props: PropsWithChildren<\n RNFlatListProps<ItemT> &\n RefAttributes<FlatList<ItemT>> &\n NativeViewGestureHandlerProps\n >,\n ref: ForwardedRef<FlatList<ItemT>>\n) => ReactElement | null;\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type FlatList<ItemT = any> = typeof FlatList & RNFlatList<ItemT>;\n"]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FlatList = exports.RefreshControl = exports.DrawerLayoutAndroid = exports.TextInput = exports.Switch = exports.ScrollView = void 0;
7
+
8
+ var React = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _createNativeWrapper = _interopRequireDefault(require("../handlers/createNativeWrapper"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
17
+
18
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
20
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
+
22
+ const ScrollView = (0, _createNativeWrapper.default)(_reactNative.ScrollView, {
23
+ disallowInterruption: false
24
+ });
25
+ exports.ScrollView = ScrollView;
26
+ const Switch = (0, _createNativeWrapper.default)(_reactNative.Switch, {
27
+ shouldCancelWhenOutside: false,
28
+ shouldActivateOnStart: true,
29
+ disallowInterruption: true
30
+ });
31
+ exports.Switch = Switch;
32
+ const TextInput = (0, _createNativeWrapper.default)(_reactNative.TextInput);
33
+ exports.TextInput = TextInput;
34
+
35
+ const DrawerLayoutAndroid = () => {
36
+ console.warn('DrawerLayoutAndroid is not supported on web!');
37
+ return /*#__PURE__*/React.createElement(_reactNative.View, null);
38
+ }; // RefreshControl is implemented as a functional component, rendering a View
39
+ // NativeViewGestureHandler needs to set a ref on its child, which cannot be done
40
+ // on functional components
41
+
42
+
43
+ exports.DrawerLayoutAndroid = DrawerLayoutAndroid;
44
+ const RefreshControl = (0, _createNativeWrapper.default)(_reactNative.View);
45
+ exports.RefreshControl = RefreshControl;
46
+ const FlatList = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(_reactNative.FlatList, _extends({
47
+ ref: ref
48
+ }, props, {
49
+ renderScrollComponent: scrollProps => /*#__PURE__*/React.createElement(ScrollView, scrollProps)
50
+ })));
51
+ exports.FlatList = FlatList;
52
+ //# sourceMappingURL=GestureComponents.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureComponents.web.tsx"],"names":["ScrollView","RNScrollView","disallowInterruption","Switch","RNSwitch","shouldCancelWhenOutside","shouldActivateOnStart","TextInput","RNTextInput","DrawerLayoutAndroid","console","warn","RefreshControl","View","FlatList","React","forwardRef","props","ref","scrollProps"],"mappings":";;;;;;;AAAA;;AACA;;AASA;;;;;;;;;;AAEO,MAAMA,UAAU,GAAG,kCAAoBC,uBAApB,EAAkC;AAC1DC,EAAAA,oBAAoB,EAAE;AADoC,CAAlC,CAAnB;;AAIA,MAAMC,MAAM,GAAG,kCAAoBC,mBAApB,EAA8B;AAClDC,EAAAA,uBAAuB,EAAE,KADyB;AAElDC,EAAAA,qBAAqB,EAAE,IAF2B;AAGlDJ,EAAAA,oBAAoB,EAAE;AAH4B,CAA9B,CAAf;;AAKA,MAAMK,SAAS,GAAG,kCAAoBC,sBAApB,CAAlB;;;AACA,MAAMC,mBAAmB,GAAG,MAAM;AACvCC,EAAAA,OAAO,CAACC,IAAR,CAAa,8CAAb;AACA,sBAAO,oBAAC,iBAAD,OAAP;AACD,CAHM,C,CAKP;AACA;AACA;;;;AACO,MAAMC,cAAc,GAAG,kCAAoBC,iBAApB,CAAvB;;AAEA,MAAMC,QAAQ,gBAAGC,KAAK,CAACC,UAAN,CACtB,CAAoBC,KAApB,EAAiDC,GAAjD,kBACE,oBAAC,qBAAD;AACE,EAAA,GAAG,EAAEA;AADP,GAEMD,KAFN;AAGE,EAAA,qBAAqB,EAAGE,WAAD,iBAAiB,oBAAC,UAAD,EAAgBA,WAAhB;AAH1C,GAFoB,CAAjB","sourcesContent":["import * as React from 'react';\nimport {\n FlatList as RNFlatList,\n Switch as RNSwitch,\n TextInput as RNTextInput,\n ScrollView as RNScrollView,\n FlatListProps,\n View,\n} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\n\nexport const ScrollView = createNativeWrapper(RNScrollView, {\n disallowInterruption: false,\n});\n\nexport const Switch = createNativeWrapper(RNSwitch, {\n shouldCancelWhenOutside: false,\n shouldActivateOnStart: true,\n disallowInterruption: true,\n});\nexport const TextInput = createNativeWrapper(RNTextInput);\nexport const DrawerLayoutAndroid = () => {\n console.warn('DrawerLayoutAndroid is not supported on web!');\n return <View />;\n};\n\n// RefreshControl is implemented as a functional component, rendering a View\n// NativeViewGestureHandler needs to set a ref on its child, which cannot be done\n// on functional components\nexport const RefreshControl = createNativeWrapper(View);\n\nexport const FlatList = React.forwardRef(\n <ItemT extends any>(props: FlatListProps<ItemT>, ref: any) => (\n <RNFlatList\n ref={ref}\n {...props}\n renderScrollComponent={(scrollProps) => <ScrollView {...scrollProps} />}\n />\n )\n);\n"]}
@@ -5,20 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var React = _interopRequireWildcard(require("react"));
8
+ var _RNGestureHandlerButtonNativeComponent = _interopRequireDefault(require("../specs/RNGestureHandlerButtonNativeComponent"));
9
9
 
10
- var _reactNative = require("react-native");
11
-
12
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
13
-
14
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
-
16
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
-
18
- var _default = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(_reactNative.View, _extends({
19
- ref: ref,
20
- accessibilityRole: "button"
21
- }, props)));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
11
 
12
+ var _default = _RNGestureHandlerButtonNativeComponent.default;
23
13
  exports.default = _default;
24
14
  //# sourceMappingURL=GestureHandlerButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["GestureHandlerButton.tsx"],"names":["React","forwardRef","props","ref"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;4BAEeA,KAAK,CAACC,UAAN,CAAuB,CAACC,KAAD,EAAQC,GAAR,kBACpC,oBAAC,iBAAD;AAAM,EAAA,GAAG,EAAEA,GAAX;AAAgB,EAAA,iBAAiB,EAAC;AAAlC,GAA+CD,KAA/C,EADa,C","sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\n\nexport default React.forwardRef<View>((props, ref) => (\n <View ref={ref} accessibilityRole=\"button\" {...props} />\n));\n"]}
1
+ {"version":3,"sources":["GestureHandlerButton.tsx"],"names":["RNGestureHandlerButtonNativeComponent"],"mappings":";;;;;;;AAEA;;;;eAEeA,8C","sourcesContent":["import { HostComponent } from 'react-native';\nimport { RawButtonProps } from './GestureButtons';\nimport RNGestureHandlerButtonNativeComponent from '../specs/RNGestureHandlerButtonNativeComponent';\n\nexport default RNGestureHandlerButtonNativeComponent as HostComponent<RawButtonProps>;\n"]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var React = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
13
+
14
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
16
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
+
18
+ var _default = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(_reactNative.View, _extends({
19
+ ref: ref,
20
+ accessibilityRole: "button"
21
+ }, props)));
22
+
23
+ exports.default = _default;
24
+ //# sourceMappingURL=GestureHandlerButton.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureHandlerButton.web.tsx"],"names":["React","forwardRef","props","ref"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;4BAEeA,KAAK,CAACC,UAAN,CAAuB,CAACC,KAAD,EAAQC,GAAR,kBACpC,oBAAC,iBAAD;AAAM,EAAA,GAAG,EAAEA,GAAX;AAAgB,EAAA,iBAAiB,EAAC;AAAlC,GAA+CD,KAA/C,EADa,C","sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\n\nexport default React.forwardRef<View>((props, ref) => (\n <View ref={ref} accessibilityRole=\"button\" {...props} />\n));\n"]}
@@ -9,6 +9,8 @@ var React = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _init = require("../init");
13
+
12
14
  var _GestureHandlerRootViewContext = _interopRequireDefault(require("../GestureHandlerRootViewContext"));
13
15
 
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -23,6 +25,10 @@ function GestureHandlerRootView({
23
25
  style,
24
26
  ...rest
25
27
  }) {
28
+ // try initialize fabric on the first render, at this point we can
29
+ // reliably check if fabric is enabled (the function contains a flag
30
+ // to make sure it's called only once)
31
+ (0, _init.maybeInitializeFabric)();
26
32
  return /*#__PURE__*/React.createElement(_GestureHandlerRootViewContext.default.Provider, {
27
33
  value: true
28
34
  }, /*#__PURE__*/React.createElement(_reactNative.View, _extends({
@@ -1 +1 @@
1
- {"version":3,"sources":["GestureHandlerRootView.tsx"],"names":["GestureHandlerRootView","style","rest","styles","container","StyleSheet","create","flex"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;;;;;;;AAKe,SAASA,sBAAT,CAAgC;AAC7CC,EAAAA,KAD6C;AAE7C,KAAGC;AAF0C,CAAhC,EAGiB;AAC9B,sBACE,oBAAC,sCAAD,CAA+B,QAA/B;AAAwC,IAAA,KAAK;AAA7C,kBACE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAED,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAWE,MAAM,CAACC;AAA7B,KAA4CF,IAA5C,EADF,CADF;AAKD;;AAED,MAAMC,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,SAAS,EAAE;AAAEG,IAAAA,IAAI,EAAE;AAAR;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport { PropsWithChildren } from 'react';\nimport { View, ViewProps, StyleSheet } from 'react-native';\nimport GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';\n\nexport interface GestureHandlerRootViewProps\n extends PropsWithChildren<ViewProps> {}\n\nexport default function GestureHandlerRootView({\n style,\n ...rest\n}: GestureHandlerRootViewProps) {\n return (\n <GestureHandlerRootViewContext.Provider value>\n <View style={style ?? styles.container} {...rest} />\n </GestureHandlerRootViewContext.Provider>\n );\n}\n\nconst styles = StyleSheet.create({\n container: { flex: 1 },\n});\n"]}
1
+ {"version":3,"sources":["GestureHandlerRootView.tsx"],"names":["GestureHandlerRootView","style","rest","styles","container","StyleSheet","create","flex"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;;;;;;;;;AAKe,SAASA,sBAAT,CAAgC;AAC7CC,EAAAA,KAD6C;AAE7C,KAAGC;AAF0C,CAAhC,EAGiB;AAC9B;AACA;AACA;AACA;AAEA,sBACE,oBAAC,sCAAD,CAA+B,QAA/B;AAAwC,IAAA,KAAK;AAA7C,kBACE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAED,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAWE,MAAM,CAACC;AAA7B,KAA4CF,IAA5C,EADF,CADF;AAKD;;AAED,MAAMC,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,SAAS,EAAE;AAAEG,IAAAA,IAAI,EAAE;AAAR;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport { PropsWithChildren } from 'react';\nimport { View, ViewProps, StyleSheet } from 'react-native';\nimport { maybeInitializeFabric } from '../init';\nimport GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';\n\nexport interface GestureHandlerRootViewProps\n extends PropsWithChildren<ViewProps> {}\n\nexport default function GestureHandlerRootView({\n style,\n ...rest\n}: GestureHandlerRootViewProps) {\n // try initialize fabric on the first render, at this point we can\n // reliably check if fabric is enabled (the function contains a flag\n // to make sure it's called only once)\n maybeInitializeFabric();\n\n return (\n <GestureHandlerRootViewContext.Provider value>\n <View style={style ?? styles.container} {...rest} />\n </GestureHandlerRootViewContext.Provider>\n );\n}\n\nconst styles = StyleSheet.create({\n container: { flex: 1 },\n});\n"]}
@@ -9,8 +9,6 @@ var React = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
- var _init = require("../init");
13
-
14
12
  var _GestureHandlerRootViewContext = _interopRequireDefault(require("../GestureHandlerRootViewContext"));
15
13
 
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -25,10 +23,6 @@ function GestureHandlerRootView({
25
23
  style,
26
24
  ...rest
27
25
  }) {
28
- // try initialize fabric on the first render, at this point we can
29
- // reliably check if fabric is enabled (the function contains a flag
30
- // to make sure it's called only once)
31
- (0, _init.maybeInitializeFabric)();
32
26
  return /*#__PURE__*/React.createElement(_GestureHandlerRootViewContext.default.Provider, {
33
27
  value: true
34
28
  }, /*#__PURE__*/React.createElement(_reactNative.View, _extends({
@@ -41,4 +35,4 @@ const styles = _reactNative.StyleSheet.create({
41
35
  flex: 1
42
36
  }
43
37
  });
44
- //# sourceMappingURL=GestureHandlerRootView.native.js.map
38
+ //# sourceMappingURL=GestureHandlerRootView.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureHandlerRootView.web.tsx"],"names":["GestureHandlerRootView","style","rest","styles","container","StyleSheet","create","flex"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;;;;;;;AAKe,SAASA,sBAAT,CAAgC;AAC7CC,EAAAA,KAD6C;AAE7C,KAAGC;AAF0C,CAAhC,EAGiB;AAC9B,sBACE,oBAAC,sCAAD,CAA+B,QAA/B;AAAwC,IAAA,KAAK;AAA7C,kBACE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAED,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAWE,MAAM,CAACC;AAA7B,KAA4CF,IAA5C,EADF,CADF;AAKD;;AAED,MAAMC,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,SAAS,EAAE;AAAEG,IAAAA,IAAI,EAAE;AAAR;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport { PropsWithChildren } from 'react';\nimport { View, ViewProps, StyleSheet } from 'react-native';\nimport GestureHandlerRootViewContext from '../GestureHandlerRootViewContext';\n\nexport interface GestureHandlerRootViewProps\n extends PropsWithChildren<ViewProps> {}\n\nexport default function GestureHandlerRootView({\n style,\n ...rest\n}: GestureHandlerRootViewProps) {\n return (\n <GestureHandlerRootViewContext.Provider value>\n <View style={style ?? styles.container} {...rest} />\n </GestureHandlerRootViewContext.Provider>\n );\n}\n\nconst styles = StyleSheet.create({\n container: { flex: 1 },\n});\n"]}
@@ -5,7 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getReactNativeVersion = getReactNativeVersion;
7
7
 
8
+ var _package = _interopRequireDefault(require("react-native/package.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const [majorStr, minorStr] = _package.default.version.split('.');
13
+
14
+ const REACT_NATIVE_VERSION = {
15
+ major: parseInt(majorStr, 10),
16
+ minor: parseInt(minorStr, 10)
17
+ };
18
+
8
19
  function getReactNativeVersion() {
9
- throw new Error('getReactNativeVersion is not supported on web');
20
+ return REACT_NATIVE_VERSION;
10
21
  }
11
22
  //# sourceMappingURL=getReactNativeVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["getReactNativeVersion.ts"],"names":["getReactNativeVersion","Error"],"mappings":";;;;;;;AAAO,SAASA,qBAAT,GAAiC;AACtC,QAAM,IAAIC,KAAJ,CAAU,+CAAV,CAAN;AACD","sourcesContent":["export function getReactNativeVersion() {\n throw new Error('getReactNativeVersion is not supported on web');\n}\n"]}
1
+ {"version":3,"sources":["getReactNativeVersion.ts"],"names":["majorStr","minorStr","pack","version","split","REACT_NATIVE_VERSION","major","parseInt","minor","getReactNativeVersion"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAM,CAACA,QAAD,EAAWC,QAAX,IAAuBC,iBAAKC,OAAL,CAAaC,KAAb,CAAmB,GAAnB,CAA7B;;AACA,MAAMC,oBAAoB,GAAG;AAC3BC,EAAAA,KAAK,EAAEC,QAAQ,CAACP,QAAD,EAAW,EAAX,CADY;AAE3BQ,EAAAA,KAAK,EAAED,QAAQ,CAACN,QAAD,EAAW,EAAX;AAFY,CAA7B;;AAKO,SAASQ,qBAAT,GAAiC;AACtC,SAAOJ,oBAAP;AACD","sourcesContent":["import pack from 'react-native/package.json';\n\nconst [majorStr, minorStr] = pack.version.split('.');\nconst REACT_NATIVE_VERSION = {\n major: parseInt(majorStr, 10),\n minor: parseInt(minorStr, 10),\n};\n\nexport function getReactNativeVersion() {\n return REACT_NATIVE_VERSION;\n}\n"]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getReactNativeVersion = getReactNativeVersion;
7
+
8
+ function getReactNativeVersion() {
9
+ throw new Error('getReactNativeVersion is not supported on web');
10
+ }
11
+ //# sourceMappingURL=getReactNativeVersion.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["getReactNativeVersion.web.ts"],"names":["getReactNativeVersion","Error"],"mappings":";;;;;;;AAAO,SAASA,qBAAT,GAAiC;AACtC,QAAM,IAAIC,KAAJ,CAAU,+CAAV,CAAN;AACD","sourcesContent":["export function getReactNativeVersion() {\n throw new Error('getReactNativeVersion is not supported on web');\n}\n"]}