react-native-gesture-handler 1.10.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (580) hide show
  1. package/DrawerLayout/package.json +3 -3
  2. package/README.md +7 -6
  3. package/Swipeable/package.json +3 -3
  4. package/android/build.gradle +48 -1
  5. package/android/common/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -0
  6. package/android/gradle.properties +19 -0
  7. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.kt +18 -0
  8. package/android/lib/src/main/java/com/swmansion/gesturehandler/Extensions.kt +11 -0
  9. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.kt +96 -0
  10. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.kt +713 -0
  11. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.kt +8 -0
  12. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +562 -0
  13. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.kt +8 -0
  14. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.kt +21 -0
  15. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.kt +49 -0
  16. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.kt +97 -0
  17. package/android/lib/src/main/java/com/swmansion/gesturehandler/ManualGestureHandler.kt +11 -0
  18. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.kt +129 -0
  19. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.kt +9 -0
  20. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +289 -0
  21. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.kt +88 -0
  22. package/android/lib/src/main/java/com/swmansion/gesturehandler/{PointerEventsConfig.java → PointerEventsConfig.kt} +3 -5
  23. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.kt +125 -0
  24. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.kt +79 -0
  25. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.kt +167 -0
  26. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.kt +10 -0
  27. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +348 -0
  28. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +57 -0
  29. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +59 -0
  30. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.kt +8 -0
  31. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +61 -0
  32. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +686 -0
  33. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.kt +17 -0
  34. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +95 -0
  35. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +132 -0
  36. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.kt +5 -0
  37. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +68 -0
  38. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt +34 -0
  39. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +66 -0
  40. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +69 -0
  41. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +51 -0
  42. package/ios/Handlers/RNFlingHandler.m +78 -5
  43. package/ios/Handlers/RNForceTouchHandler.m +29 -4
  44. package/ios/Handlers/RNLongPressHandler.m +105 -3
  45. package/ios/Handlers/RNManualHandler.h +4 -0
  46. package/ios/Handlers/RNManualHandler.m +73 -0
  47. package/ios/Handlers/RNNativeViewHandler.m +30 -2
  48. package/ios/Handlers/RNPanHandler.m +64 -4
  49. package/ios/Handlers/RNPinchHandler.m +61 -2
  50. package/ios/Handlers/RNRotationHandler.m +60 -1
  51. package/ios/Handlers/RNTapHandler.m +55 -8
  52. package/ios/RNGestureHandler.h +18 -4
  53. package/ios/RNGestureHandler.m +123 -13
  54. package/ios/RNGestureHandler.xcodeproj/project.xcworkspace/xcuserdata/jakubpiasecki.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  55. package/ios/RNGestureHandler.xcodeproj/xcuserdata/jakubpiasecki.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  56. package/ios/RNGestureHandlerEvents.h +9 -0
  57. package/ios/RNGestureHandlerEvents.m +34 -0
  58. package/ios/RNGestureHandlerManager.h +7 -0
  59. package/ios/RNGestureHandlerManager.m +62 -34
  60. package/ios/RNGestureHandlerModule.m +39 -3
  61. package/ios/RNGestureHandlerPointerTracker.h +25 -0
  62. package/ios/RNGestureHandlerPointerTracker.m +237 -0
  63. package/ios/RNGestureHandlerRegistry.h +1 -0
  64. package/ios/RNGestureHandlerRegistry.m +10 -0
  65. package/ios/RNGestureHandlerStateManager.h +5 -0
  66. package/ios/RNManualActivationRecognizer.h +10 -0
  67. package/ios/RNManualActivationRecognizer.m +80 -0
  68. package/ios/RNRootViewGestureRecognizer.m +1 -1
  69. package/ios/RNTouchEventType.h +9 -0
  70. package/jestSetup.js +7 -1
  71. package/lib/commonjs/Directions.js +15 -0
  72. package/lib/commonjs/Directions.js.map +1 -0
  73. package/lib/commonjs/EventType.js +16 -0
  74. package/lib/commonjs/EventType.js.map +1 -0
  75. package/lib/commonjs/GestureHandlerRootView.android.js +24 -0
  76. package/lib/commonjs/GestureHandlerRootView.android.js.map +1 -0
  77. package/lib/commonjs/GestureHandlerRootView.js +20 -0
  78. package/lib/commonjs/GestureHandlerRootView.js.map +1 -0
  79. package/lib/commonjs/PlatformConstants.js +15 -0
  80. package/lib/commonjs/PlatformConstants.js.map +1 -0
  81. package/lib/commonjs/PlatformConstants.web.js +14 -0
  82. package/lib/commonjs/PlatformConstants.web.js.map +1 -0
  83. package/lib/commonjs/RNGestureHandlerModule.js +22 -0
  84. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -0
  85. package/lib/commonjs/RNGestureHandlerModule.web.js +80 -0
  86. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
  87. package/lib/commonjs/State.js +18 -0
  88. package/lib/commonjs/State.js.map +1 -0
  89. package/lib/commonjs/components/DrawerLayout.js +535 -0
  90. package/lib/commonjs/components/DrawerLayout.js.map +1 -0
  91. package/lib/commonjs/components/GestureButtons.js +207 -0
  92. package/lib/commonjs/components/GestureButtons.js.map +1 -0
  93. package/lib/commonjs/components/GestureComponents.js +76 -0
  94. package/lib/commonjs/components/GestureComponents.js.map +1 -0
  95. package/lib/commonjs/components/GestureComponents.web.js +46 -0
  96. package/lib/commonjs/components/GestureComponents.web.js.map +1 -0
  97. package/lib/commonjs/components/GestureHandlerButton.js +13 -0
  98. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -0
  99. package/lib/commonjs/components/GestureHandlerButton.web.js +24 -0
  100. package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -0
  101. package/lib/commonjs/components/Swipeable.js +365 -0
  102. package/lib/commonjs/components/Swipeable.js.map +1 -0
  103. package/lib/commonjs/components/touchables/GenericTouchable.js +278 -0
  104. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -0
  105. package/lib/commonjs/components/touchables/TouchableHighlight.js +109 -0
  106. package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -0
  107. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +100 -0
  108. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
  109. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +12 -0
  110. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -0
  111. package/lib/commonjs/components/touchables/TouchableOpacity.js +75 -0
  112. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -0
  113. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +26 -0
  114. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -0
  115. package/lib/commonjs/components/touchables/index.js +40 -0
  116. package/lib/commonjs/components/touchables/index.js.map +1 -0
  117. package/lib/commonjs/gestureHandlerRootHOC.js +39 -0
  118. package/lib/commonjs/gestureHandlerRootHOC.js.map +1 -0
  119. package/lib/commonjs/handlers/FlingGestureHandler.js +23 -0
  120. package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -0
  121. package/lib/commonjs/handlers/ForceTouchGestureHandler.js +44 -0
  122. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -0
  123. package/lib/commonjs/handlers/LongPressGestureHandler.js +23 -0
  124. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -0
  125. package/lib/commonjs/handlers/NativeViewGestureHandler.js +25 -0
  126. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -0
  127. package/lib/commonjs/handlers/PanGestureHandler.js +121 -0
  128. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -0
  129. package/lib/commonjs/handlers/PinchGestureHandler.js +21 -0
  130. package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -0
  131. package/lib/commonjs/handlers/RotationGestureHandler.js +21 -0
  132. package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -0
  133. package/lib/commonjs/handlers/TapGestureHandler.js +23 -0
  134. package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -0
  135. package/lib/commonjs/handlers/createHandler.js +373 -0
  136. package/lib/commonjs/handlers/createHandler.js.map +1 -0
  137. package/lib/commonjs/handlers/createNativeWrapper.js +70 -0
  138. package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -0
  139. package/lib/commonjs/handlers/gestureHandlerCommon.js +80 -0
  140. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -0
  141. package/lib/commonjs/handlers/gestureHandlerTypesCompat.js +2 -0
  142. package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -0
  143. package/lib/commonjs/handlers/gestures/GestureDetector.js +426 -0
  144. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
  145. package/lib/commonjs/handlers/gestures/eventReceiver.js +124 -0
  146. package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -0
  147. package/lib/commonjs/handlers/gestures/flingGesture.js +34 -0
  148. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -0
  149. package/lib/commonjs/handlers/gestures/forceTouchGesture.js +39 -0
  150. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -0
  151. package/lib/commonjs/handlers/gestures/gesture.js +185 -0
  152. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -0
  153. package/lib/commonjs/handlers/gestures/gestureComposition.js +94 -0
  154. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -0
  155. package/lib/commonjs/handlers/gestures/gestureObjects.js +85 -0
  156. package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -0
  157. package/lib/commonjs/handlers/gestures/gestureStateManager.js +58 -0
  158. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -0
  159. package/lib/commonjs/handlers/gestures/longPressGesture.js +34 -0
  160. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -0
  161. package/lib/commonjs/handlers/gestures/manualGesture.js +19 -0
  162. package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -0
  163. package/lib/commonjs/handlers/gestures/nativeGesture.js +34 -0
  164. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -0
  165. package/lib/commonjs/handlers/gestures/panGesture.js +116 -0
  166. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -0
  167. package/lib/commonjs/handlers/gestures/pinchGesture.js +19 -0
  168. package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -0
  169. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +24 -0
  170. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -0
  171. package/lib/commonjs/handlers/gestures/rotationGesture.js +19 -0
  172. package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -0
  173. package/lib/commonjs/handlers/gestures/tapGesture.js +59 -0
  174. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -0
  175. package/lib/commonjs/handlers/handlersRegistry.js +31 -0
  176. package/lib/commonjs/handlers/handlersRegistry.js.map +1 -0
  177. package/lib/commonjs/index.js +338 -0
  178. package/lib/commonjs/index.js.map +1 -0
  179. package/lib/commonjs/init.js +13 -0
  180. package/lib/commonjs/init.js.map +1 -0
  181. package/lib/commonjs/mocks.js +64 -0
  182. package/lib/commonjs/mocks.js.map +1 -0
  183. package/lib/commonjs/typeUtils.js +2 -0
  184. package/lib/commonjs/typeUtils.js.map +1 -0
  185. package/lib/commonjs/utils.js +15 -0
  186. package/lib/commonjs/utils.js.map +1 -0
  187. package/lib/commonjs/web/DiscreteGestureHandler.js +105 -0
  188. package/lib/commonjs/web/DiscreteGestureHandler.js.map +1 -0
  189. package/lib/commonjs/web/DraggingGestureHandler.js +53 -0
  190. package/lib/commonjs/web/DraggingGestureHandler.js.map +1 -0
  191. package/lib/commonjs/web/Errors.js +16 -0
  192. package/lib/commonjs/web/Errors.js.map +1 -0
  193. package/lib/commonjs/web/FlingGestureHandler.js +170 -0
  194. package/lib/commonjs/web/FlingGestureHandler.js.map +1 -0
  195. package/lib/commonjs/web/GestureHandler.js +533 -0
  196. package/lib/commonjs/web/GestureHandler.js.map +1 -0
  197. package/lib/commonjs/web/IndiscreteGestureHandler.js +54 -0
  198. package/lib/commonjs/web/IndiscreteGestureHandler.js.map +1 -0
  199. package/lib/commonjs/web/LongPressGestureHandler.js +71 -0
  200. package/lib/commonjs/web/LongPressGestureHandler.js.map +1 -0
  201. package/lib/commonjs/web/NativeViewGestureHandler.js +62 -0
  202. package/lib/commonjs/web/NativeViewGestureHandler.js.map +1 -0
  203. package/lib/commonjs/web/NodeManager.js +43 -0
  204. package/lib/commonjs/web/NodeManager.js.map +1 -0
  205. package/lib/commonjs/web/PanGestureHandler.js +189 -0
  206. package/lib/commonjs/web/PanGestureHandler.js.map +1 -0
  207. package/lib/commonjs/web/PinchGestureHandler.js +40 -0
  208. package/lib/commonjs/web/PinchGestureHandler.js.map +1 -0
  209. package/lib/commonjs/web/PressGestureHandler.js +188 -0
  210. package/lib/commonjs/web/PressGestureHandler.js.map +1 -0
  211. package/lib/commonjs/web/RotationGestureHandler.js +44 -0
  212. package/lib/commonjs/web/RotationGestureHandler.js.map +1 -0
  213. package/lib/commonjs/web/TapGestureHandler.js +192 -0
  214. package/lib/commonjs/web/TapGestureHandler.js.map +1 -0
  215. package/lib/commonjs/web/constants.js +64 -0
  216. package/lib/commonjs/web/constants.js.map +1 -0
  217. package/lib/commonjs/web/utils.js +42 -0
  218. package/lib/commonjs/web/utils.js.map +1 -0
  219. package/lib/module/Directions.js +7 -0
  220. package/lib/module/Directions.js.map +1 -0
  221. package/lib/module/EventType.js +8 -0
  222. package/lib/module/EventType.js.map +1 -0
  223. package/lib/module/GestureHandlerRootView.android.js +10 -0
  224. package/lib/module/GestureHandlerRootView.android.js.map +1 -0
  225. package/lib/module/GestureHandlerRootView.js +7 -0
  226. package/lib/module/GestureHandlerRootView.js.map +1 -0
  227. package/lib/module/PlatformConstants.js +5 -0
  228. package/lib/module/PlatformConstants.js.map +1 -0
  229. package/lib/module/PlatformConstants.web.js +7 -0
  230. package/lib/module/PlatformConstants.web.js.map +1 -0
  231. package/lib/module/RNGestureHandlerModule.js +13 -0
  232. package/lib/module/RNGestureHandlerModule.js.map +1 -0
  233. package/lib/module/RNGestureHandlerModule.web.js +56 -0
  234. package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
  235. package/lib/module/State.js +10 -0
  236. package/lib/module/State.js.map +1 -0
  237. package/lib/module/components/DrawerLayout.js +520 -0
  238. package/lib/module/components/DrawerLayout.js.map +1 -0
  239. package/lib/module/components/GestureButtons.js +172 -0
  240. package/lib/module/components/GestureButtons.js.map +1 -0
  241. package/lib/module/components/GestureComponents.js +53 -0
  242. package/lib/module/components/GestureComponents.js.map +1 -0
  243. package/lib/module/components/GestureComponents.web.js +25 -0
  244. package/lib/module/components/GestureComponents.web.js.map +1 -0
  245. package/{dist/src → lib/module}/components/GestureHandlerButton.js +1 -0
  246. package/lib/module/components/GestureHandlerButton.js.map +1 -0
  247. package/lib/module/components/GestureHandlerButton.web.js +9 -0
  248. package/lib/module/components/GestureHandlerButton.web.js.map +1 -0
  249. package/lib/module/components/Swipeable.js +347 -0
  250. package/lib/module/components/Swipeable.js.map +1 -0
  251. package/lib/module/components/touchables/GenericTouchable.js +262 -0
  252. package/lib/module/components/touchables/GenericTouchable.js.map +1 -0
  253. package/lib/module/components/touchables/TouchableHighlight.js +95 -0
  254. package/lib/module/components/touchables/TouchableHighlight.js.map +1 -0
  255. package/lib/module/components/touchables/TouchableNativeFeedback.android.js +84 -0
  256. package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
  257. package/{dist/src → lib/module}/components/touchables/TouchableNativeFeedback.js +1 -0
  258. package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -0
  259. package/lib/module/components/touchables/TouchableOpacity.js +61 -0
  260. package/lib/module/components/touchables/TouchableOpacity.js.map +1 -0
  261. package/lib/module/components/touchables/TouchableWithoutFeedback.js +10 -0
  262. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -0
  263. package/{dist/src → lib/module}/components/touchables/index.js +1 -0
  264. package/lib/module/components/touchables/index.js.map +1 -0
  265. package/lib/module/gestureHandlerRootHOC.js +21 -0
  266. package/lib/module/gestureHandlerRootHOC.js.map +1 -0
  267. package/lib/module/handlers/FlingGestureHandler.js +10 -0
  268. package/lib/module/handlers/FlingGestureHandler.js.map +1 -0
  269. package/lib/module/handlers/ForceTouchGestureHandler.js +29 -0
  270. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -0
  271. package/lib/module/handlers/LongPressGestureHandler.js +10 -0
  272. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -0
  273. package/lib/module/handlers/NativeViewGestureHandler.js +11 -0
  274. package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -0
  275. package/lib/module/handlers/PanGestureHandler.js +106 -0
  276. package/lib/module/handlers/PanGestureHandler.js.map +1 -0
  277. package/lib/module/handlers/PinchGestureHandler.js +9 -0
  278. package/lib/module/handlers/PinchGestureHandler.js.map +1 -0
  279. package/lib/module/handlers/RotationGestureHandler.js +9 -0
  280. package/lib/module/handlers/RotationGestureHandler.js.map +1 -0
  281. package/lib/module/handlers/TapGestureHandler.js +10 -0
  282. package/lib/module/handlers/TapGestureHandler.js.map +1 -0
  283. package/lib/module/handlers/createHandler.js +348 -0
  284. package/lib/module/handlers/createHandler.js.map +1 -0
  285. package/lib/module/handlers/createNativeWrapper.js +58 -0
  286. package/lib/module/handlers/createNativeWrapper.js.map +1 -0
  287. package/lib/module/handlers/gestureHandlerCommon.js +66 -0
  288. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -0
  289. package/lib/module/handlers/gestureHandlerTypesCompat.js +2 -0
  290. package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -0
  291. package/lib/module/handlers/gestures/GestureDetector.js +389 -0
  292. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
  293. package/lib/module/handlers/gestures/eventReceiver.js +109 -0
  294. package/lib/module/handlers/gestures/eventReceiver.js.map +1 -0
  295. package/lib/module/handlers/gestures/flingGesture.js +24 -0
  296. package/lib/module/handlers/gestures/flingGesture.js.map +1 -0
  297. package/lib/module/handlers/gestures/forceTouchGesture.js +29 -0
  298. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -0
  299. package/lib/module/handlers/gestures/gesture.js +167 -0
  300. package/lib/module/handlers/gestures/gesture.js.map +1 -0
  301. package/lib/module/handlers/gestures/gestureComposition.js +79 -0
  302. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -0
  303. package/lib/module/handlers/gestures/gestureObjects.js +67 -0
  304. package/lib/module/handlers/gestures/gestureObjects.js.map +1 -0
  305. package/lib/module/handlers/gestures/gestureStateManager.js +48 -0
  306. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -0
  307. package/lib/module/handlers/gestures/longPressGesture.js +24 -0
  308. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -0
  309. package/lib/module/handlers/gestures/manualGesture.js +9 -0
  310. package/lib/module/handlers/gestures/manualGesture.js.map +1 -0
  311. package/lib/module/handlers/gestures/nativeGesture.js +24 -0
  312. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -0
  313. package/lib/module/handlers/gestures/panGesture.js +106 -0
  314. package/lib/module/handlers/gestures/panGesture.js.map +1 -0
  315. package/lib/module/handlers/gestures/pinchGesture.js +9 -0
  316. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -0
  317. package/lib/module/handlers/gestures/reanimatedWrapper.js +19 -0
  318. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -0
  319. package/lib/module/handlers/gestures/rotationGesture.js +9 -0
  320. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -0
  321. package/lib/module/handlers/gestures/tapGesture.js +49 -0
  322. package/lib/module/handlers/gestures/tapGesture.js.map +1 -0
  323. package/lib/module/handlers/handlersRegistry.js +16 -0
  324. package/lib/module/handlers/handlersRegistry.js.map +1 -0
  325. package/lib/module/index.js +34 -0
  326. package/lib/module/index.js.map +1 -0
  327. package/lib/module/init.js +5 -0
  328. package/lib/module/init.js.map +1 -0
  329. package/lib/module/mocks.js +54 -0
  330. package/lib/module/mocks.js.map +1 -0
  331. package/lib/module/typeUtils.js +2 -0
  332. package/lib/module/typeUtils.js.map +1 -0
  333. package/lib/module/utils.js +8 -0
  334. package/lib/module/utils.js.map +1 -0
  335. package/lib/module/web/DiscreteGestureHandler.js +94 -0
  336. package/lib/module/web/DiscreteGestureHandler.js.map +1 -0
  337. package/lib/module/web/DraggingGestureHandler.js +40 -0
  338. package/lib/module/web/DraggingGestureHandler.js.map +1 -0
  339. package/lib/module/web/Errors.js +7 -0
  340. package/lib/module/web/Errors.js.map +1 -0
  341. package/lib/module/web/FlingGestureHandler.js +156 -0
  342. package/lib/module/web/FlingGestureHandler.js.map +1 -0
  343. package/lib/module/web/GestureHandler.js +518 -0
  344. package/lib/module/web/GestureHandler.js.map +1 -0
  345. package/lib/module/web/IndiscreteGestureHandler.js +44 -0
  346. package/lib/module/web/IndiscreteGestureHandler.js.map +1 -0
  347. package/lib/module/web/LongPressGestureHandler.js +58 -0
  348. package/lib/module/web/LongPressGestureHandler.js.map +1 -0
  349. package/lib/module/web/NativeViewGestureHandler.js +45 -0
  350. package/lib/module/web/NativeViewGestureHandler.js.map +1 -0
  351. package/lib/module/web/NodeManager.js +30 -0
  352. package/lib/module/web/NodeManager.js.map +1 -0
  353. package/lib/module/web/PanGestureHandler.js +175 -0
  354. package/lib/module/web/PanGestureHandler.js.map +1 -0
  355. package/lib/module/web/PinchGestureHandler.js +29 -0
  356. package/lib/module/web/PinchGestureHandler.js.map +1 -0
  357. package/lib/module/web/PressGestureHandler.js +174 -0
  358. package/lib/module/web/PressGestureHandler.js.map +1 -0
  359. package/lib/module/web/RotationGestureHandler.js +32 -0
  360. package/lib/module/web/RotationGestureHandler.js.map +1 -0
  361. package/lib/module/web/TapGestureHandler.js +180 -0
  362. package/lib/module/web/TapGestureHandler.js.map +1 -0
  363. package/lib/module/web/constants.js +43 -0
  364. package/lib/module/web/constants.js.map +1 -0
  365. package/lib/module/web/utils.js +19 -0
  366. package/lib/module/web/utils.js.map +1 -0
  367. package/lib/typescript/Directions.d.ts +7 -0
  368. package/lib/typescript/EventType.d.ts +8 -0
  369. package/lib/typescript/GestureHandlerRootView.android.d.ts +2 -0
  370. package/lib/typescript/GestureHandlerRootView.d.ts +5 -0
  371. package/{dist/src → lib/typescript}/PlatformConstants.d.ts +0 -0
  372. package/{dist/src → lib/typescript}/PlatformConstants.web.d.ts +0 -0
  373. package/{dist/src → lib/typescript}/RNGestureHandlerModule.d.ts +1 -8
  374. package/{dist/src → lib/typescript}/RNGestureHandlerModule.web.d.ts +1 -1
  375. package/{dist/src → lib/typescript}/State.d.ts +0 -0
  376. package/{dist/src → lib/typescript}/components/DrawerLayout.d.ts +50 -1
  377. package/{dist/src → lib/typescript}/components/GestureButtons.d.ts +36 -0
  378. package/lib/typescript/components/GestureComponents.d.ts +18 -0
  379. package/{dist/src → lib/typescript}/components/GestureComponents.web.d.ts +4 -4
  380. package/{dist/src → lib/typescript}/components/GestureHandlerButton.d.ts +0 -0
  381. package/{dist/src → lib/typescript}/components/GestureHandlerButton.web.d.ts +0 -0
  382. package/lib/typescript/components/Swipeable.d.ts +150 -0
  383. package/{dist/src → lib/typescript}/components/touchables/GenericTouchable.d.ts +3 -3
  384. package/{dist/src → lib/typescript}/components/touchables/TouchableHighlight.d.ts +1 -0
  385. package/{dist/src → lib/typescript}/components/touchables/TouchableNativeFeedback.android.d.ts +0 -0
  386. package/{dist/src → lib/typescript}/components/touchables/TouchableNativeFeedback.d.ts +0 -0
  387. package/{dist/src → lib/typescript}/components/touchables/TouchableOpacity.d.ts +1 -0
  388. package/{dist/src → lib/typescript}/components/touchables/TouchableWithoutFeedback.d.ts +0 -0
  389. package/{dist/src → lib/typescript}/components/touchables/index.d.ts +0 -0
  390. package/{dist/src → lib/typescript}/gestureHandlerRootHOC.d.ts +0 -0
  391. package/lib/typescript/handlers/FlingGestureHandler.d.ts +33 -0
  392. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +43 -0
  393. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +55 -0
  394. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +27 -0
  395. package/lib/typescript/handlers/PanGestureHandler.d.ts +137 -0
  396. package/lib/typescript/handlers/PinchGestureHandler.d.ts +28 -0
  397. package/lib/typescript/handlers/RotationGestureHandler.d.ts +28 -0
  398. package/lib/typescript/handlers/TapGestureHandler.d.ts +56 -0
  399. package/{dist/src → lib/typescript}/handlers/createHandler.d.ts +1 -1
  400. package/{dist/src → lib/typescript}/handlers/createNativeWrapper.d.ts +0 -0
  401. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +62 -0
  402. package/{dist/src → lib/typescript}/handlers/gestureHandlerTypesCompat.d.ts +8 -1
  403. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +16 -0
  404. package/lib/typescript/handlers/gestures/eventReceiver.d.ts +2 -0
  405. package/lib/typescript/handlers/gestures/flingGesture.d.ts +9 -0
  406. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +10 -0
  407. package/lib/typescript/handlers/gestures/gesture.d.ts +93 -0
  408. package/lib/typescript/handlers/gestures/gestureComposition.d.ts +21 -0
  409. package/lib/typescript/handlers/gestures/gestureObjects.d.ts +39 -0
  410. package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +9 -0
  411. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +9 -0
  412. package/lib/typescript/handlers/gestures/manualGesture.d.ts +5 -0
  413. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +9 -0
  414. package/lib/typescript/handlers/gestures/panGesture.d.ts +19 -0
  415. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +6 -0
  416. package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +14 -0
  417. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +6 -0
  418. package/lib/typescript/handlers/gestures/tapGesture.d.ts +14 -0
  419. package/lib/typescript/handlers/handlersRegistry.d.ts +6 -0
  420. package/lib/typescript/index.d.ts +44 -0
  421. package/lib/typescript/init.d.ts +1 -0
  422. package/lib/typescript/mocks.d.ts +43 -0
  423. package/{dist/src → lib/typescript}/typeUtils.d.ts +0 -0
  424. package/lib/typescript/utils.d.ts +1 -0
  425. package/{dist/src → lib/typescript}/web/DiscreteGestureHandler.d.ts +0 -0
  426. package/{dist/src → lib/typescript}/web/DraggingGestureHandler.d.ts +0 -0
  427. package/{dist/src → lib/typescript}/web/Errors.d.ts +0 -0
  428. package/{dist/src → lib/typescript}/web/FlingGestureHandler.d.ts +0 -1
  429. package/{dist/src → lib/typescript}/web/GestureHandler.d.ts +0 -1
  430. package/{dist/src → lib/typescript}/web/IndiscreteGestureHandler.d.ts +0 -0
  431. package/{dist/src → lib/typescript}/web/LongPressGestureHandler.d.ts +0 -0
  432. package/{dist/src → lib/typescript}/web/NativeViewGestureHandler.d.ts +0 -0
  433. package/{dist/src → lib/typescript}/web/NodeManager.d.ts +0 -0
  434. package/{dist/src → lib/typescript}/web/PanGestureHandler.d.ts +0 -1
  435. package/{dist/src → lib/typescript}/web/PinchGestureHandler.d.ts +0 -1
  436. package/{dist/src → lib/typescript}/web/PressGestureHandler.d.ts +0 -1
  437. package/{dist/src → lib/typescript}/web/RotationGestureHandler.d.ts +0 -1
  438. package/{dist/src → lib/typescript}/web/TapGestureHandler.d.ts +0 -1
  439. package/{dist/src → lib/typescript}/web/constants.d.ts +0 -0
  440. package/{dist/src → lib/typescript}/web/utils.d.ts +0 -0
  441. package/package.json +38 -15
  442. package/src/Directions.ts +8 -2
  443. package/src/EventType.ts +10 -0
  444. package/src/GestureHandlerRootView.android.tsx +9 -25
  445. package/src/GestureHandlerRootView.tsx +11 -2
  446. package/src/PlatformConstants.ts +3 -2
  447. package/src/RNGestureHandlerModule.ts +15 -9
  448. package/src/RNGestureHandlerModule.web.ts +1 -0
  449. package/src/components/DrawerLayout.tsx +114 -41
  450. package/src/components/GestureButtons.tsx +45 -5
  451. package/src/components/GestureComponents.tsx +47 -41
  452. package/src/components/Swipeable.tsx +108 -21
  453. package/src/components/touchables/GenericTouchable.tsx +3 -2
  454. package/src/components/touchables/TouchableOpacity.tsx +1 -1
  455. package/src/handlers/FlingGestureHandler.ts +57 -0
  456. package/src/handlers/ForceTouchGestureHandler.ts +83 -0
  457. package/src/handlers/LongPressGestureHandler.ts +84 -0
  458. package/src/handlers/NativeViewGestureHandler.ts +31 -7
  459. package/src/handlers/PanGestureHandler.ts +321 -0
  460. package/src/handlers/PinchGestureHandler.ts +46 -0
  461. package/src/handlers/RotationGestureHandler.ts +46 -0
  462. package/src/handlers/TapGestureHandler.ts +90 -0
  463. package/src/handlers/createHandler.ts +60 -81
  464. package/src/handlers/gestureHandlerCommon.ts +185 -0
  465. package/src/handlers/gestureHandlerTypesCompat.ts +19 -5
  466. package/src/handlers/gestures/GestureDetector.tsx +498 -0
  467. package/src/handlers/gestures/eventReceiver.ts +135 -0
  468. package/src/handlers/gestures/flingGesture.ts +27 -0
  469. package/src/handlers/gestures/forceTouchGesture.ts +32 -0
  470. package/src/handlers/gestures/gesture.ts +279 -0
  471. package/src/handlers/gestures/gestureComposition.ts +109 -0
  472. package/src/handlers/gestures/gestureObjects.ts +79 -0
  473. package/src/handlers/gestures/gestureStateManager.ts +60 -0
  474. package/src/handlers/gestures/longPressGesture.ts +27 -0
  475. package/src/handlers/gestures/manualGesture.ts +11 -0
  476. package/src/handlers/gestures/nativeGesture.ts +27 -0
  477. package/src/handlers/gestures/panGesture.ts +105 -0
  478. package/src/handlers/gestures/pinchGesture.ts +12 -0
  479. package/src/handlers/gestures/reanimatedWrapper.ts +45 -0
  480. package/src/handlers/gestures/rotationGesture.ts +12 -0
  481. package/src/handlers/gestures/tapGesture.ts +52 -0
  482. package/src/handlers/handlersRegistry.ts +22 -0
  483. package/src/index.ts +156 -0
  484. package/src/init.ts +5 -0
  485. package/src/mocks.ts +65 -0
  486. package/src/utils.ts +7 -0
  487. package/src/web/GestureHandler.ts +2 -3
  488. package/src/web/NativeViewGestureHandler.ts +1 -3
  489. package/src/web/NodeManager.ts +5 -0
  490. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.java +0 -23
  491. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.java +0 -110
  492. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.java +0 -531
  493. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.java +0 -8
  494. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.java +0 -543
  495. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.java +0 -10
  496. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.java +0 -29
  497. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.java +0 -53
  498. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.java +0 -81
  499. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.java +0 -110
  500. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.java +0 -8
  501. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.java +0 -312
  502. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.java +0 -109
  503. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.java +0 -169
  504. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.java +0 -96
  505. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.java +0 -172
  506. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.java +0 -10
  507. package/android/src/main/java/com/facebook/react/views/modal/RNGHModalUtils.java +0 -21
  508. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java +0 -296
  509. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.java +0 -72
  510. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java +0 -77
  511. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.java +0 -8
  512. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.java +0 -86
  513. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java +0 -731
  514. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.java +0 -31
  515. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.java +0 -101
  516. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.java +0 -151
  517. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.java +0 -7
  518. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.java +0 -76
  519. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java +0 -49
  520. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java +0 -82
  521. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.java +0 -61
  522. package/dist/index.d.ts +0 -13
  523. package/dist/index.js +0 -16
  524. package/dist/src/Directions.d.ts +0 -7
  525. package/dist/src/Directions.js +0 -2
  526. package/dist/src/GestureHandlerRootView.android.d.ts +0 -4
  527. package/dist/src/GestureHandlerRootView.android.expo.d.ts +0 -2
  528. package/dist/src/GestureHandlerRootView.android.expo.js +0 -2
  529. package/dist/src/GestureHandlerRootView.android.js +0 -21
  530. package/dist/src/GestureHandlerRootView.d.ts +0 -2
  531. package/dist/src/GestureHandlerRootView.js +0 -2
  532. package/dist/src/PlatformConstants.js +0 -2
  533. package/dist/src/PlatformConstants.web.js +0 -5
  534. package/dist/src/RNGestureHandlerModule.js +0 -3
  535. package/dist/src/RNGestureHandlerModule.web.js +0 -47
  536. package/dist/src/State.js +0 -9
  537. package/dist/src/__mocks__/RNGestureHandlerModule.d.ts +0 -23
  538. package/dist/src/__mocks__/RNGestureHandlerModule.js +0 -25
  539. package/dist/src/components/DrawerLayout.js +0 -391
  540. package/dist/src/components/GestureButtons.js +0 -113
  541. package/dist/src/components/GestureComponents.d.ts +0 -45
  542. package/dist/src/components/GestureComponents.js +0 -18
  543. package/dist/src/components/GestureComponents.web.js +0 -18
  544. package/dist/src/components/GestureHandlerButton.web.js +0 -3
  545. package/dist/src/components/Swipeable.d.ts +0 -83
  546. package/dist/src/components/Swipeable.js +0 -249
  547. package/dist/src/components/touchables/GenericTouchable.js +0 -210
  548. package/dist/src/components/touchables/TouchableHighlight.js +0 -73
  549. package/dist/src/components/touchables/TouchableNativeFeedback.android.js +0 -63
  550. package/dist/src/components/touchables/TouchableOpacity.js +0 -50
  551. package/dist/src/components/touchables/TouchableWithoutFeedback.js +0 -5
  552. package/dist/src/gestureHandlerRootHOC.js +0 -17
  553. package/dist/src/handlers/NativeViewGestureHandler.d.ts +0 -12
  554. package/dist/src/handlers/NativeViewGestureHandler.js +0 -13
  555. package/dist/src/handlers/createHandler.js +0 -292
  556. package/dist/src/handlers/createNativeWrapper.js +0 -51
  557. package/dist/src/handlers/gestureHandlerTypesCompat.js +0 -1
  558. package/dist/src/handlers/gestureHandlers.d.ts +0 -158
  559. package/dist/src/handlers/gestureHandlers.js +0 -247
  560. package/dist/src/typeUtils.js +0 -1
  561. package/dist/src/web/DiscreteGestureHandler.js +0 -48
  562. package/dist/src/web/DraggingGestureHandler.js +0 -25
  563. package/dist/src/web/Errors.js +0 -5
  564. package/dist/src/web/FlingGestureHandler.js +0 -119
  565. package/dist/src/web/GestureHandler.js +0 -413
  566. package/dist/src/web/IndiscreteGestureHandler.js +0 -26
  567. package/dist/src/web/LongPressGestureHandler.js +0 -46
  568. package/dist/src/web/NativeViewGestureHandler.js +0 -39
  569. package/dist/src/web/NodeManager.js +0 -22
  570. package/dist/src/web/PanGestureHandler.js +0 -145
  571. package/dist/src/web/PinchGestureHandler.js +0 -19
  572. package/dist/src/web/PressGestureHandler.js +0 -135
  573. package/dist/src/web/RotationGestureHandler.js +0 -20
  574. package/dist/src/web/TapGestureHandler.js +0 -143
  575. package/dist/src/web/constants.js +0 -42
  576. package/dist/src/web/utils.js +0 -15
  577. package/index.ts +0 -117
  578. package/src/GestureHandlerRootView.android.expo.tsx +0 -3
  579. package/src/__mocks__/RNGestureHandlerModule.ts +0 -27
  580. package/src/handlers/gestureHandlers.ts +0 -511
