react-native-gesture-handler 1.10.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (580) hide show
  1. package/DrawerLayout/package.json +3 -3
  2. package/README.md +7 -6
  3. package/Swipeable/package.json +3 -3
  4. package/android/build.gradle +48 -1
  5. package/android/common/src/main/java/com/swmansion/common/GestureHandlerStateManager.kt +5 -0
  6. package/android/gradle.properties +19 -0
  7. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.kt +18 -0
  8. package/android/lib/src/main/java/com/swmansion/gesturehandler/Extensions.kt +11 -0
  9. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.kt +96 -0
  10. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.kt +713 -0
  11. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.kt +8 -0
  12. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +562 -0
  13. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.kt +8 -0
  14. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.kt +21 -0
  15. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.kt +49 -0
  16. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.kt +97 -0
  17. package/android/lib/src/main/java/com/swmansion/gesturehandler/ManualGestureHandler.kt +11 -0
  18. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.kt +129 -0
  19. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.kt +9 -0
  20. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +289 -0
  21. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.kt +88 -0
  22. package/android/lib/src/main/java/com/swmansion/gesturehandler/{PointerEventsConfig.java → PointerEventsConfig.kt} +3 -5
  23. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.kt +125 -0
  24. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.kt +79 -0
  25. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.kt +167 -0
  26. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.kt +10 -0
  27. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +348 -0
  28. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt +57 -0
  29. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +59 -0
  30. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.kt +8 -0
  31. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +61 -0
  32. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +686 -0
  33. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.kt +17 -0
  34. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.kt +95 -0
  35. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt +132 -0
  36. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.kt +5 -0
  37. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +68 -0
  38. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt +34 -0
  39. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +66 -0
  40. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt +69 -0
  41. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.kt +51 -0
  42. package/ios/Handlers/RNFlingHandler.m +78 -5
  43. package/ios/Handlers/RNForceTouchHandler.m +29 -4
  44. package/ios/Handlers/RNLongPressHandler.m +105 -3
  45. package/ios/Handlers/RNManualHandler.h +4 -0
  46. package/ios/Handlers/RNManualHandler.m +73 -0
  47. package/ios/Handlers/RNNativeViewHandler.m +30 -2
  48. package/ios/Handlers/RNPanHandler.m +64 -4
  49. package/ios/Handlers/RNPinchHandler.m +61 -2
  50. package/ios/Handlers/RNRotationHandler.m +60 -1
  51. package/ios/Handlers/RNTapHandler.m +55 -8
  52. package/ios/RNGestureHandler.h +18 -4
  53. package/ios/RNGestureHandler.m +123 -13
  54. package/ios/RNGestureHandler.xcodeproj/project.xcworkspace/xcuserdata/jakubpiasecki.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  55. package/ios/RNGestureHandler.xcodeproj/xcuserdata/jakubpiasecki.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  56. package/ios/RNGestureHandlerEvents.h +9 -0
  57. package/ios/RNGestureHandlerEvents.m +34 -0
  58. package/ios/RNGestureHandlerManager.h +7 -0
  59. package/ios/RNGestureHandlerManager.m +62 -34
  60. package/ios/RNGestureHandlerModule.m +39 -3
  61. package/ios/RNGestureHandlerPointerTracker.h +25 -0
  62. package/ios/RNGestureHandlerPointerTracker.m +237 -0
  63. package/ios/RNGestureHandlerRegistry.h +1 -0
  64. package/ios/RNGestureHandlerRegistry.m +10 -0
  65. package/ios/RNGestureHandlerStateManager.h +5 -0
  66. package/ios/RNManualActivationRecognizer.h +10 -0
  67. package/ios/RNManualActivationRecognizer.m +80 -0
  68. package/ios/RNRootViewGestureRecognizer.m +1 -1
  69. package/ios/RNTouchEventType.h +9 -0
  70. package/jestSetup.js +7 -1
  71. package/lib/commonjs/Directions.js +15 -0
  72. package/lib/commonjs/Directions.js.map +1 -0
  73. package/lib/commonjs/EventType.js +16 -0
  74. package/lib/commonjs/EventType.js.map +1 -0
  75. package/lib/commonjs/GestureHandlerRootView.android.js +24 -0
  76. package/lib/commonjs/GestureHandlerRootView.android.js.map +1 -0
  77. package/lib/commonjs/GestureHandlerRootView.js +20 -0
  78. package/lib/commonjs/GestureHandlerRootView.js.map +1 -0
  79. package/lib/commonjs/PlatformConstants.js +15 -0
  80. package/lib/commonjs/PlatformConstants.js.map +1 -0
  81. package/lib/commonjs/PlatformConstants.web.js +14 -0
  82. package/lib/commonjs/PlatformConstants.web.js.map +1 -0
  83. package/lib/commonjs/RNGestureHandlerModule.js +22 -0
  84. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -0
  85. package/lib/commonjs/RNGestureHandlerModule.web.js +80 -0
  86. package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -0
  87. package/lib/commonjs/State.js +18 -0
  88. package/lib/commonjs/State.js.map +1 -0
  89. package/lib/commonjs/components/DrawerLayout.js +535 -0
  90. package/lib/commonjs/components/DrawerLayout.js.map +1 -0
  91. package/lib/commonjs/components/GestureButtons.js +207 -0
  92. package/lib/commonjs/components/GestureButtons.js.map +1 -0
  93. package/lib/commonjs/components/GestureComponents.js +76 -0
  94. package/lib/commonjs/components/GestureComponents.js.map +1 -0
  95. package/lib/commonjs/components/GestureComponents.web.js +46 -0
  96. package/lib/commonjs/components/GestureComponents.web.js.map +1 -0
  97. package/lib/commonjs/components/GestureHandlerButton.js +13 -0
  98. package/lib/commonjs/components/GestureHandlerButton.js.map +1 -0
  99. package/lib/commonjs/components/GestureHandlerButton.web.js +24 -0
  100. package/lib/commonjs/components/GestureHandlerButton.web.js.map +1 -0
  101. package/lib/commonjs/components/Swipeable.js +365 -0
  102. package/lib/commonjs/components/Swipeable.js.map +1 -0
  103. package/lib/commonjs/components/touchables/GenericTouchable.js +278 -0
  104. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -0
  105. package/lib/commonjs/components/touchables/TouchableHighlight.js +109 -0
  106. package/lib/commonjs/components/touchables/TouchableHighlight.js.map +1 -0
  107. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +100 -0
  108. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
  109. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js +12 -0
  110. package/lib/commonjs/components/touchables/TouchableNativeFeedback.js.map +1 -0
  111. package/lib/commonjs/components/touchables/TouchableOpacity.js +75 -0
  112. package/lib/commonjs/components/touchables/TouchableOpacity.js.map +1 -0
  113. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +26 -0
  114. package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -0
  115. package/lib/commonjs/components/touchables/index.js +40 -0
  116. package/lib/commonjs/components/touchables/index.js.map +1 -0
  117. package/lib/commonjs/gestureHandlerRootHOC.js +39 -0
  118. package/lib/commonjs/gestureHandlerRootHOC.js.map +1 -0
  119. package/lib/commonjs/handlers/FlingGestureHandler.js +23 -0
  120. package/lib/commonjs/handlers/FlingGestureHandler.js.map +1 -0
  121. package/lib/commonjs/handlers/ForceTouchGestureHandler.js +44 -0
  122. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -0
  123. package/lib/commonjs/handlers/LongPressGestureHandler.js +23 -0
  124. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -0
  125. package/lib/commonjs/handlers/NativeViewGestureHandler.js +25 -0
  126. package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +1 -0
  127. package/lib/commonjs/handlers/PanGestureHandler.js +121 -0
  128. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -0
  129. package/lib/commonjs/handlers/PinchGestureHandler.js +21 -0
  130. package/lib/commonjs/handlers/PinchGestureHandler.js.map +1 -0
  131. package/lib/commonjs/handlers/RotationGestureHandler.js +21 -0
  132. package/lib/commonjs/handlers/RotationGestureHandler.js.map +1 -0
  133. package/lib/commonjs/handlers/TapGestureHandler.js +23 -0
  134. package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -0
  135. package/lib/commonjs/handlers/createHandler.js +373 -0
  136. package/lib/commonjs/handlers/createHandler.js.map +1 -0
  137. package/lib/commonjs/handlers/createNativeWrapper.js +70 -0
  138. package/lib/commonjs/handlers/createNativeWrapper.js.map +1 -0
  139. package/lib/commonjs/handlers/gestureHandlerCommon.js +80 -0
  140. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -0
  141. package/lib/commonjs/handlers/gestureHandlerTypesCompat.js +2 -0
  142. package/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map +1 -0
  143. package/lib/commonjs/handlers/gestures/GestureDetector.js +426 -0
  144. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -0
  145. package/lib/commonjs/handlers/gestures/eventReceiver.js +124 -0
  146. package/lib/commonjs/handlers/gestures/eventReceiver.js.map +1 -0
  147. package/lib/commonjs/handlers/gestures/flingGesture.js +34 -0
  148. package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -0
  149. package/lib/commonjs/handlers/gestures/forceTouchGesture.js +39 -0
  150. package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -0
  151. package/lib/commonjs/handlers/gestures/gesture.js +185 -0
  152. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -0
  153. package/lib/commonjs/handlers/gestures/gestureComposition.js +94 -0
  154. package/lib/commonjs/handlers/gestures/gestureComposition.js.map +1 -0
  155. package/lib/commonjs/handlers/gestures/gestureObjects.js +85 -0
  156. package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -0
  157. package/lib/commonjs/handlers/gestures/gestureStateManager.js +58 -0
  158. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -0
  159. package/lib/commonjs/handlers/gestures/longPressGesture.js +34 -0
  160. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -0
  161. package/lib/commonjs/handlers/gestures/manualGesture.js +19 -0
  162. package/lib/commonjs/handlers/gestures/manualGesture.js.map +1 -0
  163. package/lib/commonjs/handlers/gestures/nativeGesture.js +34 -0
  164. package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -0
  165. package/lib/commonjs/handlers/gestures/panGesture.js +116 -0
  166. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -0
  167. package/lib/commonjs/handlers/gestures/pinchGesture.js +19 -0
  168. package/lib/commonjs/handlers/gestures/pinchGesture.js.map +1 -0
  169. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +24 -0
  170. package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -0
  171. package/lib/commonjs/handlers/gestures/rotationGesture.js +19 -0
  172. package/lib/commonjs/handlers/gestures/rotationGesture.js.map +1 -0
  173. package/lib/commonjs/handlers/gestures/tapGesture.js +59 -0
  174. package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -0
  175. package/lib/commonjs/handlers/handlersRegistry.js +31 -0
  176. package/lib/commonjs/handlers/handlersRegistry.js.map +1 -0
  177. package/lib/commonjs/index.js +338 -0
  178. package/lib/commonjs/index.js.map +1 -0
  179. package/lib/commonjs/init.js +13 -0
  180. package/lib/commonjs/init.js.map +1 -0
  181. package/lib/commonjs/mocks.js +64 -0
  182. package/lib/commonjs/mocks.js.map +1 -0
  183. package/lib/commonjs/typeUtils.js +2 -0
  184. package/lib/commonjs/typeUtils.js.map +1 -0
  185. package/lib/commonjs/utils.js +15 -0
  186. package/lib/commonjs/utils.js.map +1 -0
  187. package/lib/commonjs/web/DiscreteGestureHandler.js +105 -0
  188. package/lib/commonjs/web/DiscreteGestureHandler.js.map +1 -0
  189. package/lib/commonjs/web/DraggingGestureHandler.js +53 -0
  190. package/lib/commonjs/web/DraggingGestureHandler.js.map +1 -0
  191. package/lib/commonjs/web/Errors.js +16 -0
  192. package/lib/commonjs/web/Errors.js.map +1 -0
  193. package/lib/commonjs/web/FlingGestureHandler.js +170 -0
  194. package/lib/commonjs/web/FlingGestureHandler.js.map +1 -0
  195. package/lib/commonjs/web/GestureHandler.js +533 -0
  196. package/lib/commonjs/web/GestureHandler.js.map +1 -0
  197. package/lib/commonjs/web/IndiscreteGestureHandler.js +54 -0
  198. package/lib/commonjs/web/IndiscreteGestureHandler.js.map +1 -0
  199. package/lib/commonjs/web/LongPressGestureHandler.js +71 -0
  200. package/lib/commonjs/web/LongPressGestureHandler.js.map +1 -0
  201. package/lib/commonjs/web/NativeViewGestureHandler.js +62 -0
  202. package/lib/commonjs/web/NativeViewGestureHandler.js.map +1 -0
  203. package/lib/commonjs/web/NodeManager.js +43 -0
  204. package/lib/commonjs/web/NodeManager.js.map +1 -0
  205. package/lib/commonjs/web/PanGestureHandler.js +189 -0
  206. package/lib/commonjs/web/PanGestureHandler.js.map +1 -0
  207. package/lib/commonjs/web/PinchGestureHandler.js +40 -0
  208. package/lib/commonjs/web/PinchGestureHandler.js.map +1 -0
  209. package/lib/commonjs/web/PressGestureHandler.js +188 -0
  210. package/lib/commonjs/web/PressGestureHandler.js.map +1 -0
  211. package/lib/commonjs/web/RotationGestureHandler.js +44 -0
  212. package/lib/commonjs/web/RotationGestureHandler.js.map +1 -0
  213. package/lib/commonjs/web/TapGestureHandler.js +192 -0
  214. package/lib/commonjs/web/TapGestureHandler.js.map +1 -0
  215. package/lib/commonjs/web/constants.js +64 -0
  216. package/lib/commonjs/web/constants.js.map +1 -0
  217. package/lib/commonjs/web/utils.js +42 -0
  218. package/lib/commonjs/web/utils.js.map +1 -0
  219. package/lib/module/Directions.js +7 -0
  220. package/lib/module/Directions.js.map +1 -0
  221. package/lib/module/EventType.js +8 -0
  222. package/lib/module/EventType.js.map +1 -0
  223. package/lib/module/GestureHandlerRootView.android.js +10 -0
  224. package/lib/module/GestureHandlerRootView.android.js.map +1 -0
  225. package/lib/module/GestureHandlerRootView.js +7 -0
  226. package/lib/module/GestureHandlerRootView.js.map +1 -0
  227. package/lib/module/PlatformConstants.js +5 -0
  228. package/lib/module/PlatformConstants.js.map +1 -0
  229. package/lib/module/PlatformConstants.web.js +7 -0
  230. package/lib/module/PlatformConstants.web.js.map +1 -0
  231. package/lib/module/RNGestureHandlerModule.js +13 -0
  232. package/lib/module/RNGestureHandlerModule.js.map +1 -0
  233. package/lib/module/RNGestureHandlerModule.web.js +56 -0
  234. package/lib/module/RNGestureHandlerModule.web.js.map +1 -0
  235. package/lib/module/State.js +10 -0
  236. package/lib/module/State.js.map +1 -0
  237. package/lib/module/components/DrawerLayout.js +520 -0
  238. package/lib/module/components/DrawerLayout.js.map +1 -0
  239. package/lib/module/components/GestureButtons.js +172 -0
  240. package/lib/module/components/GestureButtons.js.map +1 -0
  241. package/lib/module/components/GestureComponents.js +53 -0
  242. package/lib/module/components/GestureComponents.js.map +1 -0
  243. package/lib/module/components/GestureComponents.web.js +25 -0
  244. package/lib/module/components/GestureComponents.web.js.map +1 -0
  245. package/{dist/src → lib/module}/components/GestureHandlerButton.js +1 -0
  246. package/lib/module/components/GestureHandlerButton.js.map +1 -0
  247. package/lib/module/components/GestureHandlerButton.web.js +9 -0
  248. package/lib/module/components/GestureHandlerButton.web.js.map +1 -0
  249. package/lib/module/components/Swipeable.js +347 -0
  250. package/lib/module/components/Swipeable.js.map +1 -0
  251. package/lib/module/components/touchables/GenericTouchable.js +262 -0
  252. package/lib/module/components/touchables/GenericTouchable.js.map +1 -0
  253. package/lib/module/components/touchables/TouchableHighlight.js +95 -0
  254. package/lib/module/components/touchables/TouchableHighlight.js.map +1 -0
  255. package/lib/module/components/touchables/TouchableNativeFeedback.android.js +84 -0
  256. package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -0
  257. package/{dist/src → lib/module}/components/touchables/TouchableNativeFeedback.js +1 -0
  258. package/lib/module/components/touchables/TouchableNativeFeedback.js.map +1 -0
  259. package/lib/module/components/touchables/TouchableOpacity.js +61 -0
  260. package/lib/module/components/touchables/TouchableOpacity.js.map +1 -0
  261. package/lib/module/components/touchables/TouchableWithoutFeedback.js +10 -0
  262. package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -0
  263. package/{dist/src → lib/module}/components/touchables/index.js +1 -0
  264. package/lib/module/components/touchables/index.js.map +1 -0
  265. package/lib/module/gestureHandlerRootHOC.js +21 -0
  266. package/lib/module/gestureHandlerRootHOC.js.map +1 -0
  267. package/lib/module/handlers/FlingGestureHandler.js +10 -0
  268. package/lib/module/handlers/FlingGestureHandler.js.map +1 -0
  269. package/lib/module/handlers/ForceTouchGestureHandler.js +29 -0
  270. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -0
  271. package/lib/module/handlers/LongPressGestureHandler.js +10 -0
  272. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -0
  273. package/lib/module/handlers/NativeViewGestureHandler.js +11 -0
  274. package/lib/module/handlers/NativeViewGestureHandler.js.map +1 -0
  275. package/lib/module/handlers/PanGestureHandler.js +106 -0
  276. package/lib/module/handlers/PanGestureHandler.js.map +1 -0
  277. package/lib/module/handlers/PinchGestureHandler.js +9 -0
  278. package/lib/module/handlers/PinchGestureHandler.js.map +1 -0
  279. package/lib/module/handlers/RotationGestureHandler.js +9 -0
  280. package/lib/module/handlers/RotationGestureHandler.js.map +1 -0
  281. package/lib/module/handlers/TapGestureHandler.js +10 -0
  282. package/lib/module/handlers/TapGestureHandler.js.map +1 -0
  283. package/lib/module/handlers/createHandler.js +348 -0
  284. package/lib/module/handlers/createHandler.js.map +1 -0
  285. package/lib/module/handlers/createNativeWrapper.js +58 -0
  286. package/lib/module/handlers/createNativeWrapper.js.map +1 -0
  287. package/lib/module/handlers/gestureHandlerCommon.js +66 -0
  288. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -0
  289. package/lib/module/handlers/gestureHandlerTypesCompat.js +2 -0
  290. package/lib/module/handlers/gestureHandlerTypesCompat.js.map +1 -0
  291. package/lib/module/handlers/gestures/GestureDetector.js +389 -0
  292. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -0
  293. package/lib/module/handlers/gestures/eventReceiver.js +109 -0
  294. package/lib/module/handlers/gestures/eventReceiver.js.map +1 -0
  295. package/lib/module/handlers/gestures/flingGesture.js +24 -0
  296. package/lib/module/handlers/gestures/flingGesture.js.map +1 -0
  297. package/lib/module/handlers/gestures/forceTouchGesture.js +29 -0
  298. package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -0
  299. package/lib/module/handlers/gestures/gesture.js +167 -0
  300. package/lib/module/handlers/gestures/gesture.js.map +1 -0
  301. package/lib/module/handlers/gestures/gestureComposition.js +79 -0
  302. package/lib/module/handlers/gestures/gestureComposition.js.map +1 -0
  303. package/lib/module/handlers/gestures/gestureObjects.js +67 -0
  304. package/lib/module/handlers/gestures/gestureObjects.js.map +1 -0
  305. package/lib/module/handlers/gestures/gestureStateManager.js +48 -0
  306. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -0
  307. package/lib/module/handlers/gestures/longPressGesture.js +24 -0
  308. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -0
  309. package/lib/module/handlers/gestures/manualGesture.js +9 -0
  310. package/lib/module/handlers/gestures/manualGesture.js.map +1 -0
  311. package/lib/module/handlers/gestures/nativeGesture.js +24 -0
  312. package/lib/module/handlers/gestures/nativeGesture.js.map +1 -0
  313. package/lib/module/handlers/gestures/panGesture.js +106 -0
  314. package/lib/module/handlers/gestures/panGesture.js.map +1 -0
  315. package/lib/module/handlers/gestures/pinchGesture.js +9 -0
  316. package/lib/module/handlers/gestures/pinchGesture.js.map +1 -0
  317. package/lib/module/handlers/gestures/reanimatedWrapper.js +19 -0
  318. package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -0
  319. package/lib/module/handlers/gestures/rotationGesture.js +9 -0
  320. package/lib/module/handlers/gestures/rotationGesture.js.map +1 -0
  321. package/lib/module/handlers/gestures/tapGesture.js +49 -0
  322. package/lib/module/handlers/gestures/tapGesture.js.map +1 -0
  323. package/lib/module/handlers/handlersRegistry.js +16 -0
  324. package/lib/module/handlers/handlersRegistry.js.map +1 -0
  325. package/lib/module/index.js +34 -0
  326. package/lib/module/index.js.map +1 -0
  327. package/lib/module/init.js +5 -0
  328. package/lib/module/init.js.map +1 -0
  329. package/lib/module/mocks.js +54 -0
  330. package/lib/module/mocks.js.map +1 -0
  331. package/lib/module/typeUtils.js +2 -0
  332. package/lib/module/typeUtils.js.map +1 -0
  333. package/lib/module/utils.js +8 -0
  334. package/lib/module/utils.js.map +1 -0
  335. package/lib/module/web/DiscreteGestureHandler.js +94 -0
  336. package/lib/module/web/DiscreteGestureHandler.js.map +1 -0
  337. package/lib/module/web/DraggingGestureHandler.js +40 -0
  338. package/lib/module/web/DraggingGestureHandler.js.map +1 -0
  339. package/lib/module/web/Errors.js +7 -0
  340. package/lib/module/web/Errors.js.map +1 -0
  341. package/lib/module/web/FlingGestureHandler.js +156 -0
  342. package/lib/module/web/FlingGestureHandler.js.map +1 -0
  343. package/lib/module/web/GestureHandler.js +518 -0
  344. package/lib/module/web/GestureHandler.js.map +1 -0
  345. package/lib/module/web/IndiscreteGestureHandler.js +44 -0
  346. package/lib/module/web/IndiscreteGestureHandler.js.map +1 -0
  347. package/lib/module/web/LongPressGestureHandler.js +58 -0
  348. package/lib/module/web/LongPressGestureHandler.js.map +1 -0
  349. package/lib/module/web/NativeViewGestureHandler.js +45 -0
  350. package/lib/module/web/NativeViewGestureHandler.js.map +1 -0
  351. package/lib/module/web/NodeManager.js +30 -0
  352. package/lib/module/web/NodeManager.js.map +1 -0
  353. package/lib/module/web/PanGestureHandler.js +175 -0
  354. package/lib/module/web/PanGestureHandler.js.map +1 -0
  355. package/lib/module/web/PinchGestureHandler.js +29 -0
  356. package/lib/module/web/PinchGestureHandler.js.map +1 -0
  357. package/lib/module/web/PressGestureHandler.js +174 -0
  358. package/lib/module/web/PressGestureHandler.js.map +1 -0
  359. package/lib/module/web/RotationGestureHandler.js +32 -0
  360. package/lib/module/web/RotationGestureHandler.js.map +1 -0
  361. package/lib/module/web/TapGestureHandler.js +180 -0
  362. package/lib/module/web/TapGestureHandler.js.map +1 -0
  363. package/lib/module/web/constants.js +43 -0
  364. package/lib/module/web/constants.js.map +1 -0
  365. package/lib/module/web/utils.js +19 -0
  366. package/lib/module/web/utils.js.map +1 -0
  367. package/lib/typescript/Directions.d.ts +7 -0
  368. package/lib/typescript/EventType.d.ts +8 -0
  369. package/lib/typescript/GestureHandlerRootView.android.d.ts +2 -0
  370. package/lib/typescript/GestureHandlerRootView.d.ts +5 -0
  371. package/{dist/src → lib/typescript}/PlatformConstants.d.ts +0 -0
  372. package/{dist/src → lib/typescript}/PlatformConstants.web.d.ts +0 -0
  373. package/{dist/src → lib/typescript}/RNGestureHandlerModule.d.ts +1 -8
  374. package/{dist/src → lib/typescript}/RNGestureHandlerModule.web.d.ts +1 -1
  375. package/{dist/src → lib/typescript}/State.d.ts +0 -0
  376. package/{dist/src → lib/typescript}/components/DrawerLayout.d.ts +50 -1
  377. package/{dist/src → lib/typescript}/components/GestureButtons.d.ts +36 -0
  378. package/lib/typescript/components/GestureComponents.d.ts +18 -0
  379. package/{dist/src → lib/typescript}/components/GestureComponents.web.d.ts +4 -4
  380. package/{dist/src → lib/typescript}/components/GestureHandlerButton.d.ts +0 -0
  381. package/{dist/src → lib/typescript}/components/GestureHandlerButton.web.d.ts +0 -0
  382. package/lib/typescript/components/Swipeable.d.ts +150 -0
  383. package/{dist/src → lib/typescript}/components/touchables/GenericTouchable.d.ts +3 -3
  384. package/{dist/src → lib/typescript}/components/touchables/TouchableHighlight.d.ts +1 -0
  385. package/{dist/src → lib/typescript}/components/touchables/TouchableNativeFeedback.android.d.ts +0 -0
  386. package/{dist/src → lib/typescript}/components/touchables/TouchableNativeFeedback.d.ts +0 -0
  387. package/{dist/src → lib/typescript}/components/touchables/TouchableOpacity.d.ts +1 -0
  388. package/{dist/src → lib/typescript}/components/touchables/TouchableWithoutFeedback.d.ts +0 -0
  389. package/{dist/src → lib/typescript}/components/touchables/index.d.ts +0 -0
  390. package/{dist/src → lib/typescript}/gestureHandlerRootHOC.d.ts +0 -0
  391. package/lib/typescript/handlers/FlingGestureHandler.d.ts +33 -0
  392. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +43 -0
  393. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +55 -0
  394. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +27 -0
  395. package/lib/typescript/handlers/PanGestureHandler.d.ts +137 -0
  396. package/lib/typescript/handlers/PinchGestureHandler.d.ts +28 -0
  397. package/lib/typescript/handlers/RotationGestureHandler.d.ts +28 -0
  398. package/lib/typescript/handlers/TapGestureHandler.d.ts +56 -0
  399. package/{dist/src → lib/typescript}/handlers/createHandler.d.ts +1 -1
  400. package/{dist/src → lib/typescript}/handlers/createNativeWrapper.d.ts +0 -0
  401. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +62 -0
  402. package/{dist/src → lib/typescript}/handlers/gestureHandlerTypesCompat.d.ts +8 -1
  403. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +16 -0
  404. package/lib/typescript/handlers/gestures/eventReceiver.d.ts +2 -0
  405. package/lib/typescript/handlers/gestures/flingGesture.d.ts +9 -0
  406. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +10 -0
  407. package/lib/typescript/handlers/gestures/gesture.d.ts +93 -0
  408. package/lib/typescript/handlers/gestures/gestureComposition.d.ts +21 -0
  409. package/lib/typescript/handlers/gestures/gestureObjects.d.ts +39 -0
  410. package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +9 -0
  411. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +9 -0
  412. package/lib/typescript/handlers/gestures/manualGesture.d.ts +5 -0
  413. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +9 -0
  414. package/lib/typescript/handlers/gestures/panGesture.d.ts +19 -0
  415. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +6 -0
  416. package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +14 -0
  417. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +6 -0
  418. package/lib/typescript/handlers/gestures/tapGesture.d.ts +14 -0
  419. package/lib/typescript/handlers/handlersRegistry.d.ts +6 -0
  420. package/lib/typescript/index.d.ts +44 -0
  421. package/lib/typescript/init.d.ts +1 -0
  422. package/lib/typescript/mocks.d.ts +43 -0
  423. package/{dist/src → lib/typescript}/typeUtils.d.ts +0 -0
  424. package/lib/typescript/utils.d.ts +1 -0
  425. package/{dist/src → lib/typescript}/web/DiscreteGestureHandler.d.ts +0 -0
  426. package/{dist/src → lib/typescript}/web/DraggingGestureHandler.d.ts +0 -0
  427. package/{dist/src → lib/typescript}/web/Errors.d.ts +0 -0
  428. package/{dist/src → lib/typescript}/web/FlingGestureHandler.d.ts +0 -1
  429. package/{dist/src → lib/typescript}/web/GestureHandler.d.ts +0 -1
  430. package/{dist/src → lib/typescript}/web/IndiscreteGestureHandler.d.ts +0 -0
  431. package/{dist/src → lib/typescript}/web/LongPressGestureHandler.d.ts +0 -0
  432. package/{dist/src → lib/typescript}/web/NativeViewGestureHandler.d.ts +0 -0
  433. package/{dist/src → lib/typescript}/web/NodeManager.d.ts +0 -0
  434. package/{dist/src → lib/typescript}/web/PanGestureHandler.d.ts +0 -1
  435. package/{dist/src → lib/typescript}/web/PinchGestureHandler.d.ts +0 -1
  436. package/{dist/src → lib/typescript}/web/PressGestureHandler.d.ts +0 -1
  437. package/{dist/src → lib/typescript}/web/RotationGestureHandler.d.ts +0 -1
  438. package/{dist/src → lib/typescript}/web/TapGestureHandler.d.ts +0 -1
  439. package/{dist/src → lib/typescript}/web/constants.d.ts +0 -0
  440. package/{dist/src → lib/typescript}/web/utils.d.ts +0 -0
  441. package/package.json +38 -15
  442. package/src/Directions.ts +8 -2
  443. package/src/EventType.ts +10 -0
  444. package/src/GestureHandlerRootView.android.tsx +9 -25
  445. package/src/GestureHandlerRootView.tsx +11 -2
  446. package/src/PlatformConstants.ts +3 -2
  447. package/src/RNGestureHandlerModule.ts +15 -9
  448. package/src/RNGestureHandlerModule.web.ts +1 -0
  449. package/src/components/DrawerLayout.tsx +114 -41
  450. package/src/components/GestureButtons.tsx +45 -5
  451. package/src/components/GestureComponents.tsx +47 -41
  452. package/src/components/Swipeable.tsx +108 -21
  453. package/src/components/touchables/GenericTouchable.tsx +3 -2
  454. package/src/components/touchables/TouchableOpacity.tsx +1 -1
  455. package/src/handlers/FlingGestureHandler.ts +57 -0
  456. package/src/handlers/ForceTouchGestureHandler.ts +83 -0
  457. package/src/handlers/LongPressGestureHandler.ts +84 -0
  458. package/src/handlers/NativeViewGestureHandler.ts +31 -7
  459. package/src/handlers/PanGestureHandler.ts +321 -0
  460. package/src/handlers/PinchGestureHandler.ts +46 -0
  461. package/src/handlers/RotationGestureHandler.ts +46 -0
  462. package/src/handlers/TapGestureHandler.ts +90 -0
  463. package/src/handlers/createHandler.ts +60 -81
  464. package/src/handlers/gestureHandlerCommon.ts +185 -0
  465. package/src/handlers/gestureHandlerTypesCompat.ts +19 -5
  466. package/src/handlers/gestures/GestureDetector.tsx +498 -0
  467. package/src/handlers/gestures/eventReceiver.ts +135 -0
  468. package/src/handlers/gestures/flingGesture.ts +27 -0
  469. package/src/handlers/gestures/forceTouchGesture.ts +32 -0
  470. package/src/handlers/gestures/gesture.ts +279 -0
  471. package/src/handlers/gestures/gestureComposition.ts +109 -0
  472. package/src/handlers/gestures/gestureObjects.ts +79 -0
  473. package/src/handlers/gestures/gestureStateManager.ts +60 -0
  474. package/src/handlers/gestures/longPressGesture.ts +27 -0
  475. package/src/handlers/gestures/manualGesture.ts +11 -0
  476. package/src/handlers/gestures/nativeGesture.ts +27 -0
  477. package/src/handlers/gestures/panGesture.ts +105 -0
  478. package/src/handlers/gestures/pinchGesture.ts +12 -0
  479. package/src/handlers/gestures/reanimatedWrapper.ts +45 -0
  480. package/src/handlers/gestures/rotationGesture.ts +12 -0
  481. package/src/handlers/gestures/tapGesture.ts +52 -0
  482. package/src/handlers/handlersRegistry.ts +22 -0
  483. package/src/index.ts +156 -0
  484. package/src/init.ts +5 -0
  485. package/src/mocks.ts +65 -0
  486. package/src/utils.ts +7 -0
  487. package/src/web/GestureHandler.ts +2 -3
  488. package/src/web/NativeViewGestureHandler.ts +1 -3
  489. package/src/web/NodeManager.ts +5 -0
  490. package/android/lib/src/main/java/com/swmansion/gesturehandler/BaseGestureHandlerInteractionController.java +0 -23
  491. package/android/lib/src/main/java/com/swmansion/gesturehandler/FlingGestureHandler.java +0 -110
  492. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.java +0 -531
  493. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerInteractionController.java +0 -8
  494. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.java +0 -543
  495. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistry.java +0 -10
  496. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerRegistryImpl.java +0 -29
  497. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureUtils.java +0 -53
  498. package/android/lib/src/main/java/com/swmansion/gesturehandler/LongPressGestureHandler.java +0 -81
  499. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.java +0 -110
  500. package/android/lib/src/main/java/com/swmansion/gesturehandler/OnTouchEventListener.java +0 -8
  501. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.java +0 -312
  502. package/android/lib/src/main/java/com/swmansion/gesturehandler/PinchGestureHandler.java +0 -109
  503. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureDetector.java +0 -169
  504. package/android/lib/src/main/java/com/swmansion/gesturehandler/RotationGestureHandler.java +0 -96
  505. package/android/lib/src/main/java/com/swmansion/gesturehandler/TapGestureHandler.java +0 -172
  506. package/android/lib/src/main/java/com/swmansion/gesturehandler/ViewConfigurationHelper.java +0 -10
  507. package/android/src/main/java/com/facebook/react/views/modal/RNGHModalUtils.java +0 -21
  508. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java +0 -296
  509. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.java +0 -72
  510. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java +0 -77
  511. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.java +0 -8
  512. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.java +0 -86
  513. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java +0 -731
  514. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.java +0 -31
  515. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRegistry.java +0 -101
  516. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.java +0 -151
  517. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootInterface.java +0 -7
  518. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.java +0 -76
  519. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java +0 -49
  520. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java +0 -82
  521. package/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.java +0 -61
  522. package/dist/index.d.ts +0 -13
  523. package/dist/index.js +0 -16
  524. package/dist/src/Directions.d.ts +0 -7
  525. package/dist/src/Directions.js +0 -2
  526. package/dist/src/GestureHandlerRootView.android.d.ts +0 -4
  527. package/dist/src/GestureHandlerRootView.android.expo.d.ts +0 -2
  528. package/dist/src/GestureHandlerRootView.android.expo.js +0 -2
  529. package/dist/src/GestureHandlerRootView.android.js +0 -21
  530. package/dist/src/GestureHandlerRootView.d.ts +0 -2
  531. package/dist/src/GestureHandlerRootView.js +0 -2
  532. package/dist/src/PlatformConstants.js +0 -2
  533. package/dist/src/PlatformConstants.web.js +0 -5
  534. package/dist/src/RNGestureHandlerModule.js +0 -3
  535. package/dist/src/RNGestureHandlerModule.web.js +0 -47
  536. package/dist/src/State.js +0 -9
  537. package/dist/src/__mocks__/RNGestureHandlerModule.d.ts +0 -23
  538. package/dist/src/__mocks__/RNGestureHandlerModule.js +0 -25
  539. package/dist/src/components/DrawerLayout.js +0 -391
  540. package/dist/src/components/GestureButtons.js +0 -113
  541. package/dist/src/components/GestureComponents.d.ts +0 -45
  542. package/dist/src/components/GestureComponents.js +0 -18
  543. package/dist/src/components/GestureComponents.web.js +0 -18
  544. package/dist/src/components/GestureHandlerButton.web.js +0 -3
  545. package/dist/src/components/Swipeable.d.ts +0 -83
  546. package/dist/src/components/Swipeable.js +0 -249
  547. package/dist/src/components/touchables/GenericTouchable.js +0 -210
  548. package/dist/src/components/touchables/TouchableHighlight.js +0 -73
  549. package/dist/src/components/touchables/TouchableNativeFeedback.android.js +0 -63
  550. package/dist/src/components/touchables/TouchableOpacity.js +0 -50
  551. package/dist/src/components/touchables/TouchableWithoutFeedback.js +0 -5
  552. package/dist/src/gestureHandlerRootHOC.js +0 -17
  553. package/dist/src/handlers/NativeViewGestureHandler.d.ts +0 -12
  554. package/dist/src/handlers/NativeViewGestureHandler.js +0 -13
  555. package/dist/src/handlers/createHandler.js +0 -292
  556. package/dist/src/handlers/createNativeWrapper.js +0 -51
  557. package/dist/src/handlers/gestureHandlerTypesCompat.js +0 -1
  558. package/dist/src/handlers/gestureHandlers.d.ts +0 -158
  559. package/dist/src/handlers/gestureHandlers.js +0 -247
  560. package/dist/src/typeUtils.js +0 -1
  561. package/dist/src/web/DiscreteGestureHandler.js +0 -48
  562. package/dist/src/web/DraggingGestureHandler.js +0 -25
  563. package/dist/src/web/Errors.js +0 -5
  564. package/dist/src/web/FlingGestureHandler.js +0 -119
  565. package/dist/src/web/GestureHandler.js +0 -413
  566. package/dist/src/web/IndiscreteGestureHandler.js +0 -26
  567. package/dist/src/web/LongPressGestureHandler.js +0 -46
  568. package/dist/src/web/NativeViewGestureHandler.js +0 -39
  569. package/dist/src/web/NodeManager.js +0 -22
  570. package/dist/src/web/PanGestureHandler.js +0 -145
  571. package/dist/src/web/PinchGestureHandler.js +0 -19
  572. package/dist/src/web/PressGestureHandler.js +0 -135
  573. package/dist/src/web/RotationGestureHandler.js +0 -20
  574. package/dist/src/web/TapGestureHandler.js +0 -143
  575. package/dist/src/web/constants.js +0 -42
  576. package/dist/src/web/utils.js +0 -15
  577. package/index.ts +0 -117
  578. package/src/GestureHandlerRootView.android.expo.tsx +0 -3
  579. package/src/__mocks__/RNGestureHandlerModule.ts +0 -27
  580. package/src/handlers/gestureHandlers.ts +0 -511
