react-native-gesture-handler 1.10.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (592) 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 +23 -1
  5. package/android/gradle.properties +19 -0
  6. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.kt +18 -0
  7. package/android/lib/src/main/java/com/swmansion/gesturehandler/Extensions.kt +11 -0
  8. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.kt +96 -0
  9. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.kt +710 -0
  10. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.kt +8 -0
  11. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +562 -0
  12. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.kt +8 -0
  13. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.kt +21 -0
  14. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.kt +49 -0
  15. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.kt +97 -0
  16. package/android/lib/src/main/java/com/swmansion/gesturehandler/ManualGestureHandler.kt +11 -0
  17. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.kt +129 -0
  18. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.kt +9 -0
  19. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +289 -0
  20. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.kt +88 -0
  21. package/android/lib/src/main/java/com/swmansion/gesturehandler/{PointerEventsConfig.java → PointerEventsConfig.kt} +3 -5
  22. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.kt +125 -0
  23. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.kt +79 -0
  24. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.kt +167 -0
  25. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.kt +10 -0
  26. package/android/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -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/xcuserdata/mdk.xcuserdatad/xcschemes/RNGestureHandler.xcscheme +80 -0
  55. package/ios/RNGestureHandler.xcodeproj/xcuserdata/mdk.xcuserdatad/xcschemes/xcschememanagement.plist +27 -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 -0
  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 +415 -0
  144. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
  145. package/lib/commonjs/handlers/gestures/eventReceiver.js +112 -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 +177 -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 +378 -0
  292. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
  293. package/lib/module/handlers/gestures/eventReceiver.js +97 -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 +159 -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 +52 -2
  377. package/{dist/src → lib/typescript}/components/GestureButtons.d.ts +37 -1
  378. package/lib/typescript/components/GestureComponents.d.ts +18 -0
  379. package/lib/typescript/components/GestureComponents.web.d.ts +7 -0
  380. package/{dist/src → lib/typescript}/components/GestureHandlerButton.d.ts +0 -0
  381. package/{dist/src → lib/typescript}/components/GestureHandlerButton.web.d.ts +1 -1
  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 +4 -2
  389. package/{dist/src → lib/typescript}/components/touchables/index.d.ts +0 -0
  390. package/lib/typescript/gestureHandlerRootHOC.d.ts +3 -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 +2 -2
  400. package/{dist/src → lib/typescript}/handlers/createNativeWrapper.d.ts +1 -1
  401. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +62 -0
  402. package/{dist/src → lib/typescript}/handlers/gestureHandlerTypesCompat.d.ts +17 -2
  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 +90 -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 -16
  442. package/src/Directions.ts +8 -2
  443. package/src/EventType.ts +10 -0
  444. package/src/GestureHandlerRootView.android.tsx +10 -25
  445. package/src/GestureHandlerRootView.tsx +12 -0
  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 +117 -43
  450. package/src/components/GestureButtons.tsx +46 -6
  451. package/src/components/GestureComponents.tsx +48 -41
  452. package/src/components/GestureComponents.web.tsx +1 -1
  453. package/src/components/{GestureHandlerButton.ts → GestureHandlerButton.tsx} +0 -0
  454. package/src/components/GestureHandlerButton.web.tsx +1 -1
  455. package/src/components/Swipeable.tsx +110 -22
  456. package/src/components/touchables/GenericTouchable.tsx +5 -3
  457. package/src/components/touchables/TouchableHighlight.tsx +2 -1
  458. package/src/components/touchables/TouchableNativeFeedback.android.tsx +2 -1
  459. package/src/components/touchables/{TouchableNativeFeedback.ts → TouchableNativeFeedback.tsx} +0 -0
  460. package/src/components/touchables/TouchableOpacity.tsx +3 -2
  461. package/src/components/touchables/TouchableWithoutFeedback.tsx +3 -2
  462. package/src/gestureHandlerRootHOC.tsx +5 -5
  463. package/src/handlers/FlingGestureHandler.ts +57 -0
  464. package/src/handlers/ForceTouchGestureHandler.ts +83 -0
  465. package/src/handlers/LongPressGestureHandler.ts +84 -0
  466. package/src/handlers/NativeViewGestureHandler.ts +31 -7
  467. package/src/handlers/PanGestureHandler.ts +321 -0
  468. package/src/handlers/PinchGestureHandler.ts +46 -0
  469. package/src/handlers/RotationGestureHandler.ts +46 -0
  470. package/src/handlers/TapGestureHandler.ts +90 -0
  471. package/src/handlers/createHandler.ts +61 -83
  472. package/src/handlers/createNativeWrapper.tsx +3 -2
  473. package/src/handlers/gestureHandlerCommon.ts +185 -0
  474. package/src/handlers/gestureHandlerTypesCompat.ts +37 -4
  475. package/src/handlers/gestures/GestureDetector.tsx +490 -0
  476. package/src/handlers/gestures/eventReceiver.ts +129 -0
  477. package/src/handlers/gestures/flingGesture.ts +27 -0
  478. package/src/handlers/gestures/forceTouchGesture.ts +32 -0
  479. package/src/handlers/gestures/gesture.ts +262 -0
  480. package/src/handlers/gestures/gestureComposition.ts +109 -0
  481. package/src/handlers/gestures/gestureObjects.ts +79 -0
  482. package/src/handlers/gestures/gestureStateManager.ts +60 -0
  483. package/src/handlers/gestures/longPressGesture.ts +27 -0
  484. package/src/handlers/gestures/manualGesture.ts +11 -0
  485. package/src/handlers/gestures/nativeGesture.ts +27 -0
  486. package/src/handlers/gestures/panGesture.ts +105 -0
  487. package/src/handlers/gestures/pinchGesture.ts +12 -0
  488. package/src/handlers/gestures/reanimatedWrapper.ts +45 -0
  489. package/src/handlers/gestures/rotationGesture.ts +12 -0
  490. package/src/handlers/gestures/tapGesture.ts +52 -0
  491. package/src/handlers/handlersRegistry.ts +22 -0
  492. package/src/index.ts +156 -0
  493. package/src/init.ts +5 -0
  494. package/src/mocks.ts +65 -0
  495. package/src/utils.ts +7 -0
  496. package/src/web/GestureHandler.ts +3 -4
  497. package/src/web/NativeViewGestureHandler.ts +0 -2
  498. package/src/web/NodeManager.ts +5 -0
  499. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.java +0 -23
  500. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.java +0 -110
  501. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.java +0 -531
  502. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.java +0 -8
  503. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.java +0 -543
  504. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.java +0 -10
  505. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.java +0 -29
  506. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.java +0 -53
  507. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.java +0 -81
  508. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.java +0 -110
  509. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.java +0 -8
  510. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.java +0 -312
  511. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.java +0 -109
  512. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.java +0 -169
  513. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.java +0 -96
  514. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.java +0 -172
  515. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.java +0 -10
  516. package/android/src/main/java/com/facebook/react/views/modal/RNGHModalUtils.java +0 -21
  517. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java +0 -296
  518. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.java +0 -72
  519. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java +0 -77
  520. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.java +0 -8
  521. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.java +0 -86
  522. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java +0 -731
  523. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.java +0 -31
  524. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.java +0 -101
  525. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.java +0 -151
  526. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.java +0 -7
  527. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.java +0 -76
  528. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java +0 -49
  529. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java +0 -82
  530. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.java +0 -61
  531. package/dist/index.d.ts +0 -13
  532. package/dist/index.js +0 -16
  533. package/dist/src/Directions.d.ts +0 -7
  534. package/dist/src/Directions.js +0 -2
  535. package/dist/src/GestureHandlerRootView.android.d.ts +0 -4
  536. package/dist/src/GestureHandlerRootView.android.expo.d.ts +0 -2
  537. package/dist/src/GestureHandlerRootView.android.expo.js +0 -2
  538. package/dist/src/GestureHandlerRootView.android.js +0 -21
  539. package/dist/src/GestureHandlerRootView.d.ts +0 -2
  540. package/dist/src/GestureHandlerRootView.js +0 -2
  541. package/dist/src/PlatformConstants.js +0 -2
  542. package/dist/src/PlatformConstants.web.js +0 -5
  543. package/dist/src/RNGestureHandlerModule.js +0 -3
  544. package/dist/src/RNGestureHandlerModule.web.js +0 -47
  545. package/dist/src/State.js +0 -9
  546. package/dist/src/__mocks__/RNGestureHandlerModule.d.ts +0 -23
  547. package/dist/src/__mocks__/RNGestureHandlerModule.js +0 -25
  548. package/dist/src/components/DrawerLayout.js +0 -390
  549. package/dist/src/components/GestureButtons.js +0 -113
  550. package/dist/src/components/GestureComponents.d.ts +0 -45
  551. package/dist/src/components/GestureComponents.js +0 -18
  552. package/dist/src/components/GestureComponents.web.d.ts +0 -7
  553. package/dist/src/components/GestureComponents.web.js +0 -18
  554. package/dist/src/components/GestureHandlerButton.web.js +0 -3
  555. package/dist/src/components/Swipeable.d.ts +0 -82
  556. package/dist/src/components/Swipeable.js +0 -248
  557. package/dist/src/components/touchables/GenericTouchable.js +0 -209
  558. package/dist/src/components/touchables/TouchableHighlight.js +0 -72
  559. package/dist/src/components/touchables/TouchableNativeFeedback.android.js +0 -62
  560. package/dist/src/components/touchables/TouchableOpacity.js +0 -49
  561. package/dist/src/components/touchables/TouchableWithoutFeedback.js +0 -5
  562. package/dist/src/gestureHandlerRootHOC.d.ts +0 -3
  563. package/dist/src/gestureHandlerRootHOC.js +0 -17
  564. package/dist/src/handlers/NativeViewGestureHandler.d.ts +0 -12
  565. package/dist/src/handlers/NativeViewGestureHandler.js +0 -13
  566. package/dist/src/handlers/createHandler.js +0 -292
  567. package/dist/src/handlers/createNativeWrapper.js +0 -50
  568. package/dist/src/handlers/gestureHandlerTypesCompat.js +0 -1
  569. package/dist/src/handlers/gestureHandlers.d.ts +0 -158
  570. package/dist/src/handlers/gestureHandlers.js +0 -247
  571. package/dist/src/typeUtils.js +0 -1
  572. package/dist/src/web/DiscreteGestureHandler.js +0 -48
  573. package/dist/src/web/DraggingGestureHandler.js +0 -25
  574. package/dist/src/web/Errors.js +0 -5
  575. package/dist/src/web/FlingGestureHandler.js +0 -119
  576. package/dist/src/web/GestureHandler.js +0 -413
  577. package/dist/src/web/IndiscreteGestureHandler.js +0 -26
  578. package/dist/src/web/LongPressGestureHandler.js +0 -46
  579. package/dist/src/web/NativeViewGestureHandler.js +0 -39
  580. package/dist/src/web/NodeManager.js +0 -22
  581. package/dist/src/web/PanGestureHandler.js +0 -145
  582. package/dist/src/web/PinchGestureHandler.js +0 -19
  583. package/dist/src/web/PressGestureHandler.js +0 -135
  584. package/dist/src/web/RotationGestureHandler.js +0 -20
  585. package/dist/src/web/TapGestureHandler.js +0 -143
  586. package/dist/src/web/constants.js +0 -42
  587. package/dist/src/web/utils.js +0 -15
  588. package/index.ts +0 -103
  589. package/src/GestureHandlerRootView.android.expo.ts +0 -3
  590. package/src/GestureHandlerRootView.ts +0 -3
  591. package/src/__mocks__/RNGestureHandlerModule.ts +0 -27
  592. package/src/handlers/gestureHandlers.ts +0 -511