@@ -0,0 +1,172 @@
1
+ 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); }
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
5
+ import * as React from 'react';
6
+ import { Animated, Platform, processColor, StyleSheet } from 'react-native';
7
+ import createNativeWrapper from '../handlers/createNativeWrapper';
8
+ import GestureHandlerButton from './GestureHandlerButton';
9
+ import { State } from '../State';
10
+ export const RawButton = createNativeWrapper(GestureHandlerButton, {
11
+ shouldCancelWhenOutside: false,
12
+ shouldActivateOnStart: false
13
+ });
14
+ export class BaseButton extends React.Component {
15
+ constructor(props) {
16
+ super(props);
17
+
18
+ _defineProperty(this, "lastActive", void 0);
19
+
20
+ _defineProperty(this, "handleEvent", ({
21
+ nativeEvent
22
+ }) => {
23
+ const {
24
+ state,
25
+ oldState,
26
+ pointerInside
27
+ } = nativeEvent;
28
+ const active = pointerInside && state === State.ACTIVE;
29
+
30
+ if (active !== this.lastActive && this.props.onActiveStateChange) {
31
+ this.props.onActiveStateChange(active);
32
+ }
33
+
34
+ if (oldState === State.ACTIVE && state !== State.CANCELLED && this.lastActive && this.props.onPress) {
35
+ this.props.onPress(active);
36
+ }
37
+
38
+ this.lastActive = active;
39
+ });
40
+
41
+ _defineProperty(this, "onHandlerStateChange", e => {
42
+ var _this$props$onHandler, _this$props;
43
+
44
+ (_this$props$onHandler = (_this$props = this.props).onHandlerStateChange) === null || _this$props$onHandler === void 0 ? void 0 : _this$props$onHandler.call(_this$props, e);
45
+ this.handleEvent(e);
46
+ });
47
+
48
+ _defineProperty(this, "onGestureEvent", e => {
49
+ var _this$props$onGesture, _this$props2;
50
+
51
+ (_this$props$onGesture = (_this$props2 = this.props).onGestureEvent) === null || _this$props$onGesture === void 0 ? void 0 : _this$props$onGesture.call(_this$props2, e);
52
+ this.handleEvent(e); // TODO: maybe it is not correct
53
+ });
54
+
55
+ this.lastActive = false;
56
+ }
57
+
58
+ render() {
59
+ const {
60
+ rippleColor,
61
+ ...rest
62
+ } = this.props;
63
+ return /*#__PURE__*/React.createElement(RawButton, _extends({
64
+ rippleColor: processColor(rippleColor)
65
+ }, rest, {
66
+ onGestureEvent: this.onGestureEvent,
67
+ onHandlerStateChange: this.onHandlerStateChange
68
+ }));
69
+ }
70
+
71
+ }
72
+ const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
73
+ const btnStyles = StyleSheet.create({
74
+ underlay: {
75
+ position: 'absolute',
76
+ left: 0,
77
+ right: 0,
78
+ bottom: 0,
79
+ top: 0
80
+ }
81
+ });
82
+ export class RectButton extends React.Component {
83
+ constructor(props) {
84
+ super(props);
85
+
86
+ _defineProperty(this, "opacity", void 0);
87
+
88
+ _defineProperty(this, "onActiveStateChange", active => {
89
+ var _this$props$onActiveS, _this$props3;
90
+
91
+ if (Platform.OS !== 'android') {
92
+ this.opacity.setValue(active ? this.props.activeOpacity : 0);
93
+ }
94
+
95
+ (_this$props$onActiveS = (_this$props3 = this.props).onActiveStateChange) === null || _this$props$onActiveS === void 0 ? void 0 : _this$props$onActiveS.call(_this$props3, active);
96
+ });
97
+
98
+ this.opacity = new Animated.Value(0);
99
+ }
100
+
101
+ render() {
102
+ const {
103
+ children,
104
+ style,
105
+ ...rest
106
+ } = this.props;
107
+ const resolvedStyle = StyleSheet.flatten(style !== null && style !== void 0 ? style : {});
108
+ return /*#__PURE__*/React.createElement(BaseButton, _extends({}, rest, {
109
+ style: resolvedStyle,
110
+ onActiveStateChange: this.onActiveStateChange
111
+ }), /*#__PURE__*/React.createElement(Animated.View, {
112
+ style: [btnStyles.underlay, {
113
+ opacity: this.opacity,
114
+ backgroundColor: this.props.underlayColor,
115
+ borderRadius: resolvedStyle.borderRadius,
116
+ borderTopLeftRadius: resolvedStyle.borderTopLeftRadius,
117
+ borderTopRightRadius: resolvedStyle.borderTopRightRadius,
118
+ borderBottomLeftRadius: resolvedStyle.borderBottomLeftRadius,
119
+ borderBottomRightRadius: resolvedStyle.borderBottomRightRadius
120
+ }]
121
+ }), children);
122
+ }
123
+
124
+ }
125
+
126
+ _defineProperty(RectButton, "defaultProps", {
127
+ activeOpacity: 0.105,
128
+ underlayColor: 'black'
129
+ });
130
+
131
+ export class BorderlessButton extends React.Component {
132
+ constructor(props) {
133
+ super(props);
134
+
135
+ _defineProperty(this, "opacity", void 0);
136
+
137
+ _defineProperty(this, "onActiveStateChange", active => {
138
+ var _this$props$onActiveS2, _this$props4;
139
+
140
+ if (Platform.OS !== 'android') {
141
+ this.opacity.setValue(active ? this.props.activeOpacity : 1);
142
+ }
143
+
144
+ (_this$props$onActiveS2 = (_this$props4 = this.props).onActiveStateChange) === null || _this$props$onActiveS2 === void 0 ? void 0 : _this$props$onActiveS2.call(_this$props4, active);
145
+ });
146
+
147
+ this.opacity = new Animated.Value(1);
148
+ }
149
+
150
+ render() {
151
+ const {
152
+ children,
153
+ style,
154
+ ...rest
155
+ } = this.props;
156
+ return /*#__PURE__*/React.createElement(AnimatedBaseButton, _extends({}, rest, {
157
+ onActiveStateChange: this.onActiveStateChange,
158
+ style: [style, Platform.OS === 'ios' && {
159
+ opacity: this.opacity
160
+ }]
161
+ }), children);
162
+ }
163
+
164
+ }
165
+
166
+ _defineProperty(BorderlessButton, "defaultProps", {
167
+ activeOpacity: 0.3,
168
+ borderless: true
169
+ });
170
+
171
+ export { default as PureNativeButton } from './GestureHandlerButton';
172
+ //# sourceMappingURL=GestureButtons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureButtons.tsx"],"names":["React","Animated","Platform","processColor","StyleSheet","createNativeWrapper","GestureHandlerButton","State","RawButton","shouldCancelWhenOutside","shouldActivateOnStart","BaseButton","Component","constructor","props","nativeEvent","state","oldState","pointerInside","active","ACTIVE","lastActive","onActiveStateChange","CANCELLED","onPress","e","onHandlerStateChange","handleEvent","onGestureEvent","render","rippleColor","rest","AnimatedBaseButton","createAnimatedComponent","btnStyles","create","underlay","position","left","right","bottom","top","RectButton","OS","opacity","setValue","activeOpacity","Value","children","style","resolvedStyle","flatten","backgroundColor","underlayColor","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","BorderlessButton","borderless","default","PureNativeButton"],"mappings":"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","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\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 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\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 * Android only.\n *\n * Set this to false if you want the ripple animation to render only within view bounds.\n */\n borderless?: boolean;\n\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 private lastActive: boolean;\n\n constructor(props: BaseButtonProps) {\n super(props);\n this.lastActive = 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 oldState === State.ACTIVE &&\n state !== State.CANCELLED &&\n this.lastActive &&\n this.props.onPress\n ) {\n this.props.onPress(active);\n }\n\n this.lastActive = active;\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"]}
@@ -0,0 +1,53 @@
1
+ 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); }
2
+
3
+ import * as React from 'react';
4
+ import { ScrollView as RNScrollView, Switch as RNSwitch, TextInput as RNTextInput, DrawerLayoutAndroid as RNDrawerLayoutAndroid, FlatList as RNFlatList } from 'react-native';
5
+ import createNativeWrapper from '../handlers/createNativeWrapper';
6
+ import { nativeViewProps } from '../handlers/NativeViewGestureHandler';
7
+ export const ScrollView = createNativeWrapper(RNScrollView, {
8
+ disallowInterruption: true,
9
+ shouldCancelWhenOutside: false
10
+ }); // backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
11
+ // include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
12
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
13
+
14
+ export const Switch = createNativeWrapper(RNSwitch, {
15
+ shouldCancelWhenOutside: false,
16
+ shouldActivateOnStart: true,
17
+ disallowInterruption: true
18
+ }); // eslint-disable-next-line @typescript-eslint/no-redeclare
19
+
20
+ export const TextInput = createNativeWrapper(RNTextInput); // eslint-disable-next-line @typescript-eslint/no-redeclare
21
+
22
+ export const DrawerLayoutAndroid = createNativeWrapper(RNDrawerLayoutAndroid, {
23
+ disallowInterruption: true
24
+ }); // eslint-disable-next-line @typescript-eslint/no-redeclare
25
+
26
+ export const FlatList = /*#__PURE__*/React.forwardRef((props, ref) => {
27
+ const flatListProps = {};
28
+ const scrollViewProps = {};
29
+
30
+ for (const [propName, value] of Object.entries(props)) {
31
+ // https://github.com/microsoft/TypeScript/issues/26255
32
+ if (nativeViewProps.includes(propName)) {
33
+ // @ts-ignore - this function cannot have generic type so we have to ignore this error
34
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
35
+ scrollViewProps[propName] = value;
36
+ } else {
37
+ // @ts-ignore - this function cannot have generic type so we have to ignore this error
38
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
39
+ flatListProps[propName] = value;
40
+ }
41
+ }
42
+
43
+ return (
44
+ /*#__PURE__*/
45
+ // @ts-ignore - this function cannot have generic type so we have to ignore this error
46
+ React.createElement(RNFlatList, _extends({
47
+ ref: ref
48
+ }, flatListProps, {
49
+ renderScrollComponent: scrollProps => /*#__PURE__*/React.createElement(ScrollView, _extends({}, scrollProps, scrollViewProps))
50
+ }))
51
+ );
52
+ }); // eslint-disable-next-line @typescript-eslint/no-redeclare
53
+ //# sourceMappingURL=GestureComponents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureComponents.tsx"],"names":["React","ScrollView","RNScrollView","Switch","RNSwitch","TextInput","RNTextInput","DrawerLayoutAndroid","RNDrawerLayoutAndroid","FlatList","RNFlatList","createNativeWrapper","nativeViewProps","disallowInterruption","shouldCancelWhenOutside","shouldActivateOnStart","forwardRef","props","ref","flatListProps","scrollViewProps","propName","value","Object","entries","includes","scrollProps"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAOA,SACEC,UAAU,IAAIC,YADhB,EAGEC,MAAM,IAAIC,QAHZ,EAKEC,SAAS,IAAIC,WALf,EAOEC,mBAAmB,IAAIC,qBAPzB,EASEC,QAAQ,IAAIC,UATd,QAWO,cAXP;AAaA,OAAOC,mBAAP,MAAgC,iCAAhC;AAEA,SAEEC,eAFF,QAGO,sCAHP;AAKA,OAAO,MAAMX,UAAU,GAAGU,mBAAmB,CAE3CT,YAF2C,EAE7B;AACdW,EAAAA,oBAAoB,EAAE,IADR;AAEdC,EAAAA,uBAAuB,EAAE;AAFX,CAF6B,CAAtC,C,CAMP;AACA;AACA;;AAGA,OAAO,MAAMX,MAAM,GAAGQ,mBAAmB,CAAgBP,QAAhB,EAA0B;AACjEU,EAAAA,uBAAuB,EAAE,KADwC;AAEjEC,EAAAA,qBAAqB,EAAE,IAF0C;AAGjEF,EAAAA,oBAAoB,EAAE;AAH2C,CAA1B,CAAlC,C,CAKP;;AAGA,OAAO,MAAMR,SAAS,GAAGM,mBAAmB,CAAmBL,WAAnB,CAArC,C,CACP;;AAGA,OAAO,MAAMC,mBAAmB,GAAGI,mBAAmB,CAEpDH,qBAFoD,EAE7B;AAAEK,EAAAA,oBAAoB,EAAE;AAAxB,CAF6B,CAA/C,C,CAGP;;AAIA,OAAO,MAAMJ,QAAQ,gBAAGT,KAAK,CAACgB,UAAN,CAAiB,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACvD,QAAMC,aAAa,GAAG,EAAtB;AACA,QAAMC,eAAe,GAAG,EAAxB;;AACA,OAAK,MAAM,CAACC,QAAD,EAAWC,KAAX,CAAX,IAAgCC,MAAM,CAACC,OAAP,CAAeP,KAAf,CAAhC,EAAuD;AACrD;AACA,QAAKL,eAAD,CAAuCa,QAAvC,CAAgDJ,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;;AACD;AAAA;AACE;AACA,wBAAC,UAAD;AACE,MAAA,GAAG,EAAEJ;AADP,OAEMC,aAFN;AAGE,MAAA,qBAAqB,EAAGO,WAAD,iBACrB,oBAAC,UAAD,eAAqBA,WAArB,EAAqCN,eAArC;AAJJ;AAFF;AAUD,CAzBuB,CAAjB,C,CAiCP","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} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\n\nimport {\n NativeViewGestureHandlerProps,\n nativeViewProps,\n} from '../handlers/NativeViewGestureHandler';\n\nexport const ScrollView = createNativeWrapper<\n PropsWithChildren<RNScrollViewProps>\n>(RNScrollView, {\n disallowInterruption: true,\n shouldCancelWhenOutside: false,\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 ScrollView & 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 flatListProps = {};\n const scrollViewProps = {};\n for (const [propName, value] of Object.entries(props)) {\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 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 {...{ ...scrollProps, ...scrollViewProps }} />\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,25 @@
1
+ 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); }
2
+
3
+ import * as React from 'react';
4
+ import { DrawerLayoutAndroid as RNDrawerLayoutAndroid, FlatList as RNFlatList, Switch as RNSwitch, TextInput as RNTextInput, ScrollView as RNScrollView } from 'react-native';
5
+ import createNativeWrapper from '../handlers/createNativeWrapper';
6
+ export const ScrollView = createNativeWrapper(RNScrollView, {
7
+ disallowInterruption: true
8
+ });
9
+ export const Switch = createNativeWrapper(RNSwitch, {
10
+ shouldCancelWhenOutside: false,
11
+ shouldActivateOnStart: true,
12
+ disallowInterruption: true
13
+ });
14
+ export const TextInput = createNativeWrapper(RNTextInput);
15
+ export const DrawerLayoutAndroid = createNativeWrapper(RNDrawerLayoutAndroid, {
16
+ disallowInterruption: true
17
+ }); // @ts-ignore -- TODO(TS) to investigate if it's needed
18
+
19
+ DrawerLayoutAndroid.positions = RNDrawerLayoutAndroid.positions;
20
+ export const FlatList = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(RNFlatList, _extends({
21
+ ref: ref
22
+ }, props, {
23
+ renderScrollComponent: scrollProps => /*#__PURE__*/React.createElement(ScrollView, scrollProps)
24
+ })));
25
+ //# sourceMappingURL=GestureComponents.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureComponents.web.tsx"],"names":["React","DrawerLayoutAndroid","RNDrawerLayoutAndroid","FlatList","RNFlatList","Switch","RNSwitch","TextInput","RNTextInput","ScrollView","RNScrollView","createNativeWrapper","disallowInterruption","shouldCancelWhenOutside","shouldActivateOnStart","positions","forwardRef","props","ref","scrollProps"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,mBAAmB,IAAIC,qBADzB,EAEEC,QAAQ,IAAIC,UAFd,EAGEC,MAAM,IAAIC,QAHZ,EAIEC,SAAS,IAAIC,WAJf,EAKEC,UAAU,IAAIC,YALhB,QAOO,cAPP;AASA,OAAOC,mBAAP,MAAgC,iCAAhC;AAEA,OAAO,MAAMF,UAAU,GAAGE,mBAAmB,CAACD,YAAD,EAAe;AAC1DE,EAAAA,oBAAoB,EAAE;AADoC,CAAf,CAAtC;AAIP,OAAO,MAAMP,MAAM,GAAGM,mBAAmB,CAACL,QAAD,EAAW;AAClDO,EAAAA,uBAAuB,EAAE,KADyB;AAElDC,EAAAA,qBAAqB,EAAE,IAF2B;AAGlDF,EAAAA,oBAAoB,EAAE;AAH4B,CAAX,CAAlC;AAKP,OAAO,MAAML,SAAS,GAAGI,mBAAmB,CAACH,WAAD,CAArC;AACP,OAAO,MAAMP,mBAAmB,GAAGU,mBAAmB,CAACT,qBAAD,EAAwB;AAC5EU,EAAAA,oBAAoB,EAAE;AADsD,CAAxB,CAA/C,C,CAGP;;AACAX,mBAAmB,CAACc,SAApB,GAAgCb,qBAAqB,CAACa,SAAtD;AAEA,OAAO,MAAMZ,QAAQ,gBAAGH,KAAK,CAACgB,UAAN,CACtB,CAAoBC,KAApB,EAAiDC,GAAjD,kBACE,oBAAC,UAAD;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 DrawerLayoutAndroid as RNDrawerLayoutAndroid,\n FlatList as RNFlatList,\n Switch as RNSwitch,\n TextInput as RNTextInput,\n ScrollView as RNScrollView,\n FlatListProps,\n} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\n\nexport const ScrollView = createNativeWrapper(RNScrollView, {\n disallowInterruption: true,\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 = createNativeWrapper(RNDrawerLayoutAndroid, {\n disallowInterruption: true,\n});\n// @ts-ignore -- TODO(TS) to investigate if it's needed\nDrawerLayoutAndroid.positions = RNDrawerLayoutAndroid.positions;\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,3 +1,4 @@
1
1
  import { requireNativeComponent } from 'react-native';