@@ -0,0 +1,520 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ // This component is based on RN's DrawerLayoutAndroid API
4
+ //
5
+ // It perhaps deserves to be put in a separate repo, but since it relies on
6
+ // react-native-gesture-handler library which isn't very popular at the moment I
7
+ // decided to keep it here for the time being. It will allow us to move faster
8
+ // and fix issues that may arise in gesture handler library that could be found
9
+ // when using the drawer component
10
+ import * as React from 'react';
11
+ import { Component } from 'react';
12
+ import invariant from 'invariant';
13
+ import { Animated, StyleSheet, View, Keyboard, StatusBar, I18nManager } from 'react-native';
14
+ import { PanGestureHandler } from '../handlers/PanGestureHandler';
15
+ import { TapGestureHandler } from '../handlers/TapGestureHandler';
16
+ import { State } from '../State';
17
+ const DRAG_TOSS = 0.05;
18
+ const IDLE = 'Idle';
19
+ const DRAGGING = 'Dragging';
20
+ const SETTLING = 'Settling';
21
+ export default class DrawerLayout extends Component {
22
+ constructor(_props) {
23
+ super(_props);
24
+
25
+ _defineProperty(this, "openValue", void 0);
26
+
27
+ _defineProperty(this, "onGestureEvent", void 0);
28
+
29
+ _defineProperty(this, "accessibilityIsModalView", /*#__PURE__*/React.createRef());
30
+
31
+ _defineProperty(this, "pointerEventsView", /*#__PURE__*/React.createRef());
32
+
33
+ _defineProperty(this, "panGestureHandler", /*#__PURE__*/React.createRef());
34
+
35
+ _defineProperty(this, "drawerShown", false);
36
+
37
+ _defineProperty(this, "updateAnimatedEvent", (props, state) => {
38
+ // Event definition is based on
39
+ const {
40
+ drawerPosition,
41
+ drawerWidth,
42
+ drawerType
43
+ } = props;
44
+ const {
45
+ dragX: dragXValue,
46
+ touchX: touchXValue,
47
+ drawerTranslation,
48
+ containerWidth
49
+ } = state;
50
+ let dragX = dragXValue;
51
+ let touchX = touchXValue;
52
+
53
+ if (drawerPosition !== 'left') {
54
+ // Most of the code is written in a way to handle left-side drawer. In
55
+ // order to handle right-side drawer the only thing we need to do is to
56
+ // reverse events coming from gesture handler in a way they emulate
57
+ // left-side drawer gestures. E.g. dragX is simply -dragX, and touchX is
58
+ // calulcated by subtracing real touchX from the width of the container
59
+ // (such that when touch happens at the right edge the value is simply 0)
60
+ dragX = Animated.multiply(new Animated.Value(-1), dragXValue); // TODO(TS): (for all "as" in this file) make sure we can map this
61
+
62
+ touchX = Animated.add(new Animated.Value(containerWidth), Animated.multiply(new Animated.Value(-1), touchXValue)); // TODO(TS): make sure we can map this;
63
+
64
+ touchXValue.setValue(containerWidth);
65
+ } else {
66
+ touchXValue.setValue(0);
67
+ } // While closing the drawer when user starts gesture outside of its area (in greyed
68
+ // out part of the window), we want the drawer to follow only once finger reaches the
69
+ // edge of the drawer.
70
+ // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by
71
+ // dots. The touch gesture starts at '*' and moves left, touch path is indicated by
72
+ // an arrow pointing left
73
+ // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+
74
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
75
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
76
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
77
+ // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|
78
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
79
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
80
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
81
+ // +---------------+ +---------------+ +---------------+ +---------------+
82
+ //
83
+ // For the above to work properly we define animated value that will keep
84
+ // start position of the gesture. Then we use that value to calculate how
85
+ // much we need to subtract from the dragX. If the gesture started on the
86
+ // greyed out area we take the distance from the edge of the drawer to the
87
+ // start position. Otherwise we don't subtract at all and the drawer be
88
+ // pulled back as soon as you start the pan.
89
+ //
90
+ // This is used only when drawerType is "front"
91
+ //
92
+
93
+
94
+ let translationX = dragX;
95
+
96
+ if (drawerType === 'front') {
97
+ const startPositionX = Animated.add(touchX, Animated.multiply(new Animated.Value(-1), dragX));
98
+ const dragOffsetFromOnStartPosition = startPositionX.interpolate({
99
+ inputRange: [drawerWidth - 1, drawerWidth, drawerWidth + 1],
100
+ outputRange: [0, 0, 1]
101
+ });
102
+ translationX = Animated.add(dragX, dragOffsetFromOnStartPosition); // TODO: as above
103
+ }
104
+
105
+ this.openValue = Animated.add(translationX, drawerTranslation).interpolate({
106
+ inputRange: [0, drawerWidth],
107
+ outputRange: [0, 1],
108
+ extrapolate: 'clamp'
109
+ });
110
+ const gestureOptions = {
111
+ useNativeDriver: props.useNativeAnimations
112
+ };
113
+
114
+ if (this.props.onDrawerSlide) {
115
+ gestureOptions.listener = ev => {
116
+ var _this$props$onDrawerS, _this$props;
117
+
118
+ const translationX = Math.floor(Math.abs(ev.nativeEvent.translationX));
119
+ const position = translationX / this.state.containerWidth;
120
+ (_this$props$onDrawerS = (_this$props = this.props).onDrawerSlide) === null || _this$props$onDrawerS === void 0 ? void 0 : _this$props$onDrawerS.call(_this$props, position);
121
+ };
122
+ }
123
+
124
+ this.onGestureEvent = Animated.event([{
125
+ nativeEvent: {
126
+ translationX: dragXValue,
127
+ x: touchXValue
128
+ }
129
+ }], gestureOptions);
130
+ });
131
+
132
+ _defineProperty(this, "handleContainerLayout", ({
133
+ nativeEvent
134
+ }) => {
135
+ this.setState({
136
+ containerWidth: nativeEvent.layout.width
137
+ });
138
+ });
139
+
140
+ _defineProperty(this, "emitStateChanged", (newState, drawerWillShow) => {
141
+ var _this$props$onDrawerS2, _this$props2;
142
+
143
+ (_this$props$onDrawerS2 = (_this$props2 = this.props).onDrawerStateChanged) === null || _this$props$onDrawerS2 === void 0 ? void 0 : _this$props$onDrawerS2.call(_this$props2, newState, drawerWillShow);
144
+ });
145
+
146
+ _defineProperty(this, "openingHandlerStateChange", ({
147
+ nativeEvent
148
+ }) => {
149
+ if (nativeEvent.oldState === State.ACTIVE) {
150
+ this.handleRelease({
151
+ nativeEvent
152
+ });
153
+ } else if (nativeEvent.state === State.ACTIVE) {
154
+ this.emitStateChanged(DRAGGING, false);
155
+
156
+ if (this.props.keyboardDismissMode === 'on-drag') {
157
+ Keyboard.dismiss();
158
+ }
159
+
160
+ if (this.props.hideStatusBar) {
161
+ StatusBar.setHidden(true, this.props.statusBarAnimation || 'slide');
162
+ }
163
+ }
164
+ });
165
+
166
+ _defineProperty(this, "onTapHandlerStateChange", ({
167
+ nativeEvent
168
+ }) => {
169
+ if (this.drawerShown && nativeEvent.oldState === State.ACTIVE && this.props.drawerLockMode !== 'locked-open') {
170
+ this.closeDrawer();
171
+ }
172
+ });
173
+
174
+ _defineProperty(this, "handleRelease", ({
175
+ nativeEvent
176
+ }) => {
177
+ const {
178
+ drawerWidth,
179
+ drawerPosition,
180
+ drawerType
181
+ } = this.props;
182
+ const {
183
+ containerWidth
184
+ } = this.state;
185
+ let {
186
+ translationX: dragX,
187
+ velocityX,
188
+ x: touchX
189
+ } = nativeEvent;
190
+
191
+ if (drawerPosition !== 'left') {
192
+ // See description in _updateAnimatedEvent about why events are flipped
193
+ // for right-side drawer
194
+ dragX = -dragX;
195
+ touchX = containerWidth - touchX;
196
+ velocityX = -velocityX;
197
+ }
198
+
199
+ const gestureStartX = touchX - dragX;
200
+ let dragOffsetBasedOnStart = 0;
201
+
202
+ if (drawerType === 'front') {
203
+ dragOffsetBasedOnStart = gestureStartX > drawerWidth ? gestureStartX - drawerWidth : 0;
204
+ }
205
+
206
+ const startOffsetX = dragX + dragOffsetBasedOnStart + (this.drawerShown ? drawerWidth : 0);
207
+ const projOffsetX = startOffsetX + DRAG_TOSS * velocityX;
208
+ const shouldOpen = projOffsetX > drawerWidth / 2;
209
+
210
+ if (shouldOpen) {
211
+ this.animateDrawer(startOffsetX, drawerWidth, velocityX);
212
+ } else {
213
+ this.animateDrawer(startOffsetX, 0, velocityX);
214
+ }
215
+ });
216
+
217
+ _defineProperty(this, "updateShowing", showing => {
218
+ var _this$accessibilityIs, _this$pointerEventsVi, _this$panGestureHandl;
219
+
220
+ this.drawerShown = showing;
221
+ (_this$accessibilityIs = this.accessibilityIsModalView.current) === null || _this$accessibilityIs === void 0 ? void 0 : _this$accessibilityIs.setNativeProps({
222
+ accessibilityViewIsModal: showing
223
+ });
224
+ (_this$pointerEventsVi = this.pointerEventsView.current) === null || _this$pointerEventsVi === void 0 ? void 0 : _this$pointerEventsVi.setNativeProps({
225
+ pointerEvents: showing ? 'auto' : 'none'
226
+ });
227
+ const {
228
+ drawerPosition,
229
+ minSwipeDistance,
230
+ edgeWidth
231
+ } = this.props;
232
+ const fromLeft = drawerPosition === 'left'; // gestureOrientation is 1 if the expected gesture is from left to right and
233
+ // -1 otherwise e.g. when drawer is on the left and is closed we expect left
234
+ // to right gesture, thus orientation will be 1.
235
+
236
+ const gestureOrientation = (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1); // When drawer is closed we want the hitSlop to be horizontally shorter than
237
+ // the container size by the value of SLOP. This will make it only activate
238
+ // when gesture happens not further than SLOP away from the edge
239
+
240
+ const hitSlop = fromLeft ? {
241
+ left: 0,
242
+ width: showing ? undefined : edgeWidth
243
+ } : {
244
+ right: 0,
245
+ width: showing ? undefined : edgeWidth
246
+ }; // @ts-ignore internal API, maybe could be fixed in handler types
247
+
248
+ (_this$panGestureHandl = this.panGestureHandler.current) === null || _this$panGestureHandl === void 0 ? void 0 : _this$panGestureHandl.setNativeProps({
249
+ hitSlop,
250
+ activeOffsetX: gestureOrientation * minSwipeDistance
251
+ });
252
+ });
253
+
254
+ _defineProperty(this, "animateDrawer", (fromValue, toValue, velocity, speed) => {
255
+ this.state.dragX.setValue(0);
256
+ this.state.touchX.setValue(this.props.drawerPosition === 'left' ? 0 : this.state.containerWidth);
257
+
258
+ if (fromValue != null) {
259
+ let nextFramePosition = fromValue;
260
+
261
+ if (this.props.useNativeAnimations) {
262
+ // When using native driver, we predict the next position of the
263
+ // animation because it takes one frame of a roundtrip to pass RELEASE
264
+ // event from native driver to JS before we can start animating. Without
265
+ // it, it is more noticable that the frame is dropped.
266
+ if (fromValue < toValue && velocity > 0) {
267
+ nextFramePosition = Math.min(fromValue + velocity / 60.0, toValue);
268
+ } else if (fromValue > toValue && velocity < 0) {
269
+ nextFramePosition = Math.max(fromValue + velocity / 60.0, toValue);
270
+ }
271
+ }
272
+
273
+ this.state.drawerTranslation.setValue(nextFramePosition);
274
+ }
275
+
276
+ const willShow = toValue !== 0;
277
+ this.updateShowing(willShow);
278
+ this.emitStateChanged(SETTLING, willShow);
279
+
280
+ if (this.props.hideStatusBar) {
281
+ StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');
282
+ }
283
+
284
+ Animated.spring(this.state.drawerTranslation, {
285
+ velocity,
286
+ bounciness: 0,
287
+ toValue,
288
+ useNativeDriver: this.props.useNativeAnimations,
289
+ speed: speed !== null && speed !== void 0 ? speed : undefined
290
+ }).start(({
291
+ finished
292
+ }) => {
293
+ if (finished) {
294
+ this.emitStateChanged(IDLE, willShow);
295
+
296
+ if (willShow) {
297
+ var _this$props$onDrawerO, _this$props3;
298
+
299
+ (_this$props$onDrawerO = (_this$props3 = this.props).onDrawerOpen) === null || _this$props$onDrawerO === void 0 ? void 0 : _this$props$onDrawerO.call(_this$props3);
300
+ } else {
301
+ var _this$props$onDrawerC, _this$props4;
302
+
303
+ (_this$props$onDrawerC = (_this$props4 = this.props).onDrawerClose) === null || _this$props$onDrawerC === void 0 ? void 0 : _this$props$onDrawerC.call(_this$props4);
304
+ }
305
+ }
306
+ });
307
+ });
308
+
309
+ _defineProperty(this, "openDrawer", (options = {}) => {
310
+ this.animateDrawer( // TODO: decide if it should be null or undefined is the proper value
311
+ undefined, this.props.drawerWidth, options.velocity ? options.velocity : 0); // We need to force the update, otherwise the overlay is not rerendered and
312
+ // it would not be clickable
313
+
314
+ this.forceUpdate();
315
+ });
316
+
317
+ _defineProperty(this, "closeDrawer", (options = {}) => {
318
+ // TODO: decide if it should be null or undefined is the proper value
319
+ this.animateDrawer(undefined, 0, options.velocity ? options.velocity : 0); // We need to force the update, otherwise the overlay is not rerendered and
320
+ // it would be still clickable
321
+
322
+ this.forceUpdate();
323
+ });
324
+
325
+ _defineProperty(this, "renderOverlay", () => {
326
+ /* Overlay styles */
327
+ invariant(this.openValue, 'should be set');
328
+ const overlayOpacity = this.openValue.interpolate({
329
+ inputRange: [0, 1],
330
+ outputRange: [0, 1],
331
+ extrapolate: 'clamp'
332
+ });
333
+ const dynamicOverlayStyles = {
334
+ opacity: overlayOpacity,
335
+ backgroundColor: this.props.overlayColor
336
+ };
337
+ return /*#__PURE__*/React.createElement(TapGestureHandler, {
338
+ onHandlerStateChange: this.onTapHandlerStateChange
339
+ }, /*#__PURE__*/React.createElement(Animated.View, {
340
+ pointerEvents: this.drawerShown ? 'auto' : 'none',
341
+ ref: this.pointerEventsView,
342
+ style: [styles.overlay, dynamicOverlayStyles]
343
+ }));
344
+ });
345
+
346
+ _defineProperty(this, "renderDrawer", () => {
347
+ const {
348
+ drawerBackgroundColor,
349
+ drawerWidth,
350
+ drawerPosition,
351
+ drawerType,
352
+ drawerContainerStyle,
353
+ contentContainerStyle
354
+ } = this.props;
355
+ const fromLeft = drawerPosition === 'left';
356
+ const drawerSlide = drawerType !== 'back';
357
+ const containerSlide = drawerType !== 'front'; // we rely on row and row-reverse flex directions to position the drawer
358
+ // properly. Apparently for RTL these are flipped which requires us to use
359
+ // the opposite setting for the drawer to appear from left or right
360
+ // according to the drawerPosition prop
361
+
362
+ const reverseContentDirection = I18nManager.isRTL ? fromLeft : !fromLeft;
363
+ const dynamicDrawerStyles = {
364
+ backgroundColor: drawerBackgroundColor,
365
+ width: drawerWidth
366
+ };
367
+ const openValue = this.openValue;
368
+ invariant(openValue, 'should be set');
369
+ let containerStyles;
370
+
371
+ if (containerSlide) {
372
+ const containerTranslateX = openValue.interpolate({
373
+ inputRange: [0, 1],
374
+ outputRange: fromLeft ? [0, drawerWidth] : [0, -drawerWidth],
375
+ extrapolate: 'clamp'
376
+ });
377
+ containerStyles = {
378
+ transform: [{
379
+ translateX: containerTranslateX
380
+ }]
381
+ };
382
+ }
383
+
384
+ let drawerTranslateX = 0;
385
+
386
+ if (drawerSlide) {
387
+ const closedDrawerOffset = fromLeft ? -drawerWidth : drawerWidth;
388
+ drawerTranslateX = openValue.interpolate({
389
+ inputRange: [0, 1],
390
+ outputRange: [closedDrawerOffset, 0],
391
+ extrapolate: 'clamp'
392
+ });
393
+ }
394
+
395
+ const drawerStyles = {
396
+ transform: [{
397
+ translateX: drawerTranslateX
398
+ }],
399
+ flexDirection: reverseContentDirection ? 'row-reverse' : 'row'
400
+ };
401
+ return /*#__PURE__*/React.createElement(Animated.View, {
402
+ style: styles.main,
403
+ onLayout: this.handleContainerLayout
404
+ }, /*#__PURE__*/React.createElement(Animated.View, {
405
+ style: [drawerType === 'front' ? styles.containerOnBack : styles.containerInFront, containerStyles, contentContainerStyle],
406
+ importantForAccessibility: this.drawerShown ? 'no-hide-descendants' : 'yes'
407
+ }, typeof this.props.children === 'function' ? this.props.children(this.openValue) : this.props.children, this.renderOverlay()), /*#__PURE__*/React.createElement(Animated.View, {
408
+ pointerEvents: "box-none",
409
+ ref: this.accessibilityIsModalView,
410
+ accessibilityViewIsModal: this.drawerShown,
411
+ style: [styles.drawerContainer, drawerStyles, drawerContainerStyle]
412
+ }, /*#__PURE__*/React.createElement(View, {
413
+ style: dynamicDrawerStyles
414
+ }, this.props.renderNavigationView(this.openValue))));
415
+ });
416
+
417
+ _defineProperty(this, "setPanGestureRef", ref => {
418
+ var _this$props$onGesture, _this$props5;
419
+
420
+ // TODO(TS): make sure it is OK taken from
421
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-596081842
422
+ this.panGestureHandler.current = ref;
423
+ (_this$props$onGesture = (_this$props5 = this.props).onGestureRef) === null || _this$props$onGesture === void 0 ? void 0 : _this$props$onGesture.call(_this$props5, ref);
424
+ });
425
+
426
+ const _dragX = new Animated.Value(0);
427
+
428
+ const _touchX = new Animated.Value(0);
429
+
430
+ const _drawerTranslation = new Animated.Value(0);
431
+
432
+ this.state = {
433
+ dragX: _dragX,
434
+ touchX: _touchX,
435
+ drawerTranslation: _drawerTranslation,
436
+ containerWidth: 0
437
+ };
438
+ this.updateAnimatedEvent(_props, this.state);
439
+ }
440
+
441
+ UNSAFE_componentWillUpdate(props, state) {
442
+ if (this.props.drawerPosition !== props.drawerPosition || this.props.drawerWidth !== props.drawerWidth || this.props.drawerType !== props.drawerType || this.state.containerWidth !== state.containerWidth) {
443
+ this.updateAnimatedEvent(props, state);
444
+ }
445
+ }
446
+
447
+ render() {
448
+ const {
449
+ drawerPosition,
450
+ drawerLockMode,
451
+ edgeWidth,
452
+ minSwipeDistance
453
+ } = this.props;
454
+ const fromLeft = drawerPosition === 'left'; // gestureOrientation is 1 if the expected gesture is from left to right and
455
+ // -1 otherwise e.g. when drawer is on the left and is closed we expect left
456
+ // to right gesture, thus orientation will be 1.
457
+
458
+ const gestureOrientation = (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1); // When drawer is closed we want the hitSlop to be horizontally shorter than
459
+ // the container size by the value of SLOP. This will make it only activate
460
+ // when gesture happens not further than SLOP away from the edge
461
+
462
+ const hitSlop = fromLeft ? {
463
+ left: 0,
464
+ width: this.drawerShown ? undefined : edgeWidth
465
+ } : {
466
+ right: 0,
467
+ width: this.drawerShown ? undefined : edgeWidth
468
+ };
469
+ return /*#__PURE__*/React.createElement(PanGestureHandler // @ts-ignore could be fixed in handler types
470
+ , {
471
+ ref: this.setPanGestureRef,
472
+ hitSlop: hitSlop,
473
+ activeOffsetX: gestureOrientation * minSwipeDistance,
474
+ failOffsetY: [-15, 15],
475
+ onGestureEvent: this.onGestureEvent,
476
+ onHandlerStateChange: this.openingHandlerStateChange,
477
+ enableTrackpadTwoFingerGesture: this.props.enableTrackpadTwoFingerGesture,
478
+ enabled: drawerLockMode !== 'locked-closed' && drawerLockMode !== 'locked-open'
479
+ }, this.renderDrawer());
480
+ }
481
+
482
+ }
483
+
484
+ _defineProperty(DrawerLayout, "defaultProps", {
485
+ drawerWidth: 200,
486
+ drawerPosition: 'left',
487
+ useNativeAnimations: true,
488
+ drawerType: 'front',
489
+ edgeWidth: 20,
490
+ minSwipeDistance: 3,
491
+ overlayColor: 'rgba(0, 0, 0, 0.7)',
492
+ drawerLockMode: 'unlocked',
493
+ enableTrackpadTwoFingerGesture: false
494
+ });
495
+
496
+ _defineProperty(DrawerLayout, "positions", {
497
+ Left: 'left',
498
+ Right: 'right'
499
+ });
500
+
501
+ const styles = StyleSheet.create({
502
+ drawerContainer: { ...StyleSheet.absoluteFillObject,
503
+ zIndex: 1001,
504
+ flexDirection: 'row'
505
+ },
506
+ containerInFront: { ...StyleSheet.absoluteFillObject,
507
+ zIndex: 1002
508
+ },
509
+ containerOnBack: { ...StyleSheet.absoluteFillObject
510
+ },
511
+ main: {
512
+ flex: 1,
513
+ zIndex: 0,
514
+ overflow: 'hidden'
515
+ },
516
+ overlay: { ...StyleSheet.absoluteFillObject,
517
+ zIndex: 1000
518
+ }
519
+ });
520
+ //# sourceMappingURL=DrawerLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["DrawerLayout.tsx"],"names":["React","Component","invariant","Animated","StyleSheet","View","Keyboard","StatusBar","I18nManager","PanGestureHandler","TapGestureHandler","State","DRAG_TOSS","IDLE","DRAGGING","SETTLING","DrawerLayout","constructor","props","createRef","state","drawerPosition","drawerWidth","drawerType","dragX","dragXValue","touchX","touchXValue","drawerTranslation","containerWidth","multiply","Value","add","setValue","translationX","startPositionX","dragOffsetFromOnStartPosition","interpolate","inputRange","outputRange","openValue","extrapolate","gestureOptions","useNativeDriver","useNativeAnimations","onDrawerSlide","listener","ev","Math","floor","abs","nativeEvent","position","onGestureEvent","event","x","setState","layout","width","newState","drawerWillShow","onDrawerStateChanged","oldState","ACTIVE","handleRelease","emitStateChanged","keyboardDismissMode","dismiss","hideStatusBar","setHidden","statusBarAnimation","drawerShown","drawerLockMode","closeDrawer","velocityX","gestureStartX","dragOffsetBasedOnStart","startOffsetX","projOffsetX","shouldOpen","animateDrawer","showing","accessibilityIsModalView","current","setNativeProps","accessibilityViewIsModal","pointerEventsView","pointerEvents","minSwipeDistance","edgeWidth","fromLeft","gestureOrientation","hitSlop","left","undefined","right","panGestureHandler","activeOffsetX","fromValue","toValue","velocity","speed","nextFramePosition","min","max","willShow","updateShowing","spring","bounciness","start","finished","onDrawerOpen","onDrawerClose","options","forceUpdate","overlayOpacity","dynamicOverlayStyles","opacity","backgroundColor","overlayColor","onTapHandlerStateChange","styles","overlay","drawerBackgroundColor","drawerContainerStyle","contentContainerStyle","drawerSlide","containerSlide","reverseContentDirection","isRTL","dynamicDrawerStyles","containerStyles","containerTranslateX","transform","translateX","drawerTranslateX","closedDrawerOffset","drawerStyles","flexDirection","main","handleContainerLayout","containerOnBack","containerInFront","children","renderOverlay","drawerContainer","renderNavigationView","ref","onGestureRef","updateAnimatedEvent","UNSAFE_componentWillUpdate","render","setPanGestureRef","openingHandlerStateChange","enableTrackpadTwoFingerGesture","renderDrawer","Left","Right","create","absoluteFillObject","zIndex","flex","overflow"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SACEC,QADF,EAEEC,UAFF,EAGEC,IAHF,EAIEC,QAJF,EAKEC,SALF,EAMEC,WANF,QAYO,cAZP;AAkBA,SACEC,iBADF,QAGO,+BAH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G1I,UAAU,CAAC2J,kBADE;AAEhBC,IAAAA,MAAM,EAAE;AAFQ,GANa;AAU/BnB,EAAAA,eAAe,EAAE,EACf,GAAGzI,UAAU,CAAC2J;AADC,GAVc;AAa/BpB,EAAAA,IAAI,EAAE;AACJsB,IAAAA,IAAI,EAAE,CADF;AAEJD,IAAAA,MAAM,EAAE,CAFJ;AAGJE,IAAAA,QAAQ,EAAE;AAHN,GAbyB;AAkB/BxC,EAAAA,OAAO,EAAE,EACP,GAAGtH,UAAU,CAAC2J,kBADP;AAEPC,IAAAA,MAAM,EAAE;AAFD;AAlBsB,CAAlB,CAAf","sourcesContent":["// This component is based on RN's DrawerLayoutAndroid API\n//\n// It perhaps deserves to be put in a separate repo, but since it relies on\n// react-native-gesture-handler library which isn't very popular at the moment I\n// decided to keep it here for the time being. It will allow us to move faster\n// and fix issues that may arise in gesture handler library that could be found\n// when using the drawer component\n\nimport * as React from 'react';\nimport { Component } from 'react';\nimport invariant from 'invariant';\nimport {\n Animated,\n StyleSheet,\n View,\n Keyboard,\n StatusBar,\n I18nManager,\n StatusBarAnimation,\n StyleProp,\n ViewStyle,\n LayoutChangeEvent,\n NativeSyntheticEvent,\n} from 'react-native';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport {\n PanGestureHandler,\n PanGestureHandlerEventPayload,\n} from '../handlers/PanGestureHandler';\nimport {\n TapGestureHandler,\n TapGestureHandlerEventPayload,\n} from '../handlers/TapGestureHandler';\nimport { State } from '../State';\n\nconst DRAG_TOSS = 0.05;\n\nconst IDLE: DrawerState = 'Idle';\nconst DRAGGING: DrawerState = 'Dragging';\nconst SETTLING: DrawerState = 'Settling';\n\nexport type DrawerPosition = 'left' | 'right';\n\nexport type DrawerState = 'Idle' | 'Dragging' | 'Settling';\n\nexport type DrawerType = 'front' | 'back' | 'slide';\n\nexport type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';\n\nexport type DrawerKeyboardDismissMode = 'none' | 'on-drag';\n\nexport interface DrawerLayoutProps {\n /**\n * This attribute is present in the standard implementation already and is one\n * of the required params. Gesture handler version of DrawerLayout make it\n * possible for the function passed as `renderNavigationView` to take an\n * Animated value as a parameter that indicates the progress of drawer\n * opening/closing animation (progress value is 0 when closed and 1 when\n * opened). This can be used by the drawer component to animated its children\n * while the drawer is opening or closing.\n */\n renderNavigationView: (\n progressAnimatedValue: Animated.Value\n ) => React.ReactNode;\n\n drawerPosition?: DrawerPosition;\n\n drawerWidth?: number;\n\n drawerBackgroundColor?: string;\n\n drawerLockMode?: DrawerLockMode;\n\n keyboardDismissMode?: DrawerKeyboardDismissMode;\n\n /**\n * Called when the drawer is closed.\n */\n onDrawerClose?: () => void;\n\n /**\n * Called when the drawer is opened.\n */\n onDrawerOpen?: () => void;\n\n /**\n * Called when the status of the drawer changes.\n */\n onDrawerStateChanged?: (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => void;\n useNativeAnimations?: boolean;\n\n drawerType?: DrawerType;\n\n /**\n * Defines how far from the edge of the content view the gesture should\n * activate.\n */\n edgeWidth?: number;\n\n minSwipeDistance?: number;\n\n /**\n * When set to true Drawer component will use\n * {@link https://reactnative.dev/docs/statusbar StatusBar} API to hide the OS\n * status bar whenever the drawer is pulled or when its in an \"open\" state.\n */\n hideStatusBar?: boolean;\n\n /**\n * @default 'slide'\n *\n * Can be used when hideStatusBar is set to true and will select the animation\n * used for hiding/showing the status bar. See\n * {@link https://reactnative.dev/docs/statusbar StatusBar} documentation for\n * more details\n */\n statusBarAnimation?: StatusBarAnimation;\n\n /**\n * @default black\n *\n * Color of a semi-transparent overlay to be displayed on top of the content\n * view when drawer gets open. A solid color should be used as the opacity is\n * added by the Drawer itself and the opacity of the overlay is animated (from\n * 0% to 70%).\n */\n overlayColor?: string;\n\n contentContainerStyle?: StyleProp<ViewStyle>;\n\n drawerContainerStyle?: StyleProp<ViewStyle>;\n\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n onDrawerSlide?: (position: number) => void;\n\n onGestureRef?: (ref: PanGestureHandler) => void;\n}\n\nexport type DrawerLayoutState = {\n dragX: Animated.Value;\n touchX: Animated.Value;\n drawerTranslation: Animated.Value;\n containerWidth: number;\n};\n\nexport type DrawerMovementOption = {\n velocity?: number;\n speed?: number;\n};\nexport default class DrawerLayout extends Component<\n DrawerLayoutProps,\n DrawerLayoutState\n> {\n static defaultProps = {\n drawerWidth: 200,\n drawerPosition: 'left',\n useNativeAnimations: true,\n drawerType: 'front',\n edgeWidth: 20,\n minSwipeDistance: 3,\n overlayColor: 'rgba(0, 0, 0, 0.7)',\n drawerLockMode: 'unlocked',\n enableTrackpadTwoFingerGesture: false,\n };\n\n constructor(props: DrawerLayoutProps) {\n super(props);\n\n const dragX = new Animated.Value(0);\n const touchX = new Animated.Value(0);\n const drawerTranslation = new Animated.Value(0);\n\n this.state = {\n dragX,\n touchX,\n drawerTranslation,\n containerWidth: 0,\n };\n\n this.updateAnimatedEvent(props, this.state);\n }\n\n UNSAFE_componentWillUpdate(\n props: DrawerLayoutProps,\n state: DrawerLayoutState\n ) {\n if (\n this.props.drawerPosition !== props.drawerPosition ||\n this.props.drawerWidth !== props.drawerWidth ||\n this.props.drawerType !== props.drawerType ||\n this.state.containerWidth !== state.containerWidth\n ) {\n this.updateAnimatedEvent(props, state);\n }\n }\n\n private openValue?: Animated.AnimatedInterpolation;\n private onGestureEvent?: (\n event: GestureEvent<PanGestureHandlerEventPayload>\n ) => void;\n private accessibilityIsModalView = React.createRef<View>();\n private pointerEventsView = React.createRef<View>();\n private panGestureHandler = React.createRef<PanGestureHandler | null>();\n private drawerShown = false;\n\n static positions = {\n Left: 'left',\n Right: 'right',\n };\n\n private updateAnimatedEvent = (\n props: DrawerLayoutProps,\n state: DrawerLayoutState\n ) => {\n // Event definition is based on\n const { drawerPosition, drawerWidth, drawerType } = props;\n const {\n dragX: dragXValue,\n touchX: touchXValue,\n drawerTranslation,\n containerWidth,\n } = state;\n\n let dragX = dragXValue;\n let touchX = touchXValue;\n\n if (drawerPosition !== 'left') {\n // Most of the code is written in a way to handle left-side drawer. In\n // order to handle right-side drawer the only thing we need to do is to\n // reverse events coming from gesture handler in a way they emulate\n // left-side drawer gestures. E.g. dragX is simply -dragX, and touchX is\n // calulcated by subtracing real touchX from the width of the container\n // (such that when touch happens at the right edge the value is simply 0)\n dragX = Animated.multiply(\n new Animated.Value(-1),\n dragXValue\n ) as Animated.Value; // TODO(TS): (for all \"as\" in this file) make sure we can map this\n touchX = Animated.add(\n new Animated.Value(containerWidth),\n Animated.multiply(new Animated.Value(-1), touchXValue)\n ) as Animated.Value; // TODO(TS): make sure we can map this;\n touchXValue.setValue(containerWidth);\n } else {\n touchXValue.setValue(0);\n }\n\n // While closing the drawer when user starts gesture outside of its area (in greyed\n // out part of the window), we want the drawer to follow only once finger reaches the\n // edge of the drawer.\n // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by\n // dots. The touch gesture starts at '*' and moves left, touch path is indicated by\n // an arrow pointing left\n // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // +---------------+ +---------------+ +---------------+ +---------------+\n //\n // For the above to work properly we define animated value that will keep\n // start position of the gesture. Then we use that value to calculate how\n // much we need to subtract from the dragX. If the gesture started on the\n // greyed out area we take the distance from the edge of the drawer to the\n // start position. Otherwise we don't subtract at all and the drawer be\n // pulled back as soon as you start the pan.\n //\n // This is used only when drawerType is \"front\"\n //\n let translationX = dragX;\n if (drawerType === 'front') {\n const startPositionX = Animated.add(\n touchX,\n Animated.multiply(new Animated.Value(-1), dragX)\n );\n\n const dragOffsetFromOnStartPosition = startPositionX.interpolate({\n inputRange: [drawerWidth! - 1, drawerWidth!, drawerWidth! + 1],\n outputRange: [0, 0, 1],\n });\n translationX = Animated.add(\n dragX,\n dragOffsetFromOnStartPosition\n ) as Animated.Value; // TODO: as above\n }\n\n this.openValue = Animated.add(translationX, drawerTranslation).interpolate({\n inputRange: [0, drawerWidth!],\n outputRange: [0, 1],\n extrapolate: 'clamp',\n });\n\n const gestureOptions: {\n useNativeDriver: boolean;\n // TODO: make sure it is correct\n listener?: (\n ev: NativeSyntheticEvent<PanGestureHandlerEventPayload>\n ) => void;\n } = {\n useNativeDriver: props.useNativeAnimations!,\n };\n\n if (this.props.onDrawerSlide) {\n gestureOptions.listener = (ev) => {\n const translationX = Math.floor(Math.abs(ev.nativeEvent.translationX));\n const position = translationX / this.state.containerWidth;\n\n this.props.onDrawerSlide?.(position);\n };\n }\n\n this.onGestureEvent = Animated.event(\n [{ nativeEvent: { translationX: dragXValue, x: touchXValue } }],\n gestureOptions\n );\n };\n\n private handleContainerLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n this.setState({ containerWidth: nativeEvent.layout.width });\n };\n\n private emitStateChanged = (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => {\n this.props.onDrawerStateChanged?.(newState, drawerWillShow);\n };\n\n private openingHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n if (nativeEvent.oldState === State.ACTIVE) {\n this.handleRelease({ nativeEvent });\n } else if (nativeEvent.state === State.ACTIVE) {\n this.emitStateChanged(DRAGGING, false);\n if (this.props.keyboardDismissMode === 'on-drag') {\n Keyboard.dismiss();\n }\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(true, this.props.statusBarAnimation || 'slide');\n }\n }\n };\n\n private onTapHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<TapGestureHandlerEventPayload>) => {\n if (\n this.drawerShown &&\n nativeEvent.oldState === State.ACTIVE &&\n this.props.drawerLockMode !== 'locked-open'\n ) {\n this.closeDrawer();\n }\n };\n\n private handleRelease = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n const { drawerWidth, drawerPosition, drawerType } = this.props;\n const { containerWidth } = this.state;\n let { translationX: dragX, velocityX, x: touchX } = nativeEvent;\n\n if (drawerPosition !== 'left') {\n // See description in _updateAnimatedEvent about why events are flipped\n // for right-side drawer\n dragX = -dragX;\n touchX = containerWidth - touchX;\n velocityX = -velocityX;\n }\n\n const gestureStartX = touchX - dragX;\n let dragOffsetBasedOnStart = 0;\n\n if (drawerType === 'front') {\n dragOffsetBasedOnStart =\n gestureStartX > drawerWidth! ? gestureStartX - drawerWidth! : 0;\n }\n\n const startOffsetX =\n dragX + dragOffsetBasedOnStart + (this.drawerShown ? drawerWidth! : 0);\n const projOffsetX = startOffsetX + DRAG_TOSS * velocityX;\n\n const shouldOpen = projOffsetX > drawerWidth! / 2;\n\n if (shouldOpen) {\n this.animateDrawer(startOffsetX, drawerWidth!, velocityX);\n } else {\n this.animateDrawer(startOffsetX, 0, velocityX);\n }\n };\n\n private updateShowing = (showing: boolean) => {\n this.drawerShown = showing;\n this.accessibilityIsModalView.current?.setNativeProps({\n accessibilityViewIsModal: showing,\n });\n this.pointerEventsView.current?.setNativeProps({\n pointerEvents: showing ? 'auto' : 'none',\n });\n const { drawerPosition, minSwipeDistance, edgeWidth } = this.props;\n const fromLeft = drawerPosition === 'left';\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: showing ? undefined : edgeWidth }\n : { right: 0, width: showing ? undefined : edgeWidth };\n // @ts-ignore internal API, maybe could be fixed in handler types\n this.panGestureHandler.current?.setNativeProps({\n hitSlop,\n activeOffsetX: gestureOrientation * minSwipeDistance!,\n });\n };\n\n private animateDrawer = (\n fromValue: number | null | undefined,\n toValue: number,\n velocity: number,\n speed?: number\n ) => {\n this.state.dragX.setValue(0);\n this.state.touchX.setValue(\n this.props.drawerPosition === 'left' ? 0 : this.state.containerWidth\n );\n\n if (fromValue != null) {\n let nextFramePosition = fromValue;\n if (this.props.useNativeAnimations) {\n // When using native driver, we predict the next position of the\n // animation because it takes one frame of a roundtrip to pass RELEASE\n // event from native driver to JS before we can start animating. Without\n // it, it is more noticable that the frame is dropped.\n if (fromValue < toValue && velocity > 0) {\n nextFramePosition = Math.min(fromValue + velocity / 60.0, toValue);\n } else if (fromValue > toValue && velocity < 0) {\n nextFramePosition = Math.max(fromValue + velocity / 60.0, toValue);\n }\n }\n this.state.drawerTranslation.setValue(nextFramePosition);\n }\n\n const willShow = toValue !== 0;\n this.updateShowing(willShow);\n this.emitStateChanged(SETTLING, willShow);\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');\n }\n Animated.spring(this.state.drawerTranslation, {\n velocity,\n bounciness: 0,\n toValue,\n useNativeDriver: this.props.useNativeAnimations!,\n speed: speed ?? undefined,\n }).start(({ finished }) => {\n if (finished) {\n this.emitStateChanged(IDLE, willShow);\n if (willShow) {\n this.props.onDrawerOpen?.();\n } else {\n this.props.onDrawerClose?.();\n }\n }\n });\n };\n\n openDrawer = (options: DrawerMovementOption = {}) => {\n this.animateDrawer(\n // TODO: decide if it should be null or undefined is the proper value\n undefined,\n this.props.drawerWidth!,\n options.velocity ? options.velocity : 0\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would not be clickable\n this.forceUpdate();\n };\n\n closeDrawer = (options: DrawerMovementOption = {}) => {\n // TODO: decide if it should be null or undefined is the proper value\n this.animateDrawer(undefined, 0, options.velocity ? options.velocity : 0);\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would be still clickable\n this.forceUpdate();\n };\n\n private renderOverlay = () => {\n /* Overlay styles */\n invariant(this.openValue, 'should be set');\n const overlayOpacity = this.openValue.interpolate({\n inputRange: [0, 1],\n outputRange: [0, 1],\n extrapolate: 'clamp',\n });\n const dynamicOverlayStyles = {\n opacity: overlayOpacity,\n backgroundColor: this.props.overlayColor,\n };\n\n return (\n <TapGestureHandler onHandlerStateChange={this.onTapHandlerStateChange}>\n <Animated.View\n pointerEvents={this.drawerShown ? 'auto' : 'none'}\n ref={this.pointerEventsView}\n style={[styles.overlay, dynamicOverlayStyles]}\n />\n </TapGestureHandler>\n );\n };\n\n private renderDrawer = () => {\n const {\n drawerBackgroundColor,\n drawerWidth,\n drawerPosition,\n drawerType,\n drawerContainerStyle,\n contentContainerStyle,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n const drawerSlide = drawerType !== 'back';\n const containerSlide = drawerType !== 'front';\n\n // we rely on row and row-reverse flex directions to position the drawer\n // properly. Apparently for RTL these are flipped which requires us to use\n // the opposite setting for the drawer to appear from left or right\n // according to the drawerPosition prop\n const reverseContentDirection = I18nManager.isRTL ? fromLeft : !fromLeft;\n\n const dynamicDrawerStyles = {\n backgroundColor: drawerBackgroundColor,\n width: drawerWidth,\n };\n const openValue = this.openValue;\n invariant(openValue, 'should be set');\n\n let containerStyles;\n if (containerSlide) {\n const containerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: fromLeft ? [0, drawerWidth!] : [0, -drawerWidth!],\n extrapolate: 'clamp',\n });\n containerStyles = {\n transform: [{ translateX: containerTranslateX }],\n };\n }\n\n let drawerTranslateX: number | Animated.AnimatedInterpolation = 0;\n if (drawerSlide) {\n const closedDrawerOffset = fromLeft ? -drawerWidth! : drawerWidth!;\n drawerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: [closedDrawerOffset, 0],\n extrapolate: 'clamp',\n });\n }\n const drawerStyles: {\n transform: { translateX: number | Animated.AnimatedInterpolation }[];\n flexDirection: 'row-reverse' | 'row';\n } = {\n transform: [{ translateX: drawerTranslateX }],\n flexDirection: reverseContentDirection ? 'row-reverse' : 'row',\n };\n\n return (\n <Animated.View style={styles.main} onLayout={this.handleContainerLayout}>\n <Animated.View\n style={[\n drawerType === 'front'\n ? styles.containerOnBack\n : styles.containerInFront,\n containerStyles,\n contentContainerStyle,\n ]}\n importantForAccessibility={\n this.drawerShown ? 'no-hide-descendants' : 'yes'\n }>\n {typeof this.props.children === 'function'\n ? this.props.children(this.openValue)\n : this.props.children}\n {this.renderOverlay()}\n </Animated.View>\n <Animated.View\n pointerEvents=\"box-none\"\n ref={this.accessibilityIsModalView}\n accessibilityViewIsModal={this.drawerShown}\n style={[styles.drawerContainer, drawerStyles, drawerContainerStyle]}>\n <View style={dynamicDrawerStyles}>\n {this.props.renderNavigationView(this.openValue as Animated.Value)}\n </View>\n </Animated.View>\n </Animated.View>\n );\n };\n\n private setPanGestureRef = (ref: PanGestureHandler) => {\n // TODO(TS): make sure it is OK taken from\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-596081842\n (this\n .panGestureHandler as React.MutableRefObject<PanGestureHandler>).current = ref;\n this.props.onGestureRef?.(ref);\n };\n\n render() {\n const {\n drawerPosition,\n drawerLockMode,\n edgeWidth,\n minSwipeDistance,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: this.drawerShown ? undefined : edgeWidth }\n : { right: 0, width: this.drawerShown ? undefined : edgeWidth };\n\n return (\n <PanGestureHandler\n // @ts-ignore could be fixed in handler types\n ref={this.setPanGestureRef}\n hitSlop={hitSlop}\n activeOffsetX={gestureOrientation * minSwipeDistance!}\n failOffsetY={[-15, 15]}\n onGestureEvent={this.onGestureEvent}\n onHandlerStateChange={this.openingHandlerStateChange}\n enableTrackpadTwoFingerGesture={\n this.props.enableTrackpadTwoFingerGesture\n }\n enabled={\n drawerLockMode !== 'locked-closed' && drawerLockMode !== 'locked-open'\n }>\n {this.renderDrawer()}\n </PanGestureHandler>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n drawerContainer: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1001,\n flexDirection: 'row',\n },\n containerInFront: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1002,\n },\n containerOnBack: {\n ...StyleSheet.absoluteFillObject,\n },\n main: {\n flex: 1,\n zIndex: 0,\n overflow: 'hidden',\n },\n overlay: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1000,\n },\n});\n"]}