@@ -1,47 +0,0 @@
1
- import { Direction } from './web/constants';
2
- import FlingGestureHandler from './web/FlingGestureHandler';
3
- import LongPressGestureHandler from './web/LongPressGestureHandler';
4
- import NativeViewGestureHandler from './web/NativeViewGestureHandler';
5
- import * as NodeManager from './web/NodeManager';
6
- import PanGestureHandler from './web/PanGestureHandler';
7
- import PinchGestureHandler from './web/PinchGestureHandler';
8
- import RotationGestureHandler from './web/RotationGestureHandler';
9
- import TapGestureHandler from './web/TapGestureHandler';
10
- export const Gestures = {
11
- PanGestureHandler,
12
- RotationGestureHandler,
13
- PinchGestureHandler,
14
- TapGestureHandler,
15
- NativeViewGestureHandler,
16
- LongPressGestureHandler,
17
- FlingGestureHandler,
18
- };
19
- export default {
20
- Direction,
21
- handleSetJSResponder(tag, blockNativeResponder) {
22
- console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
23
- },
24
- handleClearJSResponder() {
25
- console.warn('handleClearJSResponder: ');
26
- },
27
- createGestureHandler(handlerName, handlerTag, config) {
28
- //TODO(TS) extends config
29
- if (!(handlerName in Gestures))
30
- throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
31
- const GestureClass = Gestures[handlerName];
32
- NodeManager.createGestureHandler(handlerTag, new GestureClass());
33
- this.updateGestureHandler(handlerTag, config);
34
- },
35
- attachGestureHandler(handlerTag, newView, propsRef) {
36
- NodeManager.getHandler(handlerTag).setView(newView, propsRef);
37
- },
38
- updateGestureHandler(handlerTag, newConfig) {
39
- NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
40
- },
41
- getGestureHandlerNode(handlerTag) {
42
- return NodeManager.getHandler(handlerTag);
43
- },
44
- dropGestureHandler(handlerTag) {
45
- NodeManager.dropGestureHandler(handlerTag);
46
- },
47
- };
package/dist/src/State.js DELETED
@@ -1,9 +0,0 @@
1
- // TODO use State from RNModule
2
- export const State = {
3
- UNDETERMINED: 0,
4
- FAILED: 1,
5
- BEGAN: 2,
6
- CANCELLED: 3,
7
- ACTIVE: 4,
8
- END: 5,
9
- };
@@ -1,23 +0,0 @@
1
- import { View, ScrollView } from 'react-native';
2
- declare const _default: {
3
- ScrollView: typeof ScrollView;
4
- PanGestureHandler: typeof View;
5
- attachGestureHandler: () => void;
6
- createGestureHandler: () => void;
7
- dropGestureHandler: () => void;
8
- updateGestureHandler: () => void;
9
- Direction: {
10
- RIGHT: number;
11
- LEFT: number;
12
- UP: number;
13
- DOWN: number;
14
- };
15
- State: {
16
- BEGAN: string;
17
- FAILED: string;
18
- ACTIVE: string;
19
- END: string;
20
- UNDETERMINED: string;
21
- };
22
- };
23
- export default _default;
@@ -1,25 +0,0 @@
1
- import { View, ScrollView } from 'react-native';
2
- const NOOP = () => {
3
- // do nothing
4
- };
5
- export default {
6
- ScrollView,
7
- PanGestureHandler: View,
8
- attachGestureHandler: NOOP,
9
- createGestureHandler: NOOP,
10
- dropGestureHandler: NOOP,
11
- updateGestureHandler: NOOP,
12
- Direction: {
13
- RIGHT: 1,
14
- LEFT: 2,
15
- UP: 4,
16
- DOWN: 8,
17
- },
18
- State: {
19
- BEGAN: 'BEGAN',
20
- FAILED: 'FAILED',
21
- ACTIVE: 'ACTIVE',
22
- END: 'END',
23
- UNDETERMINED: 'UNDETERMINED',
24
- },
25
- };
@@ -1,390 +0,0 @@
1
- // This component is based on RN's DrawerLayoutAndroid API
2
- //
3
- // It perhaps deserves to be put in a separate repo, but since it relies
4
- // on react-native-gesture-handler library which isn't very popular at the
5
- // moment I decided to keep it here for the time being. It will allow us
6
- // to move faster and fix issues that may arise in gesture handler library
7
- // that could be found when using the drawer component
8
- import React, { Component } from 'react';
9
- import invariant from 'invariant';
10
- import { Animated, StyleSheet, View, Keyboard, StatusBar, I18nManager, } from 'react-native';
11
- import { PanGestureHandler, TapGestureHandler, } from '../handlers/gestureHandlers';
12
- import { State } from '../State';
13
- const DRAG_TOSS = 0.05;
14
- const IDLE = 'Idle';
15
- const DRAGGING = 'Dragging';
16
- const SETTLING = 'Settling';
17
- export default class DrawerLayout extends Component {
18
- constructor(props) {
19
- super(props);
20
- this.accessibilityIsModalView = React.createRef();
21
- this.pointerEventsView = React.createRef();
22
- this.panGestureHandler = React.createRef();
23
- this.drawerShown = false;
24
- this.updateAnimatedEvent = (props, state) => {
25
- // Event definition is based on
26
- const { drawerPosition, drawerWidth, drawerType } = props;
27
- const { dragX: dragXValue, touchX: touchXValue, drawerTranslation, containerWidth, } = state;
28
- let dragX = dragXValue;
29
- let touchX = touchXValue;
30
- if (drawerPosition !== 'left') {
31
- // Most of the code is written in a way to handle left-side drawer.
32
- // In order to handle right-side drawer the only thing we need to
33
- // do is to reverse events coming from gesture handler in a way they
34
- // emulate left-side drawer gestures. E.g. dragX is simply -dragX, and
35
- // touchX is calulcated by subtracing real touchX from the width of the
36
- // container (such that when touch happens at the right edge the value
37
- // is simply 0)
38
- dragX = Animated.multiply(new Animated.Value(-1), dragXValue); // TODO(TS): (for all "as" in this file) make sure we can map this
39
- touchX = Animated.add(new Animated.Value(containerWidth), Animated.multiply(new Animated.Value(-1), touchXValue)); // TODO(TS): make sure we can map this;
40
- touchXValue.setValue(containerWidth);
41
- }
42
- else {
43
- touchXValue.setValue(0);
44
- }
45
- // While closing the drawer when user starts gesture outside of its area (in greyed
46
- // out part of the window), we want the drawer to follow only once finger reaches the
47
- // edge of the drawer.
48
- // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by
49
- // dots. The touch gesture starts at '*' and moves left, touch path is indicated by
50
- // an arrow pointing left
51
- // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+
52
- // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
53
- // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
54
- // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
55
- // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|
56
- // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
57
- // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
58
- // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
59
- // +---------------+ +---------------+ +---------------+ +---------------+
60
- //
61
- // For the above to work properly we define animated value that will keep start position
62
- // of the gesture. Then we use that value to calculate how much we need to subtract from
63
- // the dragX. If the gesture started on the greyed out area we take the distance from the
64
- // edge of the drawer to the start position. Otherwise we don't subtract at all and the
65
- // drawer be pulled back as soon as you start the pan.
66
- //
67
- // This is used only when drawerType is "front"
68
- //
69
- let translationX = dragX;
70
- if (drawerType === 'front') {
71
- const startPositionX = Animated.add(touchX, Animated.multiply(new Animated.Value(-1), dragX));
72
- const dragOffsetFromOnStartPosition = startPositionX.interpolate({
73
- inputRange: [drawerWidth - 1, drawerWidth, drawerWidth + 1],
74
- outputRange: [0, 0, 1],
75
- });
76
- translationX = Animated.add(dragX, dragOffsetFromOnStartPosition); // TODO: as above
77
- }
78
- this.openValue = Animated.add(translationX, drawerTranslation).interpolate({
79
- inputRange: [0, drawerWidth],
80
- outputRange: [0, 1],
81
- extrapolate: 'clamp',
82
- });
83
- const gestureOptions = {
84
- useNativeDriver: props.useNativeAnimations,
85
- };
86
- if (this.props.onDrawerSlide) {
87
- gestureOptions.listener = (ev) => {
88
- const translationX = Math.floor(Math.abs(ev.nativeEvent.translationX));
89
- const position = translationX / this.state.containerWidth;
90
- this.props.onDrawerSlide?.(position);
91
- };
92
- }
93
- this.onGestureEvent = Animated.event([{ nativeEvent: { translationX: dragXValue, x: touchXValue } }], gestureOptions);
94
- };
95
- this.handleContainerLayout = ({ nativeEvent }) => {
96
- this.setState({ containerWidth: nativeEvent.layout.width });
97
- };
98
- this.emitStateChanged = (newState, drawerWillShow) => {
99
- this.props.onDrawerStateChanged?.(newState, drawerWillShow);
100
- };
101
- this.openingHandlerStateChange = ({ nativeEvent, }) => {
102
- if (nativeEvent.oldState === State.ACTIVE) {
103
- this.handleRelease({ nativeEvent });
104
- }
105
- else if (nativeEvent.state === State.ACTIVE) {
106
- this.emitStateChanged(DRAGGING, false);
107
- if (this.props.keyboardDismissMode === 'on-drag') {
108
- Keyboard.dismiss();
109
- }
110
- if (this.props.hideStatusBar) {
111
- StatusBar.setHidden(true, this.props.statusBarAnimation || 'slide');
112
- }
113
- }
114
- };
115
- this.onTapHandlerStateChange = ({ nativeEvent, }) => {
116
- if (this.drawerShown &&
117
- nativeEvent.oldState === State.ACTIVE &&
118
- this.props.drawerLockMode !== 'locked-open') {
119
- this.closeDrawer();
120
- }
121
- };
122
- this.handleRelease = ({ nativeEvent, }) => {
123
- const { drawerWidth, drawerPosition, drawerType } = this.props;
124
- const { containerWidth } = this.state;
125
- let { translationX: dragX, velocityX, x: touchX } = nativeEvent;
126
- if (drawerPosition !== 'left') {
127
- // See description in _updateAnimatedEvent about why events are flipped
128
- // for right-side drawer
129
- dragX = -dragX;
130
- touchX = containerWidth - touchX;
131
- velocityX = -velocityX;
132
- }
133
- const gestureStartX = touchX - dragX;
134
- let dragOffsetBasedOnStart = 0;
135
- if (drawerType === 'front') {
136
- dragOffsetBasedOnStart =
137
- gestureStartX > drawerWidth ? gestureStartX - drawerWidth : 0;
138
- }
139
- const startOffsetX = dragX + dragOffsetBasedOnStart + (this.drawerShown ? drawerWidth : 0);
140
- const projOffsetX = startOffsetX + DRAG_TOSS * velocityX;
141
- const shouldOpen = projOffsetX > drawerWidth / 2;
142
- if (shouldOpen) {
143
- this.animateDrawer(startOffsetX, drawerWidth, velocityX);
144
- }
145
- else {
146
- this.animateDrawer(startOffsetX, 0, velocityX);
147
- }
148
- };
149
- this.updateShowing = (showing) => {
150
- this.drawerShown = showing;
151
- this.accessibilityIsModalView.current?.setNativeProps({
152
- accessibilityViewIsModal: showing,
153
- });
154
- this.pointerEventsView.current?.setNativeProps({
155
- pointerEvents: showing ? 'auto' : 'none',
156
- });
157
- const { drawerPosition, minSwipeDistance, edgeWidth } = this.props;
158
- const fromLeft = drawerPosition === 'left';
159
- // gestureOrientation is 1 if the expected gesture is from left to right and -1 otherwise
160
- // e.g. when drawer is on the left and is closed we expect left to right gesture, thus
161
- // orientation will be 1.
162
- const gestureOrientation = (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);
163
- // When drawer is closed we want the hitSlop to be horizontally shorter
164
- // than the container size by the value of SLOP. This will make it only
165
- // activate when gesture happens not further than SLOP away from the edge
166
- const hitSlop = fromLeft
167
- ? { left: 0, width: showing ? undefined : edgeWidth }
168
- : { right: 0, width: showing ? undefined : edgeWidth };
169
- // @ts-ignore internal API, maybe could be fixed in handler types
170
- this.panGestureHandler.current?.setNativeProps({
171
- hitSlop,
172
- activeOffsetX: gestureOrientation * minSwipeDistance,
173
- });
174
- };
175
- this.animateDrawer = (fromValue, toValue, velocity, speed) => {
176
- this.state.dragX.setValue(0);
177
- this.state.touchX.setValue(this.props.drawerPosition === 'left' ? 0 : this.state.containerWidth);
178
- if (fromValue != null) {
179
- let nextFramePosition = fromValue;
180
- if (this.props.useNativeAnimations) {
181
- // When using native driver, we predict the next position of the animation
182
- // because it takes one frame of a roundtrip to pass RELEASE event from
183
- // native driver to JS before we can start animating. Without it, it is more
184
- // noticable that the frame is dropped.
185
- if (fromValue < toValue && velocity > 0) {
186
- nextFramePosition = Math.min(fromValue + velocity / 60.0, toValue);
187
- }
188
- else if (fromValue > toValue && velocity < 0) {
189
- nextFramePosition = Math.max(fromValue + velocity / 60.0, toValue);
190
- }
191
- }
192
- this.state.drawerTranslation.setValue(nextFramePosition);
193
- }
194
- const willShow = toValue !== 0;
195
- this.updateShowing(willShow);
196
- this.emitStateChanged(SETTLING, willShow);
197
- if (this.props.hideStatusBar) {
198
- StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');
199
- }
200
- Animated.spring(this.state.drawerTranslation, {
201
- velocity,
202
- bounciness: 0,
203
- toValue,
204
- useNativeDriver: this.props.useNativeAnimations,
205
- speed: speed ?? undefined,
206
- }).start(({ finished }) => {
207
- if (finished) {
208
- this.emitStateChanged(IDLE, willShow);
209
- if (willShow) {
210
- this.props.onDrawerOpen?.();
211
- }
212
- else {
213
- this.props.onDrawerClose?.();
214
- }
215
- }
216
- });
217
- };
218
- this.openDrawer = (options = {}) => {
219
- this.animateDrawer(
220
- // TODO: decide if it should be null or undefined is the proper value
221
- undefined, this.props.drawerWidth, options.velocity ? options.velocity : 0);
222
- // We need to force the update, otherwise the overlay is not rerendered and it would not be clickable
223
- this.forceUpdate();
224
- };
225
- this.closeDrawer = (options = {}) => {
226
- // TODO: decide if it should be null or undefined is the proper value
227
- this.animateDrawer(undefined, 0, options.velocity ? options.velocity : 0);
228
- // We need to force the update, otherwise the overlay is not rerendered and it would be still clickable
229
- this.forceUpdate();
230
- };
231
- this.renderOverlay = () => {
232
- /* Overlay styles */
233
- invariant(this.openValue, 'should be set');
234
- const overlayOpacity = this.openValue.interpolate({
235
- inputRange: [0, 1],
236
- outputRange: [0, 1],
237
- extrapolate: 'clamp',
238
- });
239
- const dynamicOverlayStyles = {
240
- opacity: overlayOpacity,
241
- backgroundColor: this.props.overlayColor,
242
- };
243
- return (<TapGestureHandler onHandlerStateChange={this.onTapHandlerStateChange}>
244
- <Animated.View pointerEvents={this.drawerShown ? 'auto' : 'none'} ref={this.pointerEventsView} style={[styles.overlay, dynamicOverlayStyles]}/>
245
- </TapGestureHandler>);
246
- };
247
- this.renderDrawer = () => {
248
- const { drawerBackgroundColor, drawerWidth, drawerPosition, drawerType, drawerContainerStyle, contentContainerStyle, } = this.props;
249
- const fromLeft = drawerPosition === 'left';
250
- const drawerSlide = drawerType !== 'back';
251
- const containerSlide = drawerType !== 'front';
252
- // we rely on row and row-reverse flex directions to position the drawer
253
- // properly. Apparently for RTL these are flipped which requires us to use
254
- // the opposite setting for the drawer to appear from left or right according
255
- // to the drawerPosition prop
256
- const reverseContentDirection = I18nManager.isRTL ? fromLeft : !fromLeft;
257
- const dynamicDrawerStyles = {
258
- backgroundColor: drawerBackgroundColor,
259
- width: drawerWidth,
260
- };
261
- const openValue = this.openValue;
262
- invariant(openValue, 'should be set');
263
- let containerStyles;
264
- if (containerSlide) {
265
- const containerTranslateX = openValue.interpolate({
266
- inputRange: [0, 1],
267
- outputRange: fromLeft ? [0, drawerWidth] : [0, -drawerWidth],
268
- extrapolate: 'clamp',
269
- });
270
- containerStyles = {
271
- transform: [{ translateX: containerTranslateX }],
272
- };
273
- }
274
- let drawerTranslateX = 0;
275
- if (drawerSlide) {
276
- const closedDrawerOffset = fromLeft ? -drawerWidth : drawerWidth;
277
- drawerTranslateX = openValue.interpolate({
278
- inputRange: [0, 1],
279
- outputRange: [closedDrawerOffset, 0],
280
- extrapolate: 'clamp',
281
- });
282
- }
283
- const drawerStyles = {
284
- transform: [{ translateX: drawerTranslateX }],
285
- flexDirection: reverseContentDirection ? 'row-reverse' : 'row',
286
- };
287
- return (<Animated.View style={styles.main} onLayout={this.handleContainerLayout}>
288
- <Animated.View style={[
289
- drawerType === 'front'
290
- ? styles.containerOnBack
291
- : styles.containerInFront,
292
- containerStyles,
293
- contentContainerStyle,
294
- ]} importantForAccessibility={this.drawerShown ? 'no-hide-descendants' : 'yes'}>
295
- {typeof this.props.children === 'function'
296
- ? this.props.children(this.openValue)
297
- : this.props.children}
298
- {this.renderOverlay()}
299
- </Animated.View>
300
- <Animated.View pointerEvents="box-none" ref={this.accessibilityIsModalView} accessibilityViewIsModal={this.drawerShown} style={[styles.drawerContainer, drawerStyles, drawerContainerStyle]}>
301
- <View style={dynamicDrawerStyles}>
302
- {this.props.renderNavigationView(this.openValue)}
303
- </View>
304
- </Animated.View>
305
- </Animated.View>);
306
- };
307
- this.setPanGestureRef = (ref) => {
308
- // TODO(TS): make sure it is OK
309
- // taken from https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-596081842
310
- this
311
- .panGestureHandler.current = ref;
312
- this.props.onGestureRef?.(ref);
313
- };
314
- const dragX = new Animated.Value(0);
315
- const touchX = new Animated.Value(0);
316
- const drawerTranslation = new Animated.Value(0);
317
- this.state = {
318
- dragX,
319
- touchX,
320
- drawerTranslation,
321
- containerWidth: 0,
322
- };
323
- this.updateAnimatedEvent(props, this.state);
324
- }
325
- UNSAFE_componentWillUpdate(props, state) {
326
- if (this.props.drawerPosition !== props.drawerPosition ||
327
- this.props.drawerWidth !== props.drawerWidth ||
328
- this.props.drawerType !== props.drawerType ||
329
- this.state.containerWidth !== state.containerWidth) {
330
- this.updateAnimatedEvent(props, state);
331
- }
332
- }
333
- render() {
334
- const { drawerPosition, drawerLockMode, edgeWidth, minSwipeDistance, } = this.props;
335
- const fromLeft = drawerPosition === 'left';
336
- // gestureOrientation is 1 if the expected gesture is from left to right and -1 otherwise
337
- // e.g. when drawer is on the left and is closed we expect left to right gesture, thus
338
- // orientation will be 1.
339
- const gestureOrientation = (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);
340
- // When drawer is closed we want the hitSlop to be horizontally shorter
341
- // than the container size by the value of SLOP. This will make it only
342
- // activate when gesture happens not further than SLOP away from the edge
343
- const hitSlop = fromLeft
344
- ? { left: 0, width: this.drawerShown ? undefined : edgeWidth }
345
- : { right: 0, width: this.drawerShown ? undefined : edgeWidth };
346
- return (<PanGestureHandler
347
- // @ts-ignore could be fixed in handler types
348
- ref={this.setPanGestureRef} hitSlop={hitSlop} activeOffsetX={gestureOrientation * minSwipeDistance} failOffsetY={[-15, 15]} onGestureEvent={this.onGestureEvent} onHandlerStateChange={this.openingHandlerStateChange} enableTrackpadTwoFingerGesture={this.props.enableTrackpadTwoFingerGesture} enabled={drawerLockMode !== 'locked-closed' && drawerLockMode !== 'locked-open'}>
349
- {this.renderDrawer()}
350
- </PanGestureHandler>);
351
- }
352
- }
353
- DrawerLayout.defaultProps = {
354
- drawerWidth: 200,
355
- drawerPosition: 'left',
356
- useNativeAnimations: true,
357
- drawerType: 'front',
358
- edgeWidth: 20,
359
- minSwipeDistance: 3,
360
- overlayColor: 'rgba(0, 0, 0, 0.7)',
361
- drawerLockMode: 'unlocked',
362
- enableTrackpadTwoFingerGesture: false,
363
- };
364
- DrawerLayout.positions = {
365
- Left: 'left',
366
- Right: 'right',
367
- };
368
- const styles = StyleSheet.create({
369
- drawerContainer: {
370
- ...StyleSheet.absoluteFillObject,
371
- zIndex: 1001,
372
- flexDirection: 'row',
373
- },
374
- containerInFront: {
375
- ...StyleSheet.absoluteFillObject,
376
- zIndex: 1002,
377
- },
378
- containerOnBack: {
379
- ...StyleSheet.absoluteFillObject,
380
- },
381
- main: {
382
- flex: 1,
383
- zIndex: 0,
384
- overflow: 'hidden',
385
- },
386
- overlay: {
387
- ...StyleSheet.absoluteFillObject,
388
- zIndex: 1000,
389
- },
390
- });
@@ -1,113 +0,0 @@
1
- import React from 'react';
2
- import { Animated, Platform, processColor, StyleSheet, } from 'react-native';
3
- import createNativeWrapper from '../handlers/createNativeWrapper';
4
- import GestureHandlerButton from './GestureHandlerButton';
5
- import { State } from '../State';
6
- export const RawButton = createNativeWrapper(GestureHandlerButton, {
7
- shouldCancelWhenOutside: false,
8
- shouldActivateOnStart: false,
9
- });
10
- export class BaseButton extends React.Component {
11
- constructor(props) {
12
- super(props);
13
- this.handleEvent = ({ nativeEvent, }) => {
14
- const { state, oldState, pointerInside } = nativeEvent;
15
- const active = pointerInside && state === State.ACTIVE;
16
- if (active !== this.lastActive && this.props.onActiveStateChange) {
17
- this.props.onActiveStateChange(active);
18
- }
19
- if (oldState === State.ACTIVE &&
20
- state !== State.CANCELLED &&
21
- this.lastActive &&
22
- this.props.onPress) {
23
- this.props.onPress(active);
24
- }
25
- this.lastActive = active;
26
- };
27
- // Normally, the parent would execute it's handler first,
28
- // then forward the event to listeners. However, here our handler
29
- // is virtually only forwarding events to listeners, so we reverse the order
30
- // to keep the proper order of the callbacks (from "raw" ones to "processed").
31
- this.onHandlerStateChange = (e) => {
32
- this.props.onHandlerStateChange?.(e);
33
- this.handleEvent(e);
34
- };
35
- this.onGestureEvent = (e) => {
36
- this.props.onGestureEvent?.(e);
37
- this.handleEvent(e); // TODO: maybe it is not correct
38
- };
39
- this.lastActive = false;
40
- }
41
- render() {
42
- const { rippleColor, ...rest } = this.props;
43
- return (<RawButton rippleColor={processColor(rippleColor)} {...rest} onGestureEvent={this.onGestureEvent} onHandlerStateChange={this.onHandlerStateChange}/>);
44
- }
45
- }
46
- const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
47
- const btnStyles = StyleSheet.create({
48
- underlay: {
49
- position: 'absolute',
50
- left: 0,
51
- right: 0,
52
- bottom: 0,
53
- top: 0,
54
- },
55
- });
56
- export class RectButton extends React.Component {
57
- constructor(props) {
58
- super(props);
59
- this.onActiveStateChange = (active) => {
60
- if (Platform.OS !== 'android') {
61
- this.opacity.setValue(active ? this.props.activeOpacity : 0);
62
- }
63
- this.props.onActiveStateChange?.(active);
64
- };
65
- this.opacity = new Animated.Value(0);
66
- }
67
- render() {
68
- const { children, style, ...rest } = this.props;
69
- const resolvedStyle = StyleSheet.flatten(style ?? {});
70
- return (<BaseButton {...rest} style={resolvedStyle} onActiveStateChange={this.onActiveStateChange}>
71
- <Animated.View style={[
72
- btnStyles.underlay,
73
- {
74
- opacity: this.opacity,
75
- backgroundColor: this.props.underlayColor,
76
- borderRadius: resolvedStyle.borderRadius,
77
- borderTopLeftRadius: resolvedStyle.borderTopLeftRadius,
78
- borderTopRightRadius: resolvedStyle.borderTopRightRadius,
79
- borderBottomLeftRadius: resolvedStyle.borderBottomLeftRadius,
80
- borderBottomRightRadius: resolvedStyle.borderBottomRightRadius,
81
- },
82
- ]}/>
83
- {children}
84
- </BaseButton>);
85
- }
86
- }
87
- RectButton.defaultProps = {
88
- activeOpacity: 0.105,
89
- underlayColor: 'black',
90
- };
91
- export class BorderlessButton extends React.Component {
92
- constructor(props) {
93
- super(props);
94
- this.onActiveStateChange = (active) => {
95
- if (Platform.OS !== 'android') {
96
- this.opacity.setValue(active ? this.props.activeOpacity : 1);
97
- }
98
- this.props.onActiveStateChange?.(active);
99
- };
100
- this.opacity = new Animated.Value(1);
101
- }
102
- render() {
103
- const { children, style, ...rest } = this.props;
104
- return (<AnimatedBaseButton {...rest} onActiveStateChange={this.onActiveStateChange} style={[style, Platform.OS === 'ios' && { opacity: this.opacity }]}>
105
- {children}
106
- </AnimatedBaseButton>);
107
- }
108
- }
109
- BorderlessButton.defaultProps = {
110
- activeOpacity: 0.3,
111
- borderless: true,
112
- };
113
- export { default as PureNativeButton } from './GestureHandlerButton';
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import { ScrollViewProps as RNScrollViewProps, SwitchProps as RNSwitchProps, TextInputProps as RNTextInputProps, DrawerLayoutAndroidProps as RNDrawerLayoutAndroidProps, FlatList as RNFlatList, FlatListProps as RNFlatListProps } from 'react-native';
3
- import { NativeViewGestureHandlerProps } from '../handlers/NativeViewGestureHandler';
4
- export declare const ScrollView: React.ForwardRefExoticComponent<RNScrollViewProps & {
5
- children?: React.ReactNode;
6
- } & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
7
- export declare type ScrollView = typeof ScrollView & {
8
- scrollTo(y?: number | {
9
- x?: number;
10
- y?: number;
11
- animated?: boolean;
12
- }, x?: number, animated?: boolean): void;
13
- scrollToEnd(options?: {
14
- animated: boolean;
15
- }): void;
16
- };
17
- export declare const Switch: React.ForwardRefExoticComponent<RNSwitchProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
18
- export declare type Switch = typeof Switch;
19
- export declare const TextInput: React.ForwardRefExoticComponent<RNTextInputProps & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
20
- export declare type TextInput = typeof TextInput;
21
- export declare const DrawerLayoutAndroid: React.ForwardRefExoticComponent<RNDrawerLayoutAndroidProps & {
22
- children?: React.ReactNode;
23
- } & NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
24
- export declare type DrawerLayoutAndroid = typeof DrawerLayoutAndroid;
25
- export declare const FlatList: React.ForwardRefExoticComponent<RNFlatListProps<any> & React.RefAttributes<RNFlatList<any>>>;
26
- export declare type FlatList<ItemT> = React.ComponentType<RNFlatListProps<ItemT> & NativeViewGestureHandlerProps & React.RefAttributes<any>> & {
27
- scrollToEnd: (params?: {
28
- animated?: boolean;
29
- }) => void;
30
- scrollToIndex: (params: {
31
- animated?: boolean;
32
- index: number;
33
- viewOffset?: number;
34
- viewPosition?: number;
35
- }) => void;
36
- scrollToItem: (params: {
37
- animated?: boolean;
38
- item: ItemT;
39
- viewPosition?: number;
40
- }) => void;
41
- scrollToOffset: (params: {
42
- animated?: boolean;
43
- offset: number;
44
- }) => void;
45
- };
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { ScrollView as RNScrollView, Switch as RNSwitch, TextInput as RNTextInput, DrawerLayoutAndroid as RNDrawerLayoutAndroid, FlatList as RNFlatList, } from 'react-native';
3
- import createNativeWrapper from '../handlers/createNativeWrapper';
4
- export const ScrollView = createNativeWrapper(RNScrollView, {
5
- disallowInterruption: true,
6
- shouldCancelWhenOutside: false,
7
- });
8
- export const Switch = createNativeWrapper(RNSwitch, {
9
- shouldCancelWhenOutside: false,
10
- shouldActivateOnStart: true,
11
- disallowInterruption: true,
12
- });
13
- export const TextInput = createNativeWrapper(RNTextInput);
14
- export const DrawerLayoutAndroid = createNativeWrapper(RNDrawerLayoutAndroid, { disallowInterruption: true });
15
- // we use literal object since TS gives error when using RN's `positions`
16
- // @ts-ignore FIXME(TS) maybe this should be removed?
17
- DrawerLayoutAndroid.positions = { Left: 'left', Right: 'right' };
18
- export const FlatList = React.forwardRef((props, ref) => (<RNFlatList ref={ref} {...props} renderScrollComponent={(scrollProps) => <ScrollView {...scrollProps}/>}/>));