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,7 +0,0 @@
1
- import React from 'react';
2
- import { FlatListProps } from 'react-native';
3
- export declare const ScrollView: React.ForwardRefExoticComponent<import("react-native").ScrollViewProps & import("../..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
4
- export declare const Switch: React.ForwardRefExoticComponent<import("react-native").SwitchProps & import("../..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
5
- export declare const TextInput: React.ForwardRefExoticComponent<import("react-native").TextInputProps & import("../..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
6
- export declare const DrawerLayoutAndroid: React.ForwardRefExoticComponent<import("react-native").DrawerLayoutAndroidProps & import("../..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
7
- export declare const FlatList: React.ForwardRefExoticComponent<FlatListProps<unknown> & React.RefAttributes<unknown>>;
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { DrawerLayoutAndroid as RNDrawerLayoutAndroid, FlatList as RNFlatList, Switch as RNSwitch, TextInput as RNTextInput, ScrollView as RNScrollView, } from 'react-native';
3
- import createNativeWrapper from '../handlers/createNativeWrapper';
4
- export const ScrollView = createNativeWrapper(RNScrollView, {
5
- disallowInterruption: true,
6
- });
7
- export const Switch = createNativeWrapper(RNSwitch, {
8
- shouldCancelWhenOutside: false,
9
- shouldActivateOnStart: true,
10
- disallowInterruption: true,
11
- });
12
- export const TextInput = createNativeWrapper(RNTextInput);
13
- export const DrawerLayoutAndroid = createNativeWrapper(RNDrawerLayoutAndroid, {
14
- disallowInterruption: true,
15
- });
16
- // @ts-ignore -- TODO(TS) to investigate if it's needed
17
- DrawerLayoutAndroid.positions = RNDrawerLayoutAndroid.positions;
18
- export const FlatList = React.forwardRef((props, ref) => (<RNFlatList ref={ref} {...props} renderScrollComponent={(scrollProps) => <ScrollView {...scrollProps}/>}/>));
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
- export default React.forwardRef((props, ref) => (<View ref={ref} accessibilityRole="button" {...props}/>));
@@ -1,82 +0,0 @@
1
- import React, { Component } from 'react';
2
- import { Animated, StyleProp, ViewStyle } from 'react-native';
3
- import { PanGestureHandlerProps } from '../handlers/gestureHandlers';
4
- declare type SwipeableExcludes = Exclude<keyof PanGestureHandlerProps, 'onGestureEvent' | 'onHandlerStateChange'>;
5
- interface SwipeableProps extends Pick<PanGestureHandlerProps, SwipeableExcludes> {
6
- enableTrackpadTwoFingerGesture?: boolean;
7
- friction?: number;
8
- leftThreshold?: number;
9
- rightThreshold?: number;
10
- overshootLeft?: boolean;
11
- overshootRight?: boolean;
12
- overshootFriction?: number;
13
- onSwipeableLeftOpen?: () => void;
14
- onSwipeableRightOpen?: () => void;
15
- onSwipeableOpen?: () => void;
16
- onSwipeableClose?: () => void;
17
- onSwipeableLeftWillOpen?: () => void;
18
- onSwipeableRightWillOpen?: () => void;
19
- onSwipeableWillOpen?: () => void;
20
- onSwipeableWillClose?: () => void;
21
- /**
22
- *
23
- * This map describes the values to use as inputRange for extra interpolation:
24
- * AnimatedValue: [startValue, endValue]
25
- *
26
- * progressAnimatedValue: [0, 1]
27
- * dragAnimatedValue: [0, +]
28
- *
29
- * To support `rtl` flexbox layouts use `flexDirection` styling.
30
- * */
31
- renderLeftActions?: (progressAnimatedValue: Animated.AnimatedInterpolation, dragAnimatedValue: Animated.AnimatedInterpolation) => React.ReactNode;
32
- /**
33
- *
34
- * This map describes the values to use as inputRange for extra interpolation:
35
- * AnimatedValue: [startValue, endValue]
36
- *
37
- * progressAnimatedValue: [0, 1]
38
- * dragAnimatedValue: [0, -]
39
- *
40
- * To support `rtl` flexbox layouts use `flexDirection` styling.
41
- * */
42
- renderRightActions?: (progressAnimatedValue: Animated.AnimatedInterpolation, dragAnimatedValue: Animated.AnimatedInterpolation) => React.ReactNode;
43
- useNativeAnimations?: boolean;
44
- animationOptions?: Record<string, unknown>;
45
- containerStyle?: StyleProp<ViewStyle>;
46
- childrenContainerStyle?: StyleProp<ViewStyle>;
47
- }
48
- declare type SwipeableState = {
49
- dragX: Animated.Value;
50
- rowTranslation: Animated.Value;
51
- rowState: number;
52
- leftWidth?: number;
53
- rightOffset?: number;
54
- rowWidth?: number;
55
- };
56
- export default class Swipeable extends Component<SwipeableProps, SwipeableState> {
57
- static defaultProps: {
58
- friction: number;
59
- overshootFriction: number;
60
- useNativeAnimations: boolean;
61
- };
62
- constructor(props: SwipeableProps);
63
- UNSAFE_componentWillUpdate(props: SwipeableProps, state: SwipeableState): void;
64
- private onGestureEvent?;
65
- private transX?;
66
- private showLeftAction?;
67
- private leftActionTranslate?;
68
- private showRightAction?;
69
- private rightActionTranslate?;
70
- private updateAnimatedEvent;
71
- private onTapHandlerStateChange;
72
- private onHandlerStateChange;
73
- private handleRelease;
74
- private animateRow;
75
- private onRowLayout;
76
- private currentOffset;
77
- close: () => void;
78
- openLeft: () => void;
79
- openRight: () => void;
80
- render(): JSX.Element;
81
- }
82
- export {};
@@ -1,248 +0,0 @@
1
- // Similarily to the DrawerLayout component this deserves to be put in a
2
- // separate repo. Although, keeping it here for the time being will allow us
3
- // to move faster and fix possible issues quicker
4
- import React, { Component } from 'react';
5
- import { Animated, StyleSheet, View, I18nManager, } from 'react-native';
6
- import { PanGestureHandler, TapGestureHandler, } from '../handlers/gestureHandlers';
7
- import { State } from '../State';
8
- const DRAG_TOSS = 0.05;
9
- export default class Swipeable extends Component {
10
- constructor(props) {
11
- super(props);
12
- this.updateAnimatedEvent = (props, state) => {
13
- const { friction, overshootFriction } = props;
14
- const { dragX, rowTranslation, leftWidth = 0, rowWidth = 0 } = state;
15
- const { rightOffset = rowWidth } = state;
16
- const rightWidth = Math.max(0, rowWidth - rightOffset);
17
- const { overshootLeft = leftWidth > 0, overshootRight = rightWidth > 0, } = props;
18
- const transX = Animated.add(rowTranslation, dragX.interpolate({
19
- inputRange: [0, friction],
20
- outputRange: [0, 1],
21
- })).interpolate({
22
- inputRange: [
23
- -rightWidth - (overshootRight ? 1 : overshootFriction),
24
- -rightWidth,
25
- leftWidth,
26
- leftWidth + (overshootLeft ? 1 : overshootFriction),
27
- ],
28
- outputRange: [
29
- -rightWidth - (overshootRight || overshootFriction > 1 ? 1 : 0),
30
- -rightWidth,
31
- leftWidth,
32
- leftWidth + (overshootLeft || overshootFriction > 1 ? 1 : 0),
33
- ],
34
- });
35
- this.transX = transX;
36
- this.showLeftAction =
37
- leftWidth > 0
38
- ? transX.interpolate({
39
- inputRange: [-1, 0, leftWidth],
40
- outputRange: [0, 0, 1],
41
- })
42
- : new Animated.Value(0);
43
- this.leftActionTranslate = this.showLeftAction.interpolate({
44
- inputRange: [0, Number.MIN_VALUE],
45
- outputRange: [-10000, 0],
46
- extrapolate: 'clamp',
47
- });
48
- this.showRightAction =
49
- rightWidth > 0
50
- ? transX.interpolate({
51
- inputRange: [-rightWidth, 0, 1],
52
- outputRange: [1, 0, 0],
53
- })
54
- : new Animated.Value(0);
55
- this.rightActionTranslate = this.showRightAction.interpolate({
56
- inputRange: [0, Number.MIN_VALUE],
57
- outputRange: [-10000, 0],
58
- extrapolate: 'clamp',
59
- });
60
- };
61
- this.onTapHandlerStateChange = ({ nativeEvent, }) => {
62
- if (nativeEvent.oldState === State.ACTIVE) {
63
- this.close();
64
- }
65
- };
66
- this.onHandlerStateChange = (ev) => {
67
- if (ev.nativeEvent.oldState === State.ACTIVE) {
68
- this.handleRelease(ev);
69
- }
70
- };
71
- this.handleRelease = (ev) => {
72
- const { velocityX, translationX: dragX } = ev.nativeEvent;
73
- const { leftWidth = 0, rowWidth = 0, rowState } = this.state;
74
- const { rightOffset = rowWidth } = this.state;
75
- const rightWidth = rowWidth - rightOffset;
76
- const { friction, leftThreshold = leftWidth / 2, rightThreshold = rightWidth / 2, } = this.props;
77
- const startOffsetX = this.currentOffset() + dragX / friction;
78
- const translationX = (dragX + DRAG_TOSS * velocityX) / friction;
79
- let toValue = 0;
80
- if (rowState === 0) {
81
- if (translationX > leftThreshold) {
82
- toValue = leftWidth;
83
- }
84
- else if (translationX < -rightThreshold) {
85
- toValue = -rightWidth;
86
- }
87
- }
88
- else if (rowState === 1) {
89
- // swiped to left
90
- if (translationX > -leftThreshold) {
91
- toValue = leftWidth;
92
- }
93
- }
94
- else {
95
- // swiped to right
96
- if (translationX < rightThreshold) {
97
- toValue = -rightWidth;
98
- }
99
- }
100
- this.animateRow(startOffsetX, toValue, velocityX / friction);
101
- };
102
- this.animateRow = (fromValue, toValue, velocityX) => {
103
- const { dragX, rowTranslation } = this.state;
104
- dragX.setValue(0);
105
- rowTranslation.setValue(fromValue);
106
- this.setState({ rowState: Math.sign(toValue) });
107
- Animated.spring(rowTranslation, {
108
- restSpeedThreshold: 1.7,
109
- restDisplacementThreshold: 0.4,
110
- velocity: velocityX,
111
- bounciness: 0,
112
- toValue,
113
- useNativeDriver: this.props.useNativeAnimations,
114
- ...this.props.animationOptions,
115
- }).start(({ finished }) => {
116
- if (finished) {
117
- if (toValue > 0 && this.props.onSwipeableLeftOpen) {
118
- this.props.onSwipeableLeftOpen();
119
- }
120
- else if (toValue < 0 && this.props.onSwipeableRightOpen) {
121
- this.props.onSwipeableRightOpen();
122
- }
123
- if (toValue === 0) {
124
- this.props.onSwipeableClose?.();
125
- }
126
- else {
127
- this.props.onSwipeableOpen?.();
128
- }
129
- }
130
- });
131
- if (toValue > 0 && this.props.onSwipeableLeftWillOpen) {
132
- this.props.onSwipeableLeftWillOpen();
133
- }
134
- else if (toValue < 0 && this.props.onSwipeableRightWillOpen) {
135
- this.props.onSwipeableRightWillOpen();
136
- }
137
- if (toValue === 0) {
138
- this.props.onSwipeableWillClose?.();
139
- }
140
- else {
141
- this.props.onSwipeableWillOpen?.();
142
- }
143
- };
144
- this.onRowLayout = ({ nativeEvent }) => {
145
- this.setState({ rowWidth: nativeEvent.layout.width });
146
- };
147
- this.currentOffset = () => {
148
- const { leftWidth = 0, rowWidth = 0, rowState } = this.state;
149
- const { rightOffset = rowWidth } = this.state;
150
- const rightWidth = rowWidth - rightOffset;
151
- if (rowState === 1) {
152
- return leftWidth;
153
- }
154
- else if (rowState === -1) {
155
- return -rightWidth;
156
- }
157
- return 0;
158
- };
159
- this.close = () => {
160
- this.animateRow(this.currentOffset(), 0);
161
- };
162
- this.openLeft = () => {
163
- const { leftWidth = 0 } = this.state;
164
- this.animateRow(this.currentOffset(), leftWidth);
165
- };
166
- this.openRight = () => {
167
- const { rowWidth = 0 } = this.state;
168
- const { rightOffset = rowWidth } = this.state;
169
- const rightWidth = rowWidth - rightOffset;
170
- this.animateRow(this.currentOffset(), -rightWidth);
171
- };
172
- const dragX = new Animated.Value(0);
173
- this.state = {
174
- dragX,
175
- rowTranslation: new Animated.Value(0),
176
- rowState: 0,
177
- leftWidth: undefined,
178
- rightOffset: undefined,
179
- rowWidth: undefined,
180
- };
181
- this.updateAnimatedEvent(props, this.state);
182
- this.onGestureEvent = Animated.event([{ nativeEvent: { translationX: dragX } }], { useNativeDriver: props.useNativeAnimations });
183
- }
184
- UNSAFE_componentWillUpdate(props, state) {
185
- if (this.props.friction !== props.friction ||
186
- this.props.overshootLeft !== props.overshootLeft ||
187
- this.props.overshootRight !== props.overshootRight ||
188
- this.props.overshootFriction !== props.overshootFriction ||
189
- this.state.leftWidth !== state.leftWidth ||
190
- this.state.rightOffset !== state.rightOffset ||
191
- this.state.rowWidth !== state.rowWidth) {
192
- this.updateAnimatedEvent(props, state);
193
- }
194
- }
195
- render() {
196
- const { rowState } = this.state;
197
- const { children, renderLeftActions, renderRightActions } = this.props;
198
- const left = renderLeftActions && (<Animated.View style={[
199
- styles.leftActions,
200
- // all those and below parameters can have ! since they are all asigned in constructor in `updateAnimatedEvent` but TS cannot spot it for some reason
201
- { transform: [{ translateX: this.leftActionTranslate }] },
202
- ]}>
203
- {renderLeftActions(this.showLeftAction, this.transX)}
204
- <View onLayout={({ nativeEvent }) => this.setState({ leftWidth: nativeEvent.layout.x })}/>
205
- </Animated.View>);
206
- const right = renderRightActions && (<Animated.View style={[
207
- styles.rightActions,
208
- { transform: [{ translateX: this.rightActionTranslate }] },
209
- ]}>
210
- {renderRightActions(this.showRightAction, this.transX)}
211
- <View onLayout={({ nativeEvent }) => this.setState({ rightOffset: nativeEvent.layout.x })}/>
212
- </Animated.View>);
213
- return (<PanGestureHandler activeOffsetX={[-10, 10]} {...this.props} onGestureEvent={this.onGestureEvent} onHandlerStateChange={this.onHandlerStateChange}>
214
- <Animated.View onLayout={this.onRowLayout} style={[styles.container, this.props.containerStyle]}>
215
- {left}
216
- {right}
217
- <TapGestureHandler enabled={rowState !== 0} onHandlerStateChange={this.onTapHandlerStateChange}>
218
- <Animated.View pointerEvents={rowState === 0 ? 'auto' : 'box-only'} style={[
219
- {
220
- transform: [{ translateX: this.transX }],
221
- },
222
- this.props.childrenContainerStyle,
223
- ]}>
224
- {children}
225
- </Animated.View>
226
- </TapGestureHandler>
227
- </Animated.View>
228
- </PanGestureHandler>);
229
- }
230
- }
231
- Swipeable.defaultProps = {
232
- friction: 1,
233
- overshootFriction: 1,
234
- useNativeAnimations: true,
235
- };
236
- const styles = StyleSheet.create({
237
- container: {
238
- overflow: 'hidden',
239
- },
240
- leftActions: {
241
- ...StyleSheet.absoluteFillObject,
242
- flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row',
243
- },
244
- rightActions: {
245
- ...StyleSheet.absoluteFillObject,
246
- flexDirection: I18nManager.isRTL ? 'row' : 'row-reverse',
247
- },
248
- });
@@ -1,209 +0,0 @@
1
- import React, { Component } from 'react';
2
- import { Animated, Platform, } from 'react-native';
3
- import { State } from '../../State';
4
- import { BaseButton } from '../GestureButtons';
5
- /**
6
- * Each touchable is a states' machine which preforms transitions.
7
- * On very beginning (and on the very end or recognition) touchable is
8
- * UNDETERMINED. Then it moves to BEGAN. If touchable recognizes that finger
9
- * travel outside it transits to special MOVED_OUTSIDE state. Gesture recognition
10
- * finishes in UNDETERMINED state.
11
- */
12
- export const TOUCHABLE_STATE = {
13
- UNDETERMINED: 0,
14
- BEGAN: 1,
15
- MOVED_OUTSIDE: 2,
16
- };
17
- /**
18
- * GenericTouchable is not intented to be used as it is.
19
- * Should be treated as a source for the rest of touchables
20
- */
21
- export default class GenericTouchable extends Component {
22
- constructor() {
23
- super(...arguments);
24
- // This flag is required since recognition of longPress implies not-invoking onPress
25
- this.longPressDetected = false;
26
- this.pointerInside = true;
27
- // State of touchable
28
- this.STATE = TOUCHABLE_STATE.UNDETERMINED;
29
- this.onGestureEvent = ({ nativeEvent: { pointerInside }, }) => {
30
- if (this.pointerInside !== pointerInside) {
31
- if (pointerInside) {
32
- this.onMoveIn();
33
- }
34
- else {
35
- this.onMoveOut();
36
- }
37
- }
38
- this.pointerInside = pointerInside;
39
- };
40
- this.onHandlerStateChange = ({ nativeEvent, }) => {
41
- const { state } = nativeEvent;
42
- if (state === State.CANCELLED || state === State.FAILED) {
43
- // Need to handle case with external cancellation (e.g. by ScrollView)
44
- this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
45
- }
46
- else if (
47
- // This platform check is an implication of slightly different behavior of handlers on different platform.
48
- // And Android "Active" state is achieving on first move of a finger, not on press in.
49
- // On iOS event on "Began" is not delivered.
50
- state === (Platform.OS !== 'android' ? State.ACTIVE : State.BEGAN) &&
51
- this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
52
- // Moving inside requires
53
- this.handlePressIn();
54
- }
55
- else if (state === State.END) {
56
- const shouldCallOnPress = !this.longPressDetected &&
57
- this.STATE !== TOUCHABLE_STATE.MOVED_OUTSIDE &&
58
- this.pressOutTimeout === null;
59
- this.handleGoToUndetermined();
60
- if (shouldCallOnPress) {
61
- // Calls only inside component whether no long press was called previously
62
- this.props.onPress?.();
63
- }
64
- }
65
- };
66
- this.onLongPressDetected = () => {
67
- this.longPressDetected = true;
68
- // checked for in the caller of `onLongPressDetected`, but better to check twice
69
- this.props.onLongPress?.();
70
- };
71
- }
72
- // handlePressIn in called on first touch on traveling inside component.
73
- // Handles state transition with delay.
74
- handlePressIn() {
75
- if (this.props.delayPressIn) {
76
- this.pressInTimeout = setTimeout(() => {
77
- this.moveToState(TOUCHABLE_STATE.BEGAN);
78
- this.pressInTimeout = null;
79
- }, this.props.delayPressIn);
80
- }
81
- else {
82
- this.moveToState(TOUCHABLE_STATE.BEGAN);
83
- }
84
- if (this.props.onLongPress) {
85
- const time = (this.props.delayPressIn || 0) + (this.props.delayLongPress || 0);
86
- this.longPressTimeout = setTimeout(this.onLongPressDetected, time);
87
- }
88
- }
89
- // handleMoveOutside in called on traveling outside component.
90
- // Handles state transition with delay.
91
- handleMoveOutside() {
92
- if (this.props.delayPressOut) {
93
- this.pressOutTimeout =
94
- this.pressOutTimeout ||
95
- setTimeout(() => {
96
- this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
97
- this.pressOutTimeout = null;
98
- }, this.props.delayPressOut);
99
- }
100
- else {
101
- this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
102
- }
103
- }
104
- // handleGoToUndetermined transits to UNDETERMINED state with proper delay
105
- handleGoToUndetermined() {
106
- clearTimeout(this.pressOutTimeout); // TODO: maybe it can be undefined
107
- if (this.props.delayPressOut) {
108
- this.pressOutTimeout = setTimeout(() => {
109
- if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
110
- this.moveToState(TOUCHABLE_STATE.BEGAN);
111
- }
112
- this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
113
- this.pressOutTimeout = null;
114
- }, this.props.delayPressOut);
115
- }
116
- else {
117
- if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
118
- this.moveToState(TOUCHABLE_STATE.BEGAN);
119
- }
120
- this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
121
- }
122
- }
123
- componentDidMount() {
124
- this.reset();
125
- }
126
- // reset timeout to prevent memory leaks.
127
- reset() {
128
- this.longPressDetected = false;
129
- this.pointerInside = true;
130
- clearTimeout(this.pressInTimeout);
131
- clearTimeout(this.pressOutTimeout);
132
- clearTimeout(this.longPressTimeout);
133
- this.pressOutTimeout = null;
134
- this.longPressTimeout = null;
135
- this.pressInTimeout = null;
136
- }
137
- // All states' transitions are defined here.
138
- moveToState(newState) {
139
- if (newState === this.STATE) {
140
- // Ignore dummy transitions
141
- return;
142
- }
143
- if (newState === TOUCHABLE_STATE.BEGAN) {
144
- // First touch and moving inside
145
- this.props.onPressIn?.();
146
- }
147
- else if (newState === TOUCHABLE_STATE.MOVED_OUTSIDE) {
148
- // Moving outside
149
- this.props.onPressOut?.();
150
- }
151
- else if (newState === TOUCHABLE_STATE.UNDETERMINED) {
152
- // Need to reset each time on transition to UNDETERMINED
153
- this.reset();
154
- if (this.STATE === TOUCHABLE_STATE.BEGAN) {
155
- // ... and if it happens inside button.
156
- this.props.onPressOut?.();
157
- }
158
- }
159
- // Finally call lister (used by subclasses)
160
- this.props.onStateChange?.(this.STATE, newState);
161
- // ... and make transition.
162
- this.STATE = newState;
163
- }
164
- componentWillUnmount() {
165
- // to prevent memory leaks
166
- this.reset();
167
- }
168
- onMoveIn() {
169
- if (this.STATE === TOUCHABLE_STATE.MOVED_OUTSIDE) {
170
- // This call is not throttled with delays (like in RN's implementation).
171
- this.moveToState(TOUCHABLE_STATE.BEGAN);
172
- }
173
- }
174
- onMoveOut() {
175
- // long press should no longer be detected
176
- clearTimeout(this.longPressTimeout);
177
- this.longPressTimeout = null;
178
- if (this.STATE === TOUCHABLE_STATE.BEGAN) {
179
- this.handleMoveOutside();
180
- }
181
- }
182
- render() {
183
- const coreProps = {
184
- accessible: this.props.accessible !== false,
185
- accessibilityLabel: this.props.accessibilityLabel,
186
- accessibilityHint: this.props.accessibilityHint,
187
- accessibilityRole: this.props.accessibilityRole,
188
- // TODO: check if changed to no 's' correctly, also removed 2 props that are no longer available: `accessibilityComponentType` and `accessibilityTraits`,
189
- // would be good to check if it is ok for sure, see: https://github.com/facebook/react-native/issues/24016
190
- accessibilityState: this.props.accessibilityState,
191
- nativeID: this.props.nativeID,
192
- onLayout: this.props.onLayout,
193
- hitSlop: this.props.hitSlop,
194
- };
195
- return (<BaseButton style={this.props.containerStyle} onHandlerStateChange={
196
- // TODO: not sure if it can be undefined instead of null
197
- this.props.disabled ? undefined : this.onHandlerStateChange} onGestureEvent={this.onGestureEvent} hitSlop={this.props.hitSlop} shouldActivateOnStart={this.props.shouldActivateOnStart} disallowInterruption={this.props.disallowInterruption} testID={this.props.testID} {...this.props.extraButtonProps}>
198
- <Animated.View {...coreProps} style={this.props.style}>
199
- {this.props.children}
200
- </Animated.View>
201
- </BaseButton>);
202
- }
203
- }
204
- GenericTouchable.defaultProps = {
205
- delayLongPress: 600,
206
- extraButtonProps: {
207
- rippleColor: 'transparent',
208
- },
209
- };
@@ -1,72 +0,0 @@
1
- import React, { Component } from 'react';
2
- import GenericTouchable, { TOUCHABLE_STATE, } from './GenericTouchable';
3
- import { StyleSheet, View, } from 'react-native';
4
- /**
5
- * TouchableHighlight follows RN's implementation
6
- */
7
- export default class TouchableHighlight extends Component {
8
- constructor(props) {
9
- super(props);
10
- // Copied from RN
11
- this.showUnderlay = () => {
12
- if (!this.hasPressHandler()) {
13
- return;
14
- }
15
- this.setState({
16
- extraChildStyle: {
17
- opacity: this.props.activeOpacity,
18
- },
19
- extraUnderlayStyle: {
20
- backgroundColor: this.props.underlayColor,
21
- },
22
- });
23
- this.props.onShowUnderlay?.();
24
- };
25
- this.hasPressHandler = () => this.props.onPress ||
26
- this.props.onPressIn ||
27
- this.props.onPressOut ||
28
- this.props.onLongPress;
29
- this.hideUnderlay = () => {
30
- this.setState({
31
- extraChildStyle: null,
32
- extraUnderlayStyle: null,
33
- });
34
- this.props.onHideUnderlay?.();
35
- };
36
- this.onStateChange = (_from, to) => {
37
- if (to === TOUCHABLE_STATE.BEGAN) {
38
- this.showUnderlay();
39
- }
40
- else if (to === TOUCHABLE_STATE.UNDETERMINED ||
41
- to === TOUCHABLE_STATE.MOVED_OUTSIDE) {
42
- this.hideUnderlay();
43
- }
44
- };
45
- this.state = {
46
- extraChildStyle: null,
47
- extraUnderlayStyle: null,
48
- };
49
- }
50
- renderChildren() {
51
- if (!this.props.children) {
52
- return <View />;
53
- }
54
- const child = React.Children.only(this.props.children); // TODO: not sure if OK but fixes error
55
- return React.cloneElement(child, {
56
- style: StyleSheet.compose(child.props.style, this.state.extraChildStyle),
57
- });
58
- }
59
- render() {
60
- const { style = {}, ...rest } = this.props;
61
- const { extraUnderlayStyle } = this.state;
62
- return (<GenericTouchable {...rest} style={[style, extraUnderlayStyle]} onStateChange={this.onStateChange}>
63
- {this.renderChildren()}
64
- </GenericTouchable>);
65
- }
66
- }
67
- TouchableHighlight.defaultProps = {
68
- ...GenericTouchable.defaultProps,
69
- activeOpacity: 0.85,
70
- delayPressOut: 100,
71
- underlayColor: 'black',
72
- };