2
2
  const RNGestureHandlerButton = requireNativeComponent('RNGestureHandlerButton');
3
3
  export default RNGestureHandlerButton;
4
+ //# sourceMappingURL=GestureHandlerButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureHandlerButton.tsx"],"names":["requireNativeComponent","RNGestureHandlerButton"],"mappings":"AAAA,SAAwBA,sBAAxB,QAAsD,cAAtD;AAEA,MAAMC,sBAAqD,GAAGD,sBAAsB,CAClF,wBADkF,CAApF;AAIA,eAAeC,sBAAf","sourcesContent":["import { HostComponent, requireNativeComponent } from 'react-native';\nimport { RawButtonProps } from './GestureButtons';\nconst RNGestureHandlerButton: HostComponent<RawButtonProps> = requireNativeComponent(\n 'RNGestureHandlerButton'\n);\n\nexport default RNGestureHandlerButton;\n"]}
@@ -0,0 +1,9 @@
1
+ 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); }
2
+
3
+ import * as React from 'react';
4
+ import { View } from 'react-native';
5
+ export default /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(View, _extends({
6
+ ref: ref,
7
+ accessibilityRole: "button"
8
+ }, props)));
9
+ //# sourceMappingURL=GestureHandlerButton.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GestureHandlerButton.web.tsx"],"names":["React","View","forwardRef","props","ref"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,4BAAeD,KAAK,CAACE,UAAN,CAAuB,CAACC,KAAD,EAAQC,GAAR,kBACpC,oBAAC,IAAD;AAAM,EAAA,GAAG,EAAEA,GAAX;AAAgB,EAAA,iBAAiB,EAAC;AAAlC,GAA+CD,KAA/C,EADa,CAAf","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"]}
@@ -0,0 +1,347 @@
1
+ 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); }
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
5
+ // Similarily to the DrawerLayout component this deserves to be put in a
6
+ // separate repo. Although, keeping it here for the time being will allow us to
7
+ // move faster and fix possible issues quicker
8
+ import * as React from 'react';
9
+ import { Component } from 'react';
10
+ import { Animated, StyleSheet, View, I18nManager } from 'react-native';
11
+ import { PanGestureHandler } from '../handlers/PanGestureHandler';
12
+ import { TapGestureHandler } from '../handlers/TapGestureHandler';
13
+ import { State } from '../State';
14
+ const DRAG_TOSS = 0.05;
15
+ export default class Swipeable extends Component {
16
+ constructor(_props) {
17
+ super(_props);
18
+
19
+ _defineProperty(this, "onGestureEvent", void 0);
20
+
21
+ _defineProperty(this, "transX", void 0);
22
+
23
+ _defineProperty(this, "showLeftAction", void 0);
24
+
25
+ _defineProperty(this, "leftActionTranslate", void 0);
26
+
27
+ _defineProperty(this, "showRightAction", void 0);
28
+
29
+ _defineProperty(this, "rightActionTranslate", void 0);
30
+
31
+ _defineProperty(this, "updateAnimatedEvent", (props, state) => {
32
+ const {
33
+ friction,
34
+ overshootFriction
35
+ } = props;
36
+ const {
37
+ dragX,
38
+ rowTranslation,
39
+ leftWidth = 0,
40
+ rowWidth = 0
41
+ } = state;
42
+ const {
43
+ rightOffset = rowWidth
44
+ } = state;
45
+ const rightWidth = Math.max(0, rowWidth - rightOffset);
46
+ const {
47
+ overshootLeft = leftWidth > 0,
48
+ overshootRight = rightWidth > 0
49
+ } = props;
50
+ const transX = Animated.add(rowTranslation, dragX.interpolate({
51
+ inputRange: [0, friction],
52
+ outputRange: [0, 1]
53
+ })).interpolate({
54
+ inputRange: [-rightWidth - 1, -rightWidth, leftWidth, leftWidth + 1],
55
+ outputRange: [-rightWidth - (overshootRight ? 1 / overshootFriction : 0), -rightWidth, leftWidth, leftWidth + (overshootLeft ? 1 / overshootFriction : 0)]
56
+ });
57
+ this.transX = transX;
58
+ this.showLeftAction = leftWidth > 0 ? transX.interpolate({
59
+ inputRange: [-1, 0, leftWidth],
60
+ outputRange: [0, 0, 1]
61
+ }) : new Animated.Value(0);
62
+ this.leftActionTranslate = this.showLeftAction.interpolate({
63
+ inputRange: [0, Number.MIN_VALUE],
64
+ outputRange: [-10000, 0],
65
+ extrapolate: 'clamp'
66
+ });
67
+ this.showRightAction = rightWidth > 0 ? transX.interpolate({
68
+ inputRange: [-rightWidth, 0, 1],
69
+ outputRange: [1, 0, 0]
70
+ }) : new Animated.Value(0);
71
+ this.rightActionTranslate = this.showRightAction.interpolate({
72
+ inputRange: [0, Number.MIN_VALUE],
73
+ outputRange: [-10000, 0],
74
+ extrapolate: 'clamp'
75
+ });
76
+ });
77
+
78
+ _defineProperty(this, "onTapHandlerStateChange", ({
79
+ nativeEvent
80
+ }) => {
81
+ if (nativeEvent.oldState === State.ACTIVE) {
82
+ this.close();
83
+ }
84
+ });
85
+
86
+ _defineProperty(this, "onHandlerStateChange", ev => {
87
+ if (ev.nativeEvent.oldState === State.ACTIVE) {
88
+ this.handleRelease(ev);
89
+ }
90
+ });
91
+
92
+ _defineProperty(this, "handleRelease", ev => {
93
+ const {
94
+ velocityX,
95
+ translationX: dragX
96
+ } = ev.nativeEvent;
97
+ const {
98
+ leftWidth = 0,
99
+ rowWidth = 0,
100
+ rowState
101
+ } = this.state;
102
+ const {
103
+ rightOffset = rowWidth
104
+ } = this.state;
105
+ const rightWidth = rowWidth - rightOffset;
106
+ const {
107
+ friction,
108
+ leftThreshold = leftWidth / 2,
109
+ rightThreshold = rightWidth / 2
110
+ } = this.props;
111
+ const startOffsetX = this.currentOffset() + dragX / friction;
112
+ const translationX = (dragX + DRAG_TOSS * velocityX) / friction;
113
+ let toValue = 0;
114
+
115
+ if (rowState === 0) {
116
+ if (translationX > leftThreshold) {
117
+ toValue = leftWidth;
118
+ } else if (translationX < -rightThreshold) {
119
+ toValue = -rightWidth;
120
+ }
121
+ } else if (rowState === 1) {
122
+ // swiped to left
123
+ if (translationX > -leftThreshold) {
124
+ toValue = leftWidth;
125
+ }
126
+ } else {
127
+ // swiped to right
128
+ if (translationX < rightThreshold) {
129
+ toValue = -rightWidth;
130
+ }
131
+ }
132
+
133
+ this.animateRow(startOffsetX, toValue, velocityX / friction);
134
+ });
135
+
136
+ _defineProperty(this, "animateRow", (fromValue, toValue, velocityX) => {
137
+ const {
138
+ dragX,
139
+ rowTranslation
140
+ } = this.state;
141
+ dragX.setValue(0);
142
+ rowTranslation.setValue(fromValue);
143
+ this.setState({
144
+ rowState: Math.sign(toValue)
145
+ });
146
+ Animated.spring(rowTranslation, {
147
+ restSpeedThreshold: 1.7,
148
+ restDisplacementThreshold: 0.4,
149
+ velocity: velocityX,
150
+ bounciness: 0,
151
+ toValue,
152
+ useNativeDriver: this.props.useNativeAnimations,
153
+ ...this.props.animationOptions
154
+ }).start(({
155
+ finished
156
+ }) => {
157
+ if (finished) {
158
+ if (toValue > 0 && this.props.onSwipeableLeftOpen) {
159
+ this.props.onSwipeableLeftOpen();
160
+ } else if (toValue < 0 && this.props.onSwipeableRightOpen) {
161
+ this.props.onSwipeableRightOpen();
162
+ }
163
+
164
+ if (toValue === 0) {
165
+ var _this$props$onSwipeab, _this$props;
166
+
167
+ (_this$props$onSwipeab = (_this$props = this.props).onSwipeableClose) === null || _this$props$onSwipeab === void 0 ? void 0 : _this$props$onSwipeab.call(_this$props);
168
+ } else {
169
+ var _this$props$onSwipeab2, _this$props2;
170
+
171
+ (_this$props$onSwipeab2 = (_this$props2 = this.props).onSwipeableOpen) === null || _this$props$onSwipeab2 === void 0 ? void 0 : _this$props$onSwipeab2.call(_this$props2);
172
+ }
173
+ }
174
+ });
175
+
176
+ if (toValue > 0 && this.props.onSwipeableLeftWillOpen) {
177
+ this.props.onSwipeableLeftWillOpen();
178
+ } else if (toValue < 0 && this.props.onSwipeableRightWillOpen) {
179
+ this.props.onSwipeableRightWillOpen();
180
+ }
181
+
182
+ if (toValue === 0) {
183
+ var _this$props$onSwipeab3, _this$props3;
184
+
185
+ (_this$props$onSwipeab3 = (_this$props3 = this.props).onSwipeableWillClose) === null || _this$props$onSwipeab3 === void 0 ? void 0 : _this$props$onSwipeab3.call(_this$props3);
186
+ } else {
187
+ var _this$props$onSwipeab4, _this$props4;
188
+
189
+ (_this$props$onSwipeab4 = (_this$props4 = this.props).onSwipeableWillOpen) === null || _this$props$onSwipeab4 === void 0 ? void 0 : _this$props$onSwipeab4.call(_this$props4);
190
+ }
191
+ });
192
+
193
+ _defineProperty(this, "onRowLayout", ({
194
+ nativeEvent
195
+ }) => {
196
+ this.setState({
197
+ rowWidth: nativeEvent.layout.width
198
+ });
199
+ });
200
+
201
+ _defineProperty(this, "currentOffset", () => {
202
+ const {
203
+ leftWidth = 0,
204
+ rowWidth = 0,
205
+ rowState
206
+ } = this.state;
207
+ const {
208
+ rightOffset = rowWidth
209
+ } = this.state;
210
+ const rightWidth = rowWidth - rightOffset;
211
+
212
+ if (rowState === 1) {
213
+ return leftWidth;
214
+ } else if (rowState === -1) {
215
+ return -rightWidth;
216
+ }
217
+
218
+ return 0;
219
+ });
220
+
221
+ _defineProperty(this, "close", () => {
222
+ this.animateRow(this.currentOffset(), 0);
223
+ });
224
+
225
+ _defineProperty(this, "openLeft", () => {
226
+ const {
227
+ leftWidth = 0
228
+ } = this.state;
229
+ this.animateRow(this.currentOffset(), leftWidth);
230
+ });
231
+
232
+ _defineProperty(this, "openRight", () => {
233
+ const {
234
+ rowWidth = 0
235
+ } = this.state;
236
+ const {
237
+ rightOffset = rowWidth
238
+ } = this.state;
239
+ const rightWidth = rowWidth - rightOffset;
240
+ this.animateRow(this.currentOffset(), -rightWidth);
241
+ });
242
+
243
+ const _dragX = new Animated.Value(0);
244
+
245
+ this.state = {
246
+ dragX: _dragX,
247
+ rowTranslation: new Animated.Value(0),
248
+ rowState: 0,
249
+ leftWidth: undefined,
250
+ rightOffset: undefined,
251
+ rowWidth: undefined
252
+ };
253
+ this.updateAnimatedEvent(_props, this.state);
254
+ this.onGestureEvent = Animated.event([{
255
+ nativeEvent: {
256
+ translationX: _dragX
257
+ }
258
+ }], {
259
+ useNativeDriver: _props.useNativeAnimations
260
+ });
261
+ }
262
+
263
+ UNSAFE_componentWillUpdate(props, state) {
264
+ if (this.props.friction !== props.friction || this.props.overshootLeft !== props.overshootLeft || this.props.overshootRight !== props.overshootRight || this.props.overshootFriction !== props.overshootFriction || this.state.leftWidth !== state.leftWidth || this.state.rightOffset !== state.rightOffset || this.state.rowWidth !== state.rowWidth) {
265
+ this.updateAnimatedEvent(props, state);
266
+ }
267
+ }
268
+
269
+ render() {
270
+ const {
271
+ rowState
272
+ } = this.state;
273
+ const {
274
+ children,
275
+ renderLeftActions,
276
+ renderRightActions
277
+ } = this.props;
278
+ const left = renderLeftActions && /*#__PURE__*/React.createElement(Animated.View, {
279
+ style: [styles.leftActions, // all those and below parameters can have ! since they are all
280
+ // asigned in constructor in `updateAnimatedEvent` but TS cannot spot
281
+ // it for some reason
282
+ {
283
+ transform: [{
284
+ translateX: this.leftActionTranslate
285
+ }]
286
+ }]
287
+ }, renderLeftActions(this.showLeftAction, this.transX), /*#__PURE__*/React.createElement(View, {
288
+ onLayout: ({
289
+ nativeEvent
290
+ }) => this.setState({
291
+ leftWidth: nativeEvent.layout.x
292
+ })
293
+ }));
294
+ const right = renderRightActions && /*#__PURE__*/React.createElement(Animated.View, {
295
+ style: [styles.rightActions, {
296
+ transform: [{
297
+ translateX: this.rightActionTranslate
298
+ }]
299
+ }]
300
+ }, renderRightActions(this.showRightAction, this.transX), /*#__PURE__*/React.createElement(View, {
301
+ onLayout: ({
302
+ nativeEvent
303
+ }) => this.setState({
304
+ rightOffset: nativeEvent.layout.x
305
+ })
306
+ }));
307
+ return /*#__PURE__*/React.createElement(PanGestureHandler, _extends({
308
+ activeOffsetX: [-10, 10]
309
+ }, this.props, {
310
+ onGestureEvent: this.onGestureEvent,
311
+ onHandlerStateChange: this.onHandlerStateChange
312
+ }), /*#__PURE__*/React.createElement(Animated.View, {
313
+ onLayout: this.onRowLayout,
314
+ style: [styles.container, this.props.containerStyle]
315
+ }, left, right, /*#__PURE__*/React.createElement(TapGestureHandler, {
316
+ enabled: rowState !== 0,
317
+ onHandlerStateChange: this.onTapHandlerStateChange
318
+ }, /*#__PURE__*/React.createElement(Animated.View, {
319
+ pointerEvents: rowState === 0 ? 'auto' : 'box-only',
320
+ style: [{
321
+ transform: [{
322
+ translateX: this.transX
323
+ }]
324
+ }, this.props.childrenContainerStyle]
325
+ }, children))));
326
+ }
327
+
328
+ }
329
+
330
+ _defineProperty(Swipeable, "defaultProps", {
331
+ friction: 1,
332
+ overshootFriction: 1,
333
+ useNativeAnimations: true
334
+ });
335
+
336
+ const styles = StyleSheet.create({
337
+ container: {
338
+ overflow: 'hidden'
339
+ },
340
+ leftActions: { ...StyleSheet.absoluteFillObject,
341
+ flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row'
342
+ },
343
+ rightActions: { ...StyleSheet.absoluteFillObject,
344
+ flexDirection: I18nManager.isRTL ? 'row' : 'row-reverse'
345
+ }
346
+ });
347
+ //# sourceMappingURL=Swipeable.js.map