react-native-gesture-handler 2.18.1 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/README.md +1 -0
  2. package/android/build.gradle +11 -29
  3. package/android/fabric/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +1 -1
  4. package/android/paper/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +1 -1
  5. package/android/src/main/AndroidManifest.xml +1 -3
  6. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +21 -21
  7. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +2 -2
  8. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureUtils.kt +1 -0
  9. package/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt +16 -0
  10. package/android/src/main/java/com/swmansion/gesturehandler/core/LongPressGestureHandler.kt +80 -4
  11. package/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt +8 -0
  12. package/android/src/main/java/com/swmansion/gesturehandler/core/PinchGestureHandler.kt +2 -1
  13. package/android/src/main/java/com/swmansion/gesturehandler/core/ScaleGestureDetector.java +10 -0
  14. package/android/src/main/java/com/swmansion/gesturehandler/core/StylusData.kt +103 -0
  15. package/android/src/main/java/com/swmansion/gesturehandler/core/Vector.kt +2 -2
  16. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +24 -15
  17. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +3 -0
  18. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/HoverGestureHandlerEventDataBuilder.kt +7 -0
  19. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PanGestureHandlerEventDataBuilder.kt +7 -0
  20. package/android/src/main/jni/CMakeLists.txt +18 -9
  21. package/apple/Handlers/RNFlingHandler.h +1 -0
  22. package/apple/Handlers/RNFlingHandler.m +153 -19
  23. package/apple/Handlers/RNHoverHandler.m +44 -2
  24. package/apple/Handlers/RNLongPressHandler.m +111 -20
  25. package/apple/Handlers/RNManualHandler.m +53 -29
  26. package/apple/Handlers/RNNativeViewHandler.mm +22 -15
  27. package/apple/Handlers/RNPanHandler.m +57 -7
  28. package/apple/Handlers/RNRotationHandler.m +1 -1
  29. package/apple/RNGHStylusData.h +77 -0
  30. package/apple/RNGHStylusData.m +37 -0
  31. package/apple/RNGHUIKit.h +2 -0
  32. package/apple/RNGHVector.h +31 -0
  33. package/apple/RNGHVector.m +67 -0
  34. package/apple/RNGestureHandler.h +7 -0
  35. package/apple/{RNGestureHandler.m → RNGestureHandler.mm} +63 -1
  36. package/apple/RNGestureHandlerButtonComponentView.mm +41 -0
  37. package/apple/RNGestureHandlerDirection.h +25 -0
  38. package/apple/RNGestureHandlerEvents.h +3 -1
  39. package/apple/RNGestureHandlerEvents.m +11 -3
  40. package/lib/commonjs/PointerType.js +2 -1
  41. package/lib/commonjs/PointerType.js.map +1 -1
  42. package/lib/commonjs/components/GestureButtons.js +5 -1
  43. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  44. package/lib/commonjs/components/GestureComponents.js.map +1 -1
  45. package/lib/commonjs/components/Pressable/Pressable.js +66 -78
  46. package/lib/commonjs/components/Pressable/Pressable.js.map +1 -1
  47. package/lib/commonjs/components/Pressable/index.js +0 -8
  48. package/lib/commonjs/components/Pressable/index.js.map +1 -1
  49. package/lib/commonjs/components/Pressable/utils.js +1 -23
  50. package/lib/commonjs/components/Pressable/utils.js.map +1 -1
  51. package/lib/commonjs/components/ReanimatedSwipeable.js +60 -41
  52. package/lib/commonjs/components/ReanimatedSwipeable.js.map +1 -1
  53. package/lib/commonjs/handlers/GestureHandlerEventPayload.js +4 -0
  54. package/lib/commonjs/handlers/LongPressGestureHandler.js +1 -1
  55. package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
  56. package/lib/commonjs/handlers/createHandler.js +2 -1
  57. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  58. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js +1 -1
  59. package/lib/commonjs/handlers/gestures/GestureDetector/utils.js.map +1 -1
  60. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  61. package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
  62. package/lib/commonjs/handlers/gestures/longPressGesture.js +10 -0
  63. package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
  64. package/lib/commonjs/jestUtils/jestUtils.js +12 -4
  65. package/lib/commonjs/jestUtils/jestUtils.js.map +1 -1
  66. package/lib/commonjs/mocks.js +16 -3
  67. package/lib/commonjs/mocks.js.map +1 -1
  68. package/lib/commonjs/utils.js +4 -0
  69. package/lib/commonjs/utils.js.map +1 -1
  70. package/lib/commonjs/web/constants.js +3 -3
  71. package/lib/commonjs/web/constants.js.map +1 -1
  72. package/lib/commonjs/web/handlers/GestureHandler.js +2 -3
  73. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  74. package/lib/commonjs/web/handlers/HoverGestureHandler.js +18 -1
  75. package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
  76. package/lib/commonjs/web/handlers/LongPressGestureHandler.js +43 -9
  77. package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
  78. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +14 -3
  79. package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
  80. package/lib/commonjs/web/handlers/PanGestureHandler.js +12 -1
  81. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  82. package/lib/commonjs/web/interfaces.js.map +1 -1
  83. package/lib/commonjs/web/tools/EventManager.js.map +1 -1
  84. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +55 -11
  85. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  86. package/lib/commonjs/web/tools/KeyboardEventManager.js +110 -0
  87. package/lib/commonjs/web/tools/KeyboardEventManager.js.map +1 -0
  88. package/lib/commonjs/web/tools/PointerEventManager.js +3 -37
  89. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  90. package/lib/commonjs/web/tools/Vector.js +4 -2
  91. package/lib/commonjs/web/tools/Vector.js.map +1 -1
  92. package/lib/commonjs/web/utils.js +187 -13
  93. package/lib/commonjs/web/utils.js.map +1 -1
  94. package/lib/module/PointerType.js +2 -1
  95. package/lib/module/PointerType.js.map +1 -1
  96. package/lib/module/components/GestureButtons.js +5 -1
  97. package/lib/module/components/GestureButtons.js.map +1 -1
  98. package/lib/module/components/GestureComponents.js.map +1 -1
  99. package/lib/module/components/Pressable/Pressable.js +67 -78
  100. package/lib/module/components/Pressable/Pressable.js.map +1 -1
  101. package/lib/module/components/Pressable/index.js +0 -1
  102. package/lib/module/components/Pressable/index.js.map +1 -1
  103. package/lib/module/components/Pressable/utils.js +1 -22
  104. package/lib/module/components/Pressable/utils.js.map +1 -1
  105. package/lib/module/components/ReanimatedSwipeable.js +58 -37
  106. package/lib/module/components/ReanimatedSwipeable.js.map +1 -1
  107. package/lib/module/handlers/GestureHandlerEventPayload.js +1 -1
  108. package/lib/module/handlers/LongPressGestureHandler.js +1 -1
  109. package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
  110. package/lib/module/handlers/createHandler.js +2 -1
  111. package/lib/module/handlers/createHandler.js.map +1 -1
  112. package/lib/module/handlers/gestures/GestureDetector/utils.js +2 -2
  113. package/lib/module/handlers/gestures/GestureDetector/utils.js.map +1 -1
  114. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  115. package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
  116. package/lib/module/handlers/gestures/longPressGesture.js +10 -0
  117. package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
  118. package/lib/module/jestUtils/jestUtils.js +12 -4
  119. package/lib/module/jestUtils/jestUtils.js.map +1 -1
  120. package/lib/module/mocks.js +13 -3
  121. package/lib/module/mocks.js.map +1 -1
  122. package/lib/module/utils.js +1 -0
  123. package/lib/module/utils.js.map +1 -1
  124. package/lib/module/web/constants.js +1 -1
  125. package/lib/module/web/constants.js.map +1 -1
  126. package/lib/module/web/handlers/GestureHandler.js +2 -3
  127. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  128. package/lib/module/web/handlers/HoverGestureHandler.js +18 -1
  129. package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
  130. package/lib/module/web/handlers/LongPressGestureHandler.js +43 -9
  131. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
  132. package/lib/module/web/handlers/NativeViewGestureHandler.js +14 -3
  133. package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
  134. package/lib/module/web/handlers/PanGestureHandler.js +12 -1
  135. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  136. package/lib/module/web/interfaces.js.map +1 -1
  137. package/lib/module/web/tools/EventManager.js.map +1 -1
  138. package/lib/module/web/tools/GestureHandlerWebDelegate.js +54 -10
  139. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  140. package/lib/module/web/tools/KeyboardEventManager.js +96 -0
  141. package/lib/module/web/tools/KeyboardEventManager.js.map +1 -0
  142. package/lib/module/web/tools/PointerEventManager.js +4 -38
  143. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  144. package/lib/module/web/tools/Vector.js +5 -3
  145. package/lib/module/web/tools/Vector.js.map +1 -1
  146. package/lib/module/web/utils.js +184 -13
  147. package/lib/module/web/utils.js.map +1 -1
  148. package/lib/typescript/PointerType.d.ts +2 -1
  149. package/lib/typescript/components/GestureComponents.d.ts +1 -1
  150. package/lib/typescript/components/Pressable/index.d.ts +1 -1
  151. package/lib/typescript/components/Pressable/utils.d.ts +3 -5
  152. package/lib/typescript/handlers/GestureHandlerEventPayload.d.ts +35 -0
  153. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +5 -1
  154. package/lib/typescript/handlers/gestures/gesture.d.ts +2 -2
  155. package/lib/typescript/handlers/gestures/hoverGesture.d.ts +1 -6
  156. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +5 -0
  157. package/lib/typescript/handlers/handlersRegistry.d.ts +1 -1
  158. package/lib/typescript/jestUtils/jestUtils.d.ts +1 -1
  159. package/lib/typescript/mocks.d.ts +4 -3
  160. package/lib/typescript/utils.d.ts +1 -0
  161. package/lib/typescript/web/constants.d.ts +1 -1
  162. package/lib/typescript/web/handlers/GestureHandler.d.ts +1 -1
  163. package/lib/typescript/web/handlers/HoverGestureHandler.d.ts +2 -0
  164. package/lib/typescript/web/handlers/LongPressGestureHandler.d.ts +3 -0
  165. package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +1 -0
  166. package/lib/typescript/web/handlers/PanGestureHandler.d.ts +3 -1
  167. package/lib/typescript/web/interfaces.d.ts +9 -4
  168. package/lib/typescript/web/tools/EventManager.d.ts +2 -2
  169. package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +1 -0
  170. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +6 -0
  171. package/lib/typescript/web/tools/KeyboardEventManager.d.ts +13 -0
  172. package/lib/typescript/web/utils.d.ts +2 -1
  173. package/package.json +3 -3
  174. package/src/PointerType.ts +1 -0
  175. package/src/components/GestureButtons.tsx +2 -1
  176. package/src/components/GestureComponents.tsx +1 -1
  177. package/src/components/Pressable/Pressable.tsx +77 -70
  178. package/src/components/Pressable/index.ts +1 -1
  179. package/src/components/Pressable/utils.ts +5 -49
  180. package/src/components/ReanimatedSwipeable.tsx +70 -47
  181. package/src/handlers/GestureHandlerEventPayload.ts +42 -0
  182. package/src/handlers/LongPressGestureHandler.ts +6 -0
  183. package/src/handlers/createHandler.tsx +1 -0
  184. package/src/handlers/gestures/GestureDetector/utils.ts +2 -2
  185. package/src/handlers/gestures/gesture.ts +3 -1
  186. package/src/handlers/gestures/hoverGesture.ts +1 -7
  187. package/src/handlers/gestures/longPressGesture.ts +9 -0
  188. package/src/jestUtils/jestUtils.ts +9 -1
  189. package/src/{mocks.ts → mocks.tsx} +8 -3
  190. package/src/utils.ts +2 -0
  191. package/src/web/constants.ts +1 -1
  192. package/src/web/handlers/GestureHandler.ts +4 -2
  193. package/src/web/handlers/HoverGestureHandler.ts +16 -2
  194. package/src/web/handlers/LongPressGestureHandler.ts +49 -10
  195. package/src/web/handlers/NativeViewGestureHandler.ts +14 -4
  196. package/src/web/handlers/PanGestureHandler.ts +14 -1
  197. package/src/web/interfaces.ts +10 -4
  198. package/src/web/tools/EventManager.ts +2 -4
  199. package/src/web/tools/GestureHandlerDelegate.ts +1 -0
  200. package/src/web/tools/GestureHandlerWebDelegate.ts +67 -10
  201. package/src/web/tools/KeyboardEventManager.ts +91 -0
  202. package/src/web/tools/PointerEventManager.ts +2 -38
  203. package/src/web/tools/Vector.ts +4 -3
  204. package/src/web/utils.ts +188 -13
  205. package/lib/commonjs/web/tools/TouchEventManager.js +0 -164
  206. package/lib/commonjs/web/tools/TouchEventManager.js.map +0 -1
  207. package/lib/module/web/tools/TouchEventManager.js +0 -149
  208. package/lib/module/web/tools/TouchEventManager.js.map +0 -1
  209. package/lib/typescript/web/tools/TouchEventManager.d.ts +0 -11
  210. package/src/web/tools/TouchEventManager.ts +0 -175
@@ -1 +1 @@
1
- {"version":3,"sources":["Pressable.tsx"],"names":["DEFAULT_LONG_PRESS_DURATION","Pressable","props","pressedState","setPressedState","testOnly_pressed","pressableRef","isPressCallbackEnabled","hasPassedBoundsChecks","shouldPreventNativeEffects","normalizedHitSlop","hitSlop","normalizedPressRetentionOffset","pressRetentionOffset","hoverInTimeout","hoverOutTimeout","hoverGesture","Gesture","Hover","manualActivation","cancelsTouchesInView","onBegin","event","current","clearTimeout","delayHoverIn","setTimeout","onHoverIn","onFinalize","delayHoverOut","onHoverOut","pressDelayTimeoutRef","isTouchPropagationAllowed","deferredEventPayload","pressInHandler","handlingOnTouchesDown","onPressIn","pressOutHandler","nativeEvent","touches","length","changedTouches","unstable_pressDelay","onPressOut","onPress","longPressTimeoutRef","onEndHandlingTouchesDown","cancelledMidPress","activateLongPress","onLongPress","longPressMinDuration","delayLongPress","pressAndTouchGesture","LongPress","minDuration","Number","MAX_SAFE_INTEGER","maxDistance","onTouchesDown","measure","_x","_y","width","height","at","onTouchesUp","onTouchesCancelled","allTouches","buttonGesture","Native","Platform","OS","onStart","appliedHitSlop","isPressableEnabled","disabled","gestures","gesture","enabled","runOnJS","shouldCancelWhenOutside","Simultaneous","defaultRippleColor","android_ripple","undefined","pointerStyle","cursor","styleProp","style","pressed","childrenProp","children","flattenedStyles","StyleSheet","flatten","innerStyles","outerStyles","testID","android_disableSound","color","radius","absoluteFill","__DEV__"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AASA;;AACA;;AAQA;;;;;;;;AAGA,MAAMA,2BAA2B,GAAG,GAApC;;AAEe,SAASC,SAAT,CAAmBC,KAAnB,EAA0C;AAAA;;AACvD,QAAM,CAACC,YAAD,EAAeC,eAAf,IAAkC,8CACtCF,KAAK,CAACG,gBADgC,yEACZ,KADY,CAAxC;AAIA,QAAMC,YAAY,GAAG,mBAAa,IAAb,CAArB,CALuD,CAOvD;;AACA,QAAMC,sBAAsB,GAAG,mBAAgB,IAAhB,CAA/B;AACA,QAAMC,qBAAqB,GAAG,mBAAgB,KAAhB,CAA9B;AACA,QAAMC,0BAA0B,GAAG,mBAAgB,KAAhB,CAAnC;AAEA,QAAMC,iBAAyB,GAAG,oBAChC;AAAA;;AAAA,WACE,OAAOR,KAAK,CAACS,OAAb,KAAyB,QAAzB,GACI,0BAAcT,KAAK,CAACS,OAApB,CADJ,qBAEIT,KAAK,CAACS,OAFV,2DAEqB,EAHvB;AAAA,GADgC,EAKhC,CAACT,KAAK,CAACS,OAAP,CALgC,CAAlC;AAQA,QAAMC,8BAAsC,GAAG,oBAC7C;AAAA;;AAAA,WACE,OAAOV,KAAK,CAACW,oBAAb,KAAsC,QAAtC,GACI,0BAAcX,KAAK,CAACW,oBAApB,CADJ,4BAEIX,KA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AAA,KAAK,EAAC,KAA7B;AAAmC,IAAA,OAAO,EAAE5F;AAA5C,IADM,GAEJ,IAdN,CADF,CADF,CADF;AAsBD","sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { GestureObjects as Gesture } from '../../handlers/gestures/gestureObjects';\nimport { GestureDetector } from '../../handlers/gestures/GestureDetector';\nimport { PressableEvent, PressableProps } from './PressableProps';\nimport {\n Insets,\n Platform,\n StyleProp,\n View,\n ViewStyle,\n processColor,\n StyleSheet,\n} from 'react-native';\nimport NativeButton from '../GestureHandlerButton';\nimport {\n numberAsInset,\n gestureToPressableEvent,\n isTouchWithinInset,\n gestureTouchToPressableEvent,\n addInsets,\n splitStyles,\n} from './utils';\nimport { PressabilityDebugView } from '../../handlers/PressabilityDebugView';\nimport { GestureTouchEvent } from '../../handlers/gestureHandlerCommon';\n\nconst DEFAULT_LONG_PRESS_DURATION = 500;\n\nexport default function Pressable(props: PressableProps) {\n const [pressedState, setPressedState] = useState(\n props.testOnly_pressed ?? false\n );\n\n const pressableRef = useRef<View>(null);\n\n // Disabled when onLongPress has been called\n const isPressCallbackEnabled = useRef<boolean>(true);\n const hasPassedBoundsChecks = useRef<boolean>(false);\n const shouldPreventNativeEffects = useRef<boolean>(false);\n\n const normalizedHitSlop: Insets = useMemo(\n () =>\n typeof props.hitSlop === 'number'\n ? numberAsInset(props.hitSlop)\n : props.hitSlop ?? {},\n [props.hitSlop]\n );\n\n const normalizedPressRetentionOffset: Insets = useMemo(\n () =>\n typeof props.pressRetentionOffset === 'number'\n ? numberAsInset(props.pressRetentionOffset)\n : props.pressRetentionOffset ?? {},\n [props.pressRetentionOffset]\n );\n\n const hoverInTimeout = useRef<number | null>(null);\n const hoverOutTimeout = useRef<number | null>(null);\n\n const hoverGesture = useMemo(\n () =>\n Gesture.Hover()\n .manualActivation(true) // Stops Hover from blocking Native gesture activation on web\n .cancelsTouchesInView(false)\n .onBegin((event) => {\n if (hoverOutTimeout.current) {\n clearTimeout(hoverOutTimeout.current);\n }\n if (props.delayHoverIn) {\n hoverInTimeout.current = setTimeout(\n () => props.onHoverIn?.(gestureToPressableEvent(event)),\n props.delayHoverIn\n );\n return;\n }\n props.onHoverIn?.(gestureToPressableEvent(event));\n })\n .onFinalize((event) => {\n if (hoverInTimeout.current) {\n clearTimeout(hoverInTimeout.current);\n }\n if (props.delayHoverOut) {\n hoverOutTimeout.current = setTimeout(\n () => props.onHoverOut?.(gestureToPressableEvent(event)),\n props.delayHoverOut\n );\n return;\n }\n props.onHoverOut?.(gestureToPressableEvent(event));\n }),\n [props]\n );\n\n const pressDelayTimeoutRef = useRef<number | null>(null);\n const isTouchPropagationAllowed = useRef<boolean>(false);\n\n // iOS only: due to varying flow of gestures, events sometimes have to be saved for later use\n const deferredEventPayload = useRef<PressableEvent | null>(null);\n\n const pressInHandler = useCallback(\n (event: PressableEvent) => {\n if (handlingOnTouchesDown.current) {\n deferredEventPayload.current = event;\n }\n\n if (!isTouchPropagationAllowed.current) {\n return;\n }\n\n deferredEventPayload.current = null;\n\n props.onPressIn?.(event);\n isPressCallbackEnabled.current = true;\n pressDelayTimeoutRef.current = null;\n setPressedState(true);\n },\n [props]\n );\n\n const pressOutHandler = useCallback(\n (event: PressableEvent) => {\n if (\n !hasPassedBoundsChecks.current ||\n event.nativeEvent.touches.length >\n event.nativeEvent.changedTouches.length\n ) {\n return;\n }\n\n if (props.unstable_pressDelay && pressDelayTimeoutRef.current !== null) {\n // When delay is preemptively finished by lifting touches,\n // we want to immediately activate it's effects - pressInHandler,\n // even though we are located at the pressOutHandler\n clearTimeout(pressDelayTimeoutRef.current);\n pressInHandler(event);\n }\n\n if (deferredEventPayload.current) {\n props.onPressIn?.(deferredEventPayload.current);\n deferredEventPayload.current = null;\n }\n\n props.onPressOut?.(event);\n\n if (isPressCallbackEnabled.current) {\n props.onPress?.(event);\n }\n\n if (longPressTimeoutRef.current) {\n clearTimeout(longPressTimeoutRef.current);\n longPressTimeoutRef.current = null;\n }\n\n isTouchPropagationAllowed.current = false;\n hasPassedBoundsChecks.current = false;\n isPressCallbackEnabled.current = true;\n setPressedState(false);\n },\n [pressInHandler, props]\n );\n\n const handlingOnTouchesDown = useRef<boolean>(false);\n const onEndHandlingTouchesDown = useRef<(() => void) | null>(null);\n const cancelledMidPress = useRef<boolean>(false);\n\n const activateLongPress = useCallback(\n (event: GestureTouchEvent) => {\n if (!isTouchPropagationAllowed.current) {\n return;\n }\n\n if (hasPassedBoundsChecks.current) {\n props.onLongPress?.(gestureTouchToPressableEvent(event));\n isPressCallbackEnabled.current = false;\n }\n\n if (longPressTimeoutRef.current) {\n clearTimeout(longPressTimeoutRef.current);\n longPressTimeoutRef.current = null;\n }\n },\n [props]\n );\n\n const longPressTimeoutRef = useRef<number | null>(null);\n const longPressMinDuration =\n (props.delayLongPress ?? DEFAULT_LONG_PRESS_DURATION) +\n (props.unstable_pressDelay ?? 0);\n\n const pressAndTouchGesture = useMemo(\n () =>\n Gesture.LongPress()\n .minDuration(Number.MAX_SAFE_INTEGER) // Stops long press from blocking native gesture\n .maxDistance(Number.MAX_SAFE_INTEGER) // Stops long press from cancelling after set distance\n .cancelsTouchesInView(false)\n .onTouchesDown((event) => {\n handlingOnTouchesDown.current = true;\n pressableRef.current?.measure((_x, _y, width, height) => {\n if (\n !isTouchWithinInset(\n {\n width,\n height,\n },\n normalizedHitSlop,\n event.changedTouches.at(-1)\n ) ||\n hasPassedBoundsChecks.current ||\n cancelledMidPress.current\n ) {\n cancelledMidPress.current = false;\n onEndHandlingTouchesDown.current = null;\n handlingOnTouchesDown.current = false;\n return;\n }\n\n hasPassedBoundsChecks.current = true;\n\n // In case of multiple touches, the first one starts long press gesture\n if (longPressTimeoutRef.current === null) {\n // Start long press gesture timer\n longPressTimeoutRef.current = setTimeout(\n () => activateLongPress(event),\n longPressMinDuration\n );\n }\n\n if (props.unstable_pressDelay) {\n pressDelayTimeoutRef.current = setTimeout(() => {\n pressInHandler(gestureTouchToPressableEvent(event));\n }, props.unstable_pressDelay);\n } else {\n pressInHandler(gestureTouchToPressableEvent(event));\n }\n\n onEndHandlingTouchesDown.current?.();\n onEndHandlingTouchesDown.current = null;\n handlingOnTouchesDown.current = false;\n });\n })\n .onTouchesUp((event) => {\n if (handlingOnTouchesDown.current) {\n onEndHandlingTouchesDown.current = () =>\n pressOutHandler(gestureTouchToPressableEvent(event));\n return;\n }\n // On iOS, short taps will make LongPress gesture call onTouchesUp before Native gesture calls onStart\n // This variable ensures that onStart isn't detected as the first gesture since Pressable is pressed.\n if (deferredEventPayload.current !== null) {\n shouldPreventNativeEffects.current = true;\n }\n pressOutHandler(gestureTouchToPressableEvent(event));\n })\n .onTouchesCancelled((event) => {\n isPressCallbackEnabled.current = false;\n\n if (handlingOnTouchesDown.current) {\n cancelledMidPress.current = true;\n onEndHandlingTouchesDown.current = () =>\n pressOutHandler(gestureTouchToPressableEvent(event));\n return;\n }\n\n if (\n !hasPassedBoundsChecks.current ||\n event.allTouches.length > event.changedTouches.length\n ) {\n return;\n }\n\n pressOutHandler(gestureTouchToPressableEvent(event));\n }),\n [\n activateLongPress,\n longPressMinDuration,\n normalizedHitSlop,\n pressInHandler,\n pressOutHandler,\n props.unstable_pressDelay,\n ]\n );\n\n // RNButton is placed inside ButtonGesture to enable Android's ripple and to capture non-propagating events\n const buttonGesture = useMemo(\n () =>\n Gesture.Native()\n .onBegin(() => {\n // Android sets BEGAN state on press down\n if (Platform.OS === 'android') {\n isTouchPropagationAllowed.current = true;\n }\n })\n .onStart(() => {\n if (Platform.OS === 'web') {\n isTouchPropagationAllowed.current = true;\n }\n\n // iOS sets ACTIVE state on press down\n if (Platform.OS !== 'ios') {\n return;\n }\n\n if (deferredEventPayload.current) {\n isTouchPropagationAllowed.current = true;\n\n if (hasPassedBoundsChecks.current) {\n pressInHandler(deferredEventPayload.current);\n deferredEventPayload.current = null;\n } else {\n pressOutHandler(deferredEventPayload.current);\n isTouchPropagationAllowed.current = false;\n }\n\n return;\n }\n\n if (hasPassedBoundsChecks.current) {\n isTouchPropagationAllowed.current = true;\n return;\n }\n\n if (shouldPreventNativeEffects.current) {\n shouldPreventNativeEffects.current = false;\n return;\n }\n\n isTouchPropagationAllowed.current = true;\n }),\n [pressInHandler, pressOutHandler]\n );\n\n const appliedHitSlop = addInsets(\n normalizedHitSlop,\n normalizedPressRetentionOffset\n );\n\n const isPressableEnabled = props.disabled !== true;\n\n const gestures = [pressAndTouchGesture, hoverGesture, buttonGesture];\n\n for (const gesture of gestures) {\n gesture.enabled(isPressableEnabled);\n gesture.runOnJS(true);\n gesture.hitSlop(appliedHitSlop);\n gesture.shouldCancelWhenOutside(false);\n\n if (Platform.OS !== 'web') {\n gesture.shouldCancelWhenOutside(true);\n }\n }\n\n // Uses different hitSlop, to activate on hitSlop area instead of pressRetentionOffset area\n buttonGesture.hitSlop(normalizedHitSlop);\n\n const gesture = Gesture.Simultaneous(...gestures);\n\n const defaultRippleColor = props.android_ripple ? undefined : 'transparent';\n\n // `cursor: 'pointer'` on `RNButton` crashes iOS\n const pointerStyle: StyleProp<ViewStyle> =\n Platform.OS === 'web' ? { cursor: 'pointer' } : {};\n\n const styleProp =\n typeof props.style === 'function'\n ? props.style({ pressed: pressedState })\n : props.style;\n\n const childrenProp =\n typeof props.children === 'function'\n ? props.children({ pressed: pressedState })\n : props.children;\n\n const flattenedStyles = StyleSheet.flatten(styleProp ?? {});\n\n const [innerStyles, outerStyles] = splitStyles(flattenedStyles);\n\n return (\n <View style={outerStyles}>\n <GestureDetector gesture={gesture}>\n <NativeButton\n ref={pressableRef}\n testID={props.testID}\n hitSlop={appliedHitSlop}\n enabled={isPressableEnabled}\n touchSoundDisabled={props.android_disableSound ?? undefined}\n rippleColor={processColor(\n props.android_ripple?.color ?? defaultRippleColor\n )}\n rippleRadius={props.android_ripple?.radius ?? undefined}\n style={[StyleSheet.absoluteFill, pointerStyle, innerStyles]}>\n {childrenProp}\n {__DEV__ ? (\n <PressabilityDebugView color=\"red\" hitSlop={normalizedHitSlop} />\n ) : null}\n </NativeButton>\n </GestureDetector>\n </View>\n );\n}\n"]}
1
+ {"version":3,"sources":["Pressable.tsx"],"names":["DEFAULT_LONG_PRESS_DURATION","Pressable","props","testOnly_pressed","hitSlop","pressRetentionOffset","delayHoverIn","onHoverIn","delayHoverOut","onHoverOut","delayLongPress","unstable_pressDelay","onPress","onPressIn","onPressOut","onLongPress","style","children","android_disableSound","android_ripple","disabled","remainingProps","pressedState","setPressedState","pressableRef","isPressCallbackEnabled","hasPassedBoundsChecks","shouldPreventNativeEffects","normalizedHitSlop","normalizedPressRetentionOffset","hoverInTimeout","hoverOutTimeout","hoverGesture","Gesture","Hover","manualActivation","cancelsTouchesInView","onBegin","event","current","clearTimeout","setTimeout","onFinalize","pressDelayTimeoutRef","isTouchPropagationAllowed","deferredEventPayload","pressInHandler","handlingOnTouchesDown","pressOutHandler","nativeEvent","touches","length","changedTouches","longPressTimeoutRef","onEndHandlingTouchesDown","cancelledMidPress","activateLongPress","longPressMinDuration","pressAndTouchGesture","LongPress","minDuration","INT32_MAX","maxDistance","onTouchesDown","measure","_x","_y","width","height","at","onTouchesUp","onTouchesCancelled","allTouches","buttonGesture","Native","Platform","OS","onStart","appliedHitSlop","isPressableEnabled","gestures","gesture","enabled","runOnJS","shouldCancelWhenOutside","Simultaneous","defaultRippleColor","undefined","pointerStyle","cursor","styleProp","pressed","childrenProp","color","radius","__DEV__"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAQA;;AACA;;AAOA;;AAEA;;;;;;;;;;AAEA,MAAMA,2BAA2B,GAAG,GAApC;;AAEe,SAASC,SAAT,CAAmBC,KAAnB,EAA0C;AAAA;;AACvD,QAAM;AACJC,IAAAA,gBADI;AAEJC,IAAAA,OAFI;AAGJC,IAAAA,oBAHI;AAIJC,IAAAA,YAJI;AAKJC,IAAAA,SALI;AAMJC,IAAAA,aANI;AAOJC,IAAAA,UAPI;AAQJC,IAAAA,cARI;AASJC,IAAAA,mBATI;AAUJC,IAAAA,OAVI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AAEA,oBAAF,GAA0BqE,SAL9C;AAME,IAAA,WAAW,EAAE,wDAAapE,cAAb,aAAaA,cAAb,uBAAaA,cAAc,CAAE0E,KAA7B,yEAAsCP,kBAAtC,CANf;AAOE,IAAA,YAAY,2BAAEnE,cAAF,aAAEA,cAAF,uBAAEA,cAAc,CAAE2E,MAAlB,yEAA4BP,SAP1C;AAQE,IAAA,KAAK,EAAE,CAACC,YAAD,EAAeE,SAAf;AART,MASGE,YATH,EAUGG,OAAO,gBACN,6BAAC,4CAAD;AAAuB,IAAA,KAAK,EAAC,KAA7B;AAAmC,IAAA,OAAO,EAAEnE;AAA5C,IADM,GAEJ,IAZN,CADF,CADF;AAkBD","sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { GestureObjects as Gesture } from '../../handlers/gestures/gestureObjects';\nimport { GestureDetector } from '../../handlers/gestures/GestureDetector';\nimport { PressableEvent, PressableProps } from './PressableProps';\nimport {\n Insets,\n Platform,\n StyleProp,\n View,\n ViewStyle,\n processColor,\n} from 'react-native';\nimport NativeButton from '../GestureHandlerButton';\nimport {\n numberAsInset,\n gestureToPressableEvent,\n isTouchWithinInset,\n gestureTouchToPressableEvent,\n addInsets,\n} from './utils';\nimport { PressabilityDebugView } from '../../handlers/PressabilityDebugView';\nimport { GestureTouchEvent } from '../../handlers/gestureHandlerCommon';\nimport { INT32_MAX } from '../../utils';\n\nconst DEFAULT_LONG_PRESS_DURATION = 500;\n\nexport default function Pressable(props: PressableProps) {\n const {\n testOnly_pressed,\n hitSlop,\n pressRetentionOffset,\n delayHoverIn,\n onHoverIn,\n delayHoverOut,\n onHoverOut,\n delayLongPress,\n unstable_pressDelay,\n onPress,\n onPressIn,\n onPressOut,\n onLongPress,\n style,\n children,\n android_disableSound,\n android_ripple,\n disabled,\n ...remainingProps\n } = props;\n\n const [pressedState, setPressedState] = useState(testOnly_pressed ?? false);\n\n const pressableRef = useRef<View>(null);\n\n // Disabled when onLongPress has been called\n const isPressCallbackEnabled = useRef<boolean>(true);\n const hasPassedBoundsChecks = useRef<boolean>(false);\n const shouldPreventNativeEffects = useRef<boolean>(false);\n\n const normalizedHitSlop: Insets = useMemo(\n () =>\n typeof hitSlop === 'number' ? numberAsInset(hitSlop) : hitSlop ?? {},\n [hitSlop]\n );\n\n const normalizedPressRetentionOffset: Insets = useMemo(\n () =>\n typeof pressRetentionOffset === 'number'\n ? numberAsInset(pressRetentionOffset)\n : pressRetentionOffset ?? {},\n [pressRetentionOffset]\n );\n\n const hoverInTimeout = useRef<number | null>(null);\n const hoverOutTimeout = useRef<number | null>(null);\n\n const hoverGesture = useMemo(\n () =>\n Gesture.Hover()\n .manualActivation(true) // Stops Hover from blocking Native gesture activation on web\n .cancelsTouchesInView(false)\n .onBegin((event) => {\n if (hoverOutTimeout.current) {\n clearTimeout(hoverOutTimeout.current);\n }\n if (delayHoverIn) {\n hoverInTimeout.current = setTimeout(\n () => onHoverIn?.(gestureToPressableEvent(event)),\n delayHoverIn\n );\n return;\n }\n onHoverIn?.(gestureToPressableEvent(event));\n })\n .onFinalize((event) => {\n if (hoverInTimeout.current) {\n clearTimeout(hoverInTimeout.current);\n }\n if (delayHoverOut) {\n hoverOutTimeout.current = setTimeout(\n () => onHoverOut?.(gestureToPressableEvent(event)),\n delayHoverOut\n );\n return;\n }\n onHoverOut?.(gestureToPressableEvent(event));\n }),\n [delayHoverIn, delayHoverOut, onHoverIn, onHoverOut]\n );\n\n const pressDelayTimeoutRef = useRef<number | null>(null);\n const isTouchPropagationAllowed = useRef<boolean>(false);\n\n // iOS only: due to varying flow of gestures, events sometimes have to be saved for later use\n const deferredEventPayload = useRef<PressableEvent | null>(null);\n\n const pressInHandler = useCallback(\n (event: PressableEvent) => {\n if (handlingOnTouchesDown.current) {\n deferredEventPayload.current = event;\n }\n\n if (!isTouchPropagationAllowed.current) {\n return;\n }\n\n deferredEventPayload.current = null;\n\n onPressIn?.(event);\n isPressCallbackEnabled.current = true;\n pressDelayTimeoutRef.current = null;\n setPressedState(true);\n },\n [onPressIn]\n );\n\n const pressOutHandler = useCallback(\n (event: PressableEvent) => {\n if (\n !hasPassedBoundsChecks.current ||\n event.nativeEvent.touches.length >\n event.nativeEvent.changedTouches.length\n ) {\n return;\n }\n\n if (unstable_pressDelay && pressDelayTimeoutRef.current !== null) {\n // When delay is preemptively finished by lifting touches,\n // we want to immediately activate it's effects - pressInHandler,\n // even though we are located at the pressOutHandler\n clearTimeout(pressDelayTimeoutRef.current);\n pressInHandler(event);\n }\n\n if (deferredEventPayload.current) {\n onPressIn?.(deferredEventPayload.current);\n deferredEventPayload.current = null;\n }\n\n onPressOut?.(event);\n\n if (isPressCallbackEnabled.current) {\n onPress?.(event);\n }\n\n if (longPressTimeoutRef.current) {\n clearTimeout(longPressTimeoutRef.current);\n longPressTimeoutRef.current = null;\n }\n\n isTouchPropagationAllowed.current = false;\n hasPassedBoundsChecks.current = false;\n isPressCallbackEnabled.current = true;\n setPressedState(false);\n },\n [onPress, onPressIn, onPressOut, pressInHandler, unstable_pressDelay]\n );\n\n const handlingOnTouchesDown = useRef<boolean>(false);\n const onEndHandlingTouchesDown = useRef<(() => void) | null>(null);\n const cancelledMidPress = useRef<boolean>(false);\n\n const activateLongPress = useCallback(\n (event: GestureTouchEvent) => {\n if (!isTouchPropagationAllowed.current) {\n return;\n }\n\n if (hasPassedBoundsChecks.current) {\n onLongPress?.(gestureTouchToPressableEvent(event));\n isPressCallbackEnabled.current = false;\n }\n\n if (longPressTimeoutRef.current) {\n clearTimeout(longPressTimeoutRef.current);\n longPressTimeoutRef.current = null;\n }\n },\n [onLongPress]\n );\n\n const longPressTimeoutRef = useRef<number | null>(null);\n const longPressMinDuration =\n (delayLongPress ?? DEFAULT_LONG_PRESS_DURATION) +\n (unstable_pressDelay ?? 0);\n\n const pressAndTouchGesture = useMemo(\n () =>\n Gesture.LongPress()\n .minDuration(INT32_MAX) // Stops long press from blocking native gesture\n .maxDistance(INT32_MAX) // Stops long press from cancelling after set distance\n .cancelsTouchesInView(false)\n .onTouchesDown((event) => {\n handlingOnTouchesDown.current = true;\n pressableRef.current?.measure((_x, _y, width, height) => {\n if (\n !isTouchWithinInset(\n {\n width,\n height,\n },\n normalizedHitSlop,\n event.changedTouches.at(-1)\n ) ||\n hasPassedBoundsChecks.current ||\n cancelledMidPress.current\n ) {\n cancelledMidPress.current = false;\n onEndHandlingTouchesDown.current = null;\n handlingOnTouchesDown.current = false;\n return;\n }\n\n hasPassedBoundsChecks.current = true;\n\n // In case of multiple touches, the first one starts long press gesture\n if (longPressTimeoutRef.current === null) {\n // Start long press gesture timer\n longPressTimeoutRef.current = setTimeout(\n () => activateLongPress(event),\n longPressMinDuration\n );\n }\n\n if (unstable_pressDelay) {\n pressDelayTimeoutRef.current = setTimeout(() => {\n pressInHandler(gestureTouchToPressableEvent(event));\n }, unstable_pressDelay);\n } else {\n pressInHandler(gestureTouchToPressableEvent(event));\n }\n\n onEndHandlingTouchesDown.current?.();\n onEndHandlingTouchesDown.current = null;\n handlingOnTouchesDown.current = false;\n });\n })\n .onTouchesUp((event) => {\n if (handlingOnTouchesDown.current) {\n onEndHandlingTouchesDown.current = () =>\n pressOutHandler(gestureTouchToPressableEvent(event));\n return;\n }\n // On iOS, short taps will make LongPress gesture call onTouchesUp before Native gesture calls onStart\n // This variable ensures that onStart isn't detected as the first gesture since Pressable is pressed.\n if (deferredEventPayload.current !== null) {\n shouldPreventNativeEffects.current = true;\n }\n pressOutHandler(gestureTouchToPressableEvent(event));\n })\n .onTouchesCancelled((event) => {\n isPressCallbackEnabled.current = false;\n\n if (handlingOnTouchesDown.current) {\n cancelledMidPress.current = true;\n onEndHandlingTouchesDown.current = () =>\n pressOutHandler(gestureTouchToPressableEvent(event));\n return;\n }\n\n if (\n !hasPassedBoundsChecks.current ||\n event.allTouches.length > event.changedTouches.length\n ) {\n return;\n }\n\n pressOutHandler(gestureTouchToPressableEvent(event));\n }),\n [\n activateLongPress,\n longPressMinDuration,\n normalizedHitSlop,\n pressInHandler,\n pressOutHandler,\n unstable_pressDelay,\n ]\n );\n\n // RNButton is placed inside ButtonGesture to enable Android's ripple and to capture non-propagating events\n const buttonGesture = useMemo(\n () =>\n Gesture.Native()\n .onBegin(() => {\n // Android sets BEGAN state on press down\n if (Platform.OS === 'android') {\n isTouchPropagationAllowed.current = true;\n }\n })\n .onStart(() => {\n if (Platform.OS === 'web') {\n isTouchPropagationAllowed.current = true;\n }\n\n // iOS sets ACTIVE state on press down\n if (Platform.OS !== 'ios') {\n return;\n }\n\n if (deferredEventPayload.current) {\n isTouchPropagationAllowed.current = true;\n\n if (hasPassedBoundsChecks.current) {\n pressInHandler(deferredEventPayload.current);\n deferredEventPayload.current = null;\n } else {\n pressOutHandler(deferredEventPayload.current);\n isTouchPropagationAllowed.current = false;\n }\n\n return;\n }\n\n if (hasPassedBoundsChecks.current) {\n isTouchPropagationAllowed.current = true;\n return;\n }\n\n if (shouldPreventNativeEffects.current) {\n shouldPreventNativeEffects.current = false;\n return;\n }\n\n isTouchPropagationAllowed.current = true;\n }),\n [pressInHandler, pressOutHandler]\n );\n\n const appliedHitSlop = addInsets(\n normalizedHitSlop,\n normalizedPressRetentionOffset\n );\n\n const isPressableEnabled = disabled !== true;\n\n const gestures = [pressAndTouchGesture, hoverGesture, buttonGesture];\n\n for (const gesture of gestures) {\n gesture.enabled(isPressableEnabled);\n gesture.runOnJS(true);\n gesture.hitSlop(appliedHitSlop);\n gesture.shouldCancelWhenOutside(false);\n\n if (Platform.OS !== 'web') {\n gesture.shouldCancelWhenOutside(true);\n }\n }\n\n // Uses different hitSlop, to activate on hitSlop area instead of pressRetentionOffset area\n buttonGesture.hitSlop(normalizedHitSlop);\n\n const gesture = Gesture.Simultaneous(...gestures);\n\n const defaultRippleColor = android_ripple ? undefined : 'transparent';\n\n // `cursor: 'pointer'` on `RNButton` crashes iOS\n const pointerStyle: StyleProp<ViewStyle> =\n Platform.OS === 'web' ? { cursor: 'pointer' } : {};\n\n const styleProp =\n typeof style === 'function' ? style({ pressed: pressedState }) : style;\n\n const childrenProp =\n typeof children === 'function'\n ? children({ pressed: pressedState })\n : children;\n\n return (\n <GestureDetector gesture={gesture}>\n <NativeButton\n {...remainingProps}\n ref={pressableRef}\n hitSlop={appliedHitSlop}\n enabled={isPressableEnabled}\n touchSoundDisabled={android_disableSound ?? undefined}\n rippleColor={processColor(android_ripple?.color ?? defaultRippleColor)}\n rippleRadius={android_ripple?.radius ?? undefined}\n style={[pointerStyle, styleProp]}>\n {childrenProp}\n {__DEV__ ? (\n <PressabilityDebugView color=\"red\" hitSlop={normalizedHitSlop} />\n ) : null}\n </NativeButton>\n </GestureDetector>\n );\n}\n"]}
@@ -3,12 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "PressableProps", {
7
- enumerable: true,
8
- get: function () {
9
- return _PressableProps.PressableProps;
10
- }
11
- });
12
6
  Object.defineProperty(exports, "default", {
13
7
  enumerable: true,
14
8
  get: function () {
@@ -16,8 +10,6 @@ Object.defineProperty(exports, "default", {
16
10
  }
17
11
  });
18
12
 
19
- var _PressableProps = require("./PressableProps");
20
-
21
13
  var _Pressable = _interopRequireDefault(require("./Pressable"));
22
14
 
23
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA","sourcesContent":["export { PressableProps } from './PressableProps';\nexport { default } from './Pressable';\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA","sourcesContent":["export type { PressableProps } from './PressableProps';\nexport { default } from './Pressable';\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.splitStyles = exports.gestureTouchToPressableEvent = exports.gestureToPressableEvent = exports.isTouchWithinInset = exports.addInsets = exports.numberAsInset = void 0;
6
+ exports.gestureTouchToPressableEvent = exports.gestureToPressableEvent = exports.isTouchWithinInset = exports.addInsets = exports.numberAsInset = void 0;
7
7
 
8
8
  const numberAsInset = value => ({
9
9
  left: value,
@@ -111,26 +111,4 @@ const gestureTouchToPressableEvent = event => {
111
111
  };
112
112
 
113
113
  exports.gestureTouchToPressableEvent = gestureTouchToPressableEvent;
114
- // Source:
115
- // - From ViewStyle extracted FlexStyle sub-interface which contains all of the box-model manipulating props.
116
- // - From FlexStyle handpicked those styles, which act on the inner part of the box-model.
117
- const innerStyleKeys = new Set(['alignContent', 'alignItems', 'flexBasis', 'flexDirection', 'flexWrap', 'rowGap', 'gap', 'columnGap', 'justifyContent', 'overflow', 'padding', 'paddingBottom', 'paddingEnd', 'paddingHorizontal', 'paddingLeft', 'paddingRight', 'paddingStart', 'paddingTop', 'paddingVertical', 'start', 'end', 'direction' // iOS only
118
- ]);
119
-
120
- const splitStyles = from => {
121
- const outerStyles = {};
122
- const innerStyles = {};
123
-
124
- for (const key in from) {
125
- if (innerStyleKeys.has(key)) {
126
- innerStyles[key] = from[key];
127
- } else {
128
- outerStyles[key] = from[key];
129
- }
130
- }
131
-
132
- return [innerStyles, outerStyles];
133
- };
134
-
135
- exports.splitStyles = splitStyles;
136
114
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["utils.ts"],"names":["numberAsInset","value","left","right","top","bottom","addInsets","a","b","touchDataToPressEvent","data","timestamp","targetId","identifier","id","locationX","x","locationY","y","pageX","absoluteX","pageY","absoluteY","target","touches","changedTouches","gestureToPressEvent","event","handlerTag","isTouchWithinInset","dimensions","inset","touch","width","height","gestureToPressableEvent","Date","now","pressEvent","nativeEvent","force","undefined","gestureTouchToPressableEvent","touchesList","allTouches","map","changedTouchesList","at","innerStyleKeys","Set","splitStyles","from","outerStyles","innerStyles","key","has"],"mappings":";;;;;;;AAUA,MAAMA,aAAa,GAAIC,KAAD,KAA4B;AAChDC,EAAAA,IAAI,EAAED,KAD0C;AAEhDE,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C9CD,MAAAA,WAAW,CAACC,GAAD,CAAX,GAAmBH,IAAI,CAACG,GAAD,CAAvB;AACD,KAFD,MAEO;AACLF,MAAAA,WAAW,CAACE,GAAD,CAAX,GAAmBH,IAAI,CAACG,GAAD,CAAvB;AACD;AACF;;AAED,SAAO,CAACD,WAAD,EAAcD,WAAd,CAAP;AACD,CAbD","sourcesContent":["import { Insets, ViewStyle } from 'react-native';\nimport { LongPressGestureHandlerEventPayload } from '../../handlers/GestureHandlerEventPayload';\nimport {\n TouchData,\n GestureStateChangeEvent,\n GestureTouchEvent,\n} from '../../handlers/gestureHandlerCommon';\nimport { HoverGestureHandlerEventPayload } from '../../handlers/gestures/hoverGesture';\nimport { InnerPressableEvent, PressableEvent } from './PressableProps';\n\nconst numberAsInset = (value: number): Insets => ({\n left: value,\n right: value,\n top: value,\n bottom: value,\n});\n\nconst addInsets = (a: Insets, b: Insets): Insets => ({\n left: (a.left ?? 0) + (b.left ?? 0),\n right: (a.right ?? 0) + (b.right ?? 0),\n top: (a.top ?? 0) + (b.top ?? 0),\n bottom: (a.bottom ?? 0) + (b.bottom ?? 0),\n});\n\nconst touchDataToPressEvent = (\n data: TouchData,\n timestamp: number,\n targetId: number\n): InnerPressableEvent => ({\n identifier: data.id,\n locationX: data.x,\n locationY: data.y,\n pageX: data.absoluteX,\n pageY: data.absoluteY,\n target: targetId,\n timestamp: timestamp,\n touches: [], // Always empty - legacy compatibility\n changedTouches: [], // Always empty - legacy compatibility\n});\n\nconst gestureToPressEvent = (\n event: GestureStateChangeEvent<\n HoverGestureHandlerEventPayload | LongPressGestureHandlerEventPayload\n >,\n timestamp: number,\n targetId: number\n): InnerPressableEvent => ({\n identifier: event.handlerTag,\n locationX: event.x,\n locationY: event.y,\n pageX: event.absoluteX,\n pageY: event.absoluteY,\n target: targetId,\n timestamp: timestamp,\n touches: [], // Always empty - legacy compatibility\n changedTouches: [], // Always empty - legacy compatibility\n});\n\nconst isTouchWithinInset = (\n dimensions: { width: number; height: number },\n inset: Insets,\n touch?: TouchData\n) =>\n (touch?.x ?? 0) < (inset.right ?? 0) + dimensions.width &&\n (touch?.y ?? 0) < (inset.bottom ?? 0) + dimensions.height &&\n (touch?.x ?? 0) > -(inset.left ?? 0) &&\n (touch?.y ?? 0) > -(inset.top ?? 0);\n\nconst gestureToPressableEvent = (\n event: GestureStateChangeEvent<\n HoverGestureHandlerEventPayload | LongPressGestureHandlerEventPayload\n >\n): PressableEvent => {\n const timestamp = Date.now();\n\n // As far as I can see, there isn't a conventional way of getting targetId with the data we get\n const targetId = 0;\n\n const pressEvent = gestureToPressEvent(event, timestamp, targetId);\n\n return {\n nativeEvent: {\n touches: [pressEvent],\n changedTouches: [pressEvent],\n identifier: pressEvent.identifier,\n locationX: event.x,\n locationY: event.y,\n pageX: event.absoluteX,\n pageY: event.absoluteY,\n target: targetId,\n timestamp: timestamp,\n force: undefined,\n },\n };\n};\n\nconst gestureTouchToPressableEvent = (\n event: GestureTouchEvent\n): PressableEvent => {\n const timestamp = Date.now();\n\n // As far as I can see, there isn't a conventional way of getting targetId with the data we get\n const targetId = 0;\n\n const touchesList = event.allTouches.map((touch: TouchData) =>\n touchDataToPressEvent(touch, timestamp, targetId)\n );\n const changedTouchesList = event.changedTouches.map((touch: TouchData) =>\n touchDataToPressEvent(touch, timestamp, targetId)\n );\n\n return {\n nativeEvent: {\n touches: touchesList,\n changedTouches: changedTouchesList,\n identifier: event.handlerTag,\n locationX: event.allTouches.at(0)?.x ?? -1,\n locationY: event.allTouches.at(0)?.y ?? -1,\n pageX: event.allTouches.at(0)?.absoluteX ?? -1,\n pageY: event.allTouches.at(0)?.absoluteY ?? -1,\n target: targetId,\n timestamp: timestamp,\n force: undefined,\n },\n };\n};\n\ntype StylePropKeys = (keyof ViewStyle)[];\n\n// Source:\n// - From ViewStyle extracted FlexStyle sub-interface which contains all of the box-model manipulating props.\n// - From FlexStyle handpicked those styles, which act on the inner part of the box-model.\nconst innerStyleKeys = new Set([\n 'alignContent',\n 'alignItems',\n 'flexBasis',\n 'flexDirection',\n 'flexWrap',\n 'rowGap',\n 'gap',\n 'columnGap',\n 'justifyContent',\n 'overflow',\n 'padding',\n 'paddingBottom',\n 'paddingEnd',\n 'paddingHorizontal',\n 'paddingLeft',\n 'paddingRight',\n 'paddingStart',\n 'paddingTop',\n 'paddingVertical',\n 'start',\n 'end',\n 'direction', // iOS only\n] as StylePropKeys);\n\nconst splitStyles = (from: ViewStyle): [ViewStyle, ViewStyle] => {\n const outerStyles: Record<string, unknown> = {};\n const innerStyles: Record<string, unknown> = {};\n\n for (const key in from) {\n if (innerStyleKeys.has(key as keyof ViewStyle)) {\n innerStyles[key] = from[key as keyof ViewStyle];\n } else {\n outerStyles[key] = from[key as keyof ViewStyle];\n }\n }\n\n return [innerStyles, outerStyles];\n};\n\nexport {\n numberAsInset,\n addInsets,\n isTouchWithinInset,\n gestureToPressableEvent,\n gestureTouchToPressableEvent,\n splitStyles,\n};\n"]}
1
+ {"version":3,"sources":["utils.ts"],"names":["numberAsInset","value","left","right","top","bottom","addInsets","a","b","touchDataToPressEvent","data","timestamp","targetId","identifier","id","locationX","x","locationY","y","pageX","absoluteX","pageY","absoluteY","target","touches","changedTouches","gestureToPressEvent","event","handlerTag","isTouchWithinInset","dimensions","inset","touch","width","height","gestureToPressableEvent","Date","now","pressEvent","nativeEvent","force","undefined","gestureTouchToPressableEvent","touchesList","allTouches","map","changedTouchesList","at"],"mappings":";;;;;;;AAYA,MAAMA,aAAa,GAAIC,KAAD,KAA4B;AAChDC,EAAAA,IAAI,EAAED,KAD0C;AAEhDE,EAAAA,KAAK,EAAEF,KAFyC;AAGhDG,EAAAA,GAAG,EAAEH,KAH2C;AAIhDI,EAAAA,MAAM,EAAEJ;AAJwC,CAA5B,CAAtB;;;;AAOA,MAAMK,SAAS,GAAG,CAACC,CAAD,EAAYC,CAAZ;AAAA;;AAAA,SAAmC;AACnDN,IAAAA,IAAI,EAAE,YAACK,CAAC,CAACL,IAAH,6CAAW,CAAX,g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,CAAoB,CAApB,CAAF,0DAAE,sBAAwB3B,SAA1B,2EAAuC,CAAC,CANlC;AAOXC,MAAAA,KAAK,qDAAEM,KAAK,CAACiB,UAAN,CAAiBG,EAAjB,CAAoB,CAApB,CAAF,0DAAE,sBAAwBzB,SAA1B,2EAAuC,CAAC,CAPlC;AAQXC,MAAAA,MAAM,EAAEX,QARG;AASXD,MAAAA,SAAS,EAAEA,SATA;AAUX6B,MAAAA,KAAK,EAAEC;AAVI;AADR,GAAP;AAcD,CA7BD","sourcesContent":["import { Insets } from 'react-native';\nimport {\n HoverGestureHandlerEventPayload,\n LongPressGestureHandlerEventPayload,\n} from '../../handlers/GestureHandlerEventPayload';\nimport {\n TouchData,\n GestureStateChangeEvent,\n GestureTouchEvent,\n} from '../../handlers/gestureHandlerCommon';\nimport { InnerPressableEvent, PressableEvent } from './PressableProps';\n\nconst numberAsInset = (value: number): Insets => ({\n left: value,\n right: value,\n top: value,\n bottom: value,\n});\n\nconst addInsets = (a: Insets, b: Insets): Insets => ({\n left: (a.left ?? 0) + (b.left ?? 0),\n right: (a.right ?? 0) + (b.right ?? 0),\n top: (a.top ?? 0) + (b.top ?? 0),\n bottom: (a.bottom ?? 0) + (b.bottom ?? 0),\n});\n\nconst touchDataToPressEvent = (\n data: TouchData,\n timestamp: number,\n targetId: number\n): InnerPressableEvent => ({\n identifier: data.id,\n locationX: data.x,\n locationY: data.y,\n pageX: data.absoluteX,\n pageY: data.absoluteY,\n target: targetId,\n timestamp: timestamp,\n touches: [], // Always empty - legacy compatibility\n changedTouches: [], // Always empty - legacy compatibility\n});\n\nconst gestureToPressEvent = (\n event: GestureStateChangeEvent<\n HoverGestureHandlerEventPayload | LongPressGestureHandlerEventPayload\n >,\n timestamp: number,\n targetId: number\n): InnerPressableEvent => ({\n identifier: event.handlerTag,\n locationX: event.x,\n locationY: event.y,\n pageX: event.absoluteX,\n pageY: event.absoluteY,\n target: targetId,\n timestamp: timestamp,\n touches: [], // Always empty - legacy compatibility\n changedTouches: [], // Always empty - legacy compatibility\n});\n\nconst isTouchWithinInset = (\n dimensions: { width: number; height: number },\n inset: Insets,\n touch?: TouchData\n) =>\n (touch?.x ?? 0) < (inset.right ?? 0) + dimensions.width &&\n (touch?.y ?? 0) < (inset.bottom ?? 0) + dimensions.height &&\n (touch?.x ?? 0) > -(inset.left ?? 0) &&\n (touch?.y ?? 0) > -(inset.top ?? 0);\n\nconst gestureToPressableEvent = (\n event: GestureStateChangeEvent<\n HoverGestureHandlerEventPayload | LongPressGestureHandlerEventPayload\n >\n): PressableEvent => {\n const timestamp = Date.now();\n\n // As far as I can see, there isn't a conventional way of getting targetId with the data we get\n const targetId = 0;\n\n const pressEvent = gestureToPressEvent(event, timestamp, targetId);\n\n return {\n nativeEvent: {\n touches: [pressEvent],\n changedTouches: [pressEvent],\n identifier: pressEvent.identifier,\n locationX: event.x,\n locationY: event.y,\n pageX: event.absoluteX,\n pageY: event.absoluteY,\n target: targetId,\n timestamp: timestamp,\n force: undefined,\n },\n };\n};\n\nconst gestureTouchToPressableEvent = (\n event: GestureTouchEvent\n): PressableEvent => {\n const timestamp = Date.now();\n\n // As far as I can see, there isn't a conventional way of getting targetId with the data we get\n const targetId = 0;\n\n const touchesList = event.allTouches.map((touch: TouchData) =>\n touchDataToPressEvent(touch, timestamp, targetId)\n );\n const changedTouchesList = event.changedTouches.map((touch: TouchData) =>\n touchDataToPressEvent(touch, timestamp, targetId)\n );\n\n return {\n nativeEvent: {\n touches: touchesList,\n changedTouches: changedTouchesList,\n identifier: event.handlerTag,\n locationX: event.allTouches.at(0)?.x ?? -1,\n locationY: event.allTouches.at(0)?.y ?? -1,\n pageX: event.allTouches.at(0)?.absoluteX ?? -1,\n pageY: event.allTouches.at(0)?.absoluteY ?? -1,\n target: targetId,\n timestamp: timestamp,\n force: undefined,\n },\n };\n};\n\nexport {\n numberAsInset,\n addInsets,\n isTouchWithinInset,\n gestureToPressableEvent,\n gestureTouchToPressableEvent,\n};\n"]}
@@ -19,11 +19,29 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
19
19
 
20
20
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
- // Similarily to the DrawerLayout component this deserves to be put in a
23
- // separate repo. Although, keeping it here for the time being will allow us to
24
- // move faster and fix possible issues quicker
22
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
+
25
24
  const DRAG_TOSS = 0.05;
26
25
  const Swipeable = /*#__PURE__*/(0, _react.forwardRef)(function Swipeable(props, ref) {
26
+ const {
27
+ leftThreshold,
28
+ rightThreshold,
29
+ onSwipeableOpenStartDrag,
30
+ onSwipeableCloseStartDrag,
31
+ enableTrackpadTwoFingerGesture,
32
+ enabled,
33
+ containerStyle,
34
+ childrenContainerStyle,
35
+ animationOptions,
36
+ overshootLeft,
37
+ overshootRight,
38
+ onSwipeableWillOpen,
39
+ onSwipeableWillClose,
40
+ onSwipeableOpen,
41
+ onSwipeableClose,
42
+ testID,
43
+ ...remainingProps
44
+ } = props;
27
45
  const rowState = (0, _reactNativeReanimated.useSharedValue)(0);
28
46
  const userDrag = (0, _reactNativeReanimated.useSharedValue)(0);
29
47
  const appliedTranslation = (0, _reactNativeReanimated.useSharedValue)(0);
@@ -57,8 +75,8 @@ const Swipeable = /*#__PURE__*/(0, _react.forwardRef)(function Swipeable(props,
57
75
  friction = defaultProps.friction,
58
76
  overshootFriction = defaultProps.overshootFriction
59
77
  } = props;
60
- const overshootLeftProp = props.overshootLeft;
61
- const overshootRightProp = props.overshootRight;
78
+ const overshootLeftProp = overshootLeft;
79
+ const overshootRightProp = overshootRight;
62
80
  const calculateCurrentOffset = (0, _react.useCallback)(() => {
63
81
  'worklet';
64
82
 
@@ -87,31 +105,31 @@ const Swipeable = /*#__PURE__*/(0, _react.forwardRef)(function Swipeable(props,
87
105
  };
88
106
 
89
107
  const dispatchImmediateEvents = (0, _react.useCallback)((fromValue, toValue) => {
90
- if (toValue > 0 && props.onSwipeableWillOpen) {
91
- props.onSwipeableWillOpen('left');
92
- } else if (toValue < 0 && props.onSwipeableWillOpen) {
93
- props.onSwipeableWillOpen('right');
94
- } else if (props.onSwipeableWillClose) {
108
+ if (toValue > 0 && onSwipeableWillOpen) {
109
+ onSwipeableWillOpen('left');
110
+ } else if (toValue < 0 && onSwipeableWillOpen) {
111
+ onSwipeableWillOpen('right');
112
+ } else if (onSwipeableWillClose) {
95
113
  const closingDirection = fromValue > 0 ? 'left' : 'right';
96
- props.onSwipeableWillClose(closingDirection);
114
+ onSwipeableWillClose(closingDirection);
97
115
  }
98
- }, [props, props.onSwipeableWillClose, props.onSwipeableWillOpen, swipeableMethods]);
116
+ }, [onSwipeableWillClose, onSwipeableWillOpen]);
99
117
  const dispatchEndEvents = (0, _react.useCallback)((fromValue, toValue) => {
100
- if (toValue > 0 && props.onSwipeableOpen) {
101
- props.onSwipeableOpen('left', swipeableMethods.current);
102
- } else if (toValue < 0 && props.onSwipeableOpen) {
103
- props.onSwipeableOpen('right', swipeableMethods.current);
104
- } else if (props.onSwipeableClose) {
118
+ if (toValue > 0 && onSwipeableOpen) {
119
+ onSwipeableOpen('left', swipeableMethods.current);
120
+ } else if (toValue < 0 && onSwipeableOpen) {
121
+ onSwipeableOpen('right', swipeableMethods.current);
122
+ } else if (onSwipeableClose) {
105
123
  const closingDirection = fromValue > 0 ? 'left' : 'right';
106
- props.onSwipeableClose(closingDirection, swipeableMethods.current);
124
+ onSwipeableClose(closingDirection, swipeableMethods.current);
107
125
  }
108
- }, [props, props.onSwipeableClose, props.onSwipeableOpen, swipeableMethods]);
109
- const animationOptionsProp = props.animationOptions;
126
+ }, [onSwipeableClose, onSwipeableOpen]);
127
+ const animationOptionsProp = animationOptions;
110
128
  const animateRow = (0, _react.useCallback)((fromValue, toValue, velocityX) => {
111
129
  'worklet';
112
130
 
113
131
  rowState.value = Math.sign(toValue);
114
- const springConfig = {
132
+ const translationSpringConfig = {
115
133
  duration: 1000,
116
134
  dampingRatio: 0.9,
117
135
  stiffness: 500,
@@ -119,18 +137,19 @@ const Swipeable = /*#__PURE__*/(0, _react.forwardRef)(function Swipeable(props,
119
137
  overshootClamping: true,
120
138
  ...animationOptionsProp
121
139
  };
122
- appliedTranslation.value = (0, _reactNativeReanimated.withSpring)(toValue, springConfig, isFinished => {
140
+ const progressSpringConfig = { ...translationSpringConfig,
141
+ velocity: 0
142
+ };
143
+ appliedTranslation.value = (0, _reactNativeReanimated.withSpring)(toValue, translationSpringConfig, isFinished => {
123
144
  if (isFinished) {
124
145
  (0, _reactNativeReanimated.runOnJS)(dispatchEndEvents)(fromValue, toValue);
125
146
  }
126
147
  });
127
- const progressTarget = toValue === 0 ? 0 : 1; // Velocity is in px, while progress is in %
128
-
129
- springConfig.velocity = 0;
130
- showLeftProgress.value = leftWidth.value > 0 ? (0, _reactNativeReanimated.withSpring)(progressTarget, springConfig) : 0;
131
- showRightProgress.value = rightWidth.value > 0 ? (0, _reactNativeReanimated.withSpring)(progressTarget, springConfig) : 0;
148
+ const progressTarget = toValue === 0 ? 0 : 1;
149
+ showLeftProgress.value = leftWidth.value > 0 ? (0, _reactNativeReanimated.withSpring)(progressTarget, progressSpringConfig) : 0;
150
+ showRightProgress.value = rightWidth.value > 0 ? (0, _reactNativeReanimated.withSpring)(progressTarget, progressSpringConfig) : 0;
132
151
  (0, _reactNativeReanimated.runOnJS)(dispatchImmediateEvents)(fromValue, toValue);
133
- }, [showLeftProgress, appliedTranslation, dispatchEndEvents, dispatchImmediateEvents, animationOptionsProp, rowState]);
152
+ }, [rowState, animationOptionsProp, appliedTranslation, showLeftProgress, leftWidth.value, showRightProgress, rightWidth.value, dispatchImmediateEvents, dispatchEndEvents]);
134
153
 
135
154
  const onRowLayout = ({
136
155
  nativeEvent
@@ -203,8 +222,8 @@ const Swipeable = /*#__PURE__*/(0, _react.forwardRef)(function Swipeable(props,
203
222
  }) => rightOffset.value = nativeEvent.layout.x
204
223
  }));
205
224
 
206
- const leftThresholdProp = props.leftThreshold;
207
- const rightThresholdProp = props.rightThreshold;
225
+ const leftThresholdProp = leftThreshold;
226
+ const rightThresholdProp = rightThreshold;
208
227
 
209
228
  const handleRelease = event => {
210
229
  'worklet';
@@ -253,9 +272,6 @@ const Swipeable = /*#__PURE__*/(0, _react.forwardRef)(function Swipeable(props,
253
272
  }
254
273
  });
255
274
 
256
- const onSwipeableOpenStartDrag = props.onSwipeableOpenStartDrag;
257
- const onSwipeableCloseStartDrag = props.onSwipeableCloseStartDrag;
258
-
259
275
  const panGesture = _gestureObjects.GestureObjects.Pan().onUpdate(event => {
260
276
  userDrag.value = event.translationX;
261
277
  const direction = rowState.value === -1 ? 'right' : rowState.value === 1 ? 'left' : event.translationX > 0 ? 'left' : 'right';
@@ -271,34 +287,37 @@ const Swipeable = /*#__PURE__*/(0, _react.forwardRef)(function Swipeable(props,
271
287
  handleRelease(event);
272
288
  });
273
289
 
274
- if (props.enableTrackpadTwoFingerGesture) {
275
- panGesture.enableTrackpadTwoFingerGesture(props.enableTrackpadTwoFingerGesture);
290
+ if (enableTrackpadTwoFingerGesture) {
291
+ panGesture.enableTrackpadTwoFingerGesture(enableTrackpadTwoFingerGesture);
276
292
  }
277
293
 
278
294
  panGesture.activeOffsetX([-dragOffsetFromRightEdge, dragOffsetFromLeftEdge]);
279
295
  tapGesture.shouldCancelWhenOutside(true);
280
296
  (0, _react.useImperativeHandle)(ref, () => swipeableMethods.current, [swipeableMethods]);
281
- panGesture.enabled(props.enabled !== false);
297
+ panGesture.enabled(enabled !== false);
282
298
  const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
283
299
  transform: [{
284
300
  translateX: appliedTranslation.value
285
301
  }],
286
302
  pointerEvents: rowState.value === 0 ? 'auto' : 'box-only'
287
303
  }), [appliedTranslation, rowState]);
288
- const containerStyle = props.containerStyle;
289
- const childrenContainerStyle = props.childrenContainerStyle;
290
- return /*#__PURE__*/_react.default.createElement(_GestureDetector.GestureDetector, {
304
+
305
+ const swipeableComponent = /*#__PURE__*/_react.default.createElement(_GestureDetector.GestureDetector, {
291
306
  gesture: panGesture,
292
307
  touchAction: "pan-y"
293
- }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
308
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, _extends({}, remainingProps, {
294
309
  onLayout: onRowLayout,
295
310
  style: [styles.container, containerStyle]
296
- }, leftElement, rightElement, /*#__PURE__*/_react.default.createElement(_GestureDetector.GestureDetector, {
311
+ }), leftElement, rightElement, /*#__PURE__*/_react.default.createElement(_GestureDetector.GestureDetector, {
297
312
  gesture: tapGesture,
298
313
  touchAction: "pan-y"
299
314
  }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
300
315
  style: [animatedStyle, childrenContainerStyle]
301
316
  }, children))));
317
+
318
+ return testID ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
319
+ testID: testID
320
+ }, swipeableComponent) : swipeableComponent;
302
321
  });
303
322
  var _default = Swipeable;
304
323
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["ReanimatedSwipeable.tsx"],"names":["DRAG_TOSS","Swipeable","props","ref","rowState","userDrag","appliedTranslation","rowWidth","leftWidth","rightWidth","rightOffset","leftActionTranslate","rightActionTranslate","showLeftProgress","showRightProgress","swipeableMethods","close","openLeft","openRight","reset","defaultProps","friction","overshootFriction","overshootLeftProp","overshootLeft","overshootRightProp","overshootRight","calculateCurrentOffset","value","updateAnimatedEvent","Math","max","startOffset","offsetDrag","Number","MIN_VALUE","Extrapolation","CLAMP","dispatchImmediateEvents","fromValue","toValue","onSwipeableWillOpen","onSwipeableWillClose","closingDirection","dispatchEndEvents","onSwipeableOpen","current","onSwipeableClose","animationOptionsProp","animationOptions","animateRow","velocityX","sign","springConfig","duration","dampingRatio","stiffness","velocity","overshootClamping","isFinished","progressTarget","onRowLayout","nativeEvent","layout","width","children","renderLeftActions","renderRightActions","dragOffsetFromLeftEdge","dragOffsetFromRightEdge","leftAnimatedStyle","transform","translateX","leftElement","styles","leftActions","x","rightAnimatedStyle","rightElement","rightActions","leftThresholdProp","leftThreshold","rightThresholdProp","rightThreshold","handleRelease","event","translationX","startOffsetX","tapGesture","Gesture","Tap","onStart","onSwipeableOpenStartDrag","onSwipeableCloseStartDrag","panGesture","Pan","onUpdate","direction","onEnd","enableTrackpadTwoFingerGesture","activeOffsetX","shouldCancelWhenOutside","enabled","animatedStyle","pointerEvents","containerStyle","childrenContainerStyle","container","StyleSheet","create","overflow","absoluteFillObject","flexDirection","I18nManager","isRTL"],"mappings":";;;;;;;AAIA;;AAOA;;AACA;;AAOA;;AASA;;;;;;AA5BA;AACA;AACA;AAmCA,MAAMA,SAAS,GAAG,IAAlB;AA+JA,MAAMC,SAAS,gBAAG,uBAChB,SAASA,SAAT,CACEC,KADF,EAEEC,GAFF,EAGE;AACA,QAAMC,QAAQ,GAAG,2CAAuB,CAAvB,CAAjB;AAEA,QAAMC,QAAQ,GAAG,2CAAuB,CAAvB,CAAjB;AACA,QAAMC,kBAAkB,GAAG,2CAAuB,CAAvB,CAA3B;AAEA,QAAMC,QAAQ,GAAG,2CAAuB,CAAvB,CAAjB;AACA,QAAMC,SAAS,GAAG,2CAAuB,CAAvB,CAAlB;AACA,QAAMC,UAAU,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;AARiB,CAAlB,CAAf","sourcesContent":["// Similarily to the DrawerLayout component this deserves to be put in a\n// separate repo. Although, keeping it here for the time being will allow us to\n// move faster and fix possible issues quicker\n\nimport React, {\n ForwardedRef,\n forwardRef,\n useCallback,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { GestureObjects as Gesture } from '../handlers/gestures/gestureObjects';\nimport { GestureDetector } from '../handlers/gestures/GestureDetector';\nimport {\n GestureStateChangeEvent,\n GestureUpdateEvent,\n} from '../handlers/gestureHandlerCommon';\nimport type { PanGestureHandlerProps } from '../handlers/PanGestureHandler';\nimport type { PanGestureHandlerEventPayload } from '../handlers/GestureHandlerEventPayload';\nimport Animated, {\n Extrapolation,\n SharedValue,\n interpolate,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withSpring,\n} from 'react-native-reanimated';\nimport {\n I18nManager,\n LayoutChangeEvent,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native';\n\nconst DRAG_TOSS = 0.05;\n\ntype SwipeableExcludes = Exclude<\n keyof PanGestureHandlerProps,\n 'onGestureEvent' | 'onHandlerStateChange'\n>;\n\nexport interface SwipeableProps\n extends Pick<PanGestureHandlerProps, SwipeableExcludes> {\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 /**\n * Specifies how much the visual interaction will be delayed compared to the\n * gesture distance. e.g. value of 1 will indicate that the swipeable panel\n * should exactly follow the gesture, 2 means it is going to be two times\n * \"slower\".\n */\n friction?: number;\n\n /**\n * Distance from the left edge at which released panel will animate to the\n * open state (or the open panel will animate into the closed state). By\n * default it's a half of the panel's width.\n */\n leftThreshold?: number;\n\n /**\n * Distance from the right edge at which released panel will animate to the\n * open state (or the open panel will animate into the closed state). By\n * default it's a half of the panel's width.\n */\n rightThreshold?: number;\n\n /**\n * Distance that the panel must be dragged from the left edge to be considered\n * a swipe. The default value is 10.\n */\n dragOffsetFromLeftEdge?: number;\n\n /**\n * Distance that the panel must be dragged from the right edge to be considered\n * a swipe. The default value is 10.\n */\n dragOffsetFromRightEdge?: number;\n\n /**\n * Value indicating if the swipeable panel can be pulled further than the left\n * actions panel's width. It is set to true by default as long as the left\n * panel render method is present.\n */\n overshootLeft?: boolean;\n\n /**\n * Value indicating if the swipeable panel can be pulled further than the\n * right actions panel's width. It is set to true by default as long as the\n * right panel render method is present.\n */\n overshootRight?: boolean;\n\n /**\n * Specifies how much the visual interaction will be delayed compared to the\n * gesture distance at overshoot. Default value is 1, it mean no friction, for\n * a native feel, try 8 or above.\n */\n overshootFriction?: number;\n\n /**\n * Called when action panel gets open (either right or left).\n */\n onSwipeableOpen?: (\n direction: 'left' | 'right',\n swipeable: SwipeableMethods\n ) => void;\n\n /**\n * Called when action panel is closed.\n */\n onSwipeableClose?: (\n direction: 'left' | 'right',\n swipeable: SwipeableMethods\n ) => void;\n\n /**\n * Called when action panel starts animating on open (either right or left).\n */\n onSwipeableWillOpen?: (direction: 'left' | 'right') => void;\n\n /**\n * Called when action panel starts animating on close.\n */\n onSwipeableWillClose?: (direction: 'left' | 'right') => void;\n\n /**\n * Called when action panel starts being shown on dragging to open.\n */\n onSwipeableOpenStartDrag?: (direction: 'left' | 'right') => void;\n\n /**\n * Called when action panel starts being shown on dragging to close.\n */\n onSwipeableCloseStartDrag?: (direction: 'left' | 'right') => void;\n\n /**\n *\n * This map describes the values to use as inputRange for extra interpolation:\n * AnimatedValue: [startValue, endValue]\n *\n * progressAnimatedValue: [0, 1] dragAnimatedValue: [0, +]\n *\n * To support `rtl` flexbox layouts use `flexDirection` styling.\n * */\n renderLeftActions?: (\n progressAnimatedValue: SharedValue<number>,\n dragAnimatedValue: SharedValue<number>,\n swipeable: SwipeableMethods\n ) => React.ReactNode;\n /**\n *\n * This map describes the values to use as inputRange for extra interpolation:\n * AnimatedValue: [startValue, endValue]\n *\n * progressAnimatedValue: [0, 1] dragAnimatedValue: [0, -]\n *\n * To support `rtl` flexbox layouts use `flexDirection` styling.\n * */\n renderRightActions?: (\n progressAnimatedValue: SharedValue<number>,\n dragAnimatedValue: SharedValue<number>,\n swipeable: SwipeableMethods\n ) => React.ReactNode;\n\n animationOptions?: Record<string, unknown>;\n\n /**\n * Style object for the container (`Animated.View`), for example to override\n * `overflow: 'hidden'`.\n */\n containerStyle?: StyleProp<ViewStyle>;\n\n /**\n * Style object for the children container (`Animated.View`), for example to\n * apply `flex: 1`\n */\n childrenContainerStyle?: StyleProp<ViewStyle>;\n}\n\nexport interface SwipeableMethods {\n close: () => void;\n openLeft: () => void;\n openRight: () => void;\n reset: () => void;\n}\n\nconst Swipeable = forwardRef<SwipeableMethods, SwipeableProps>(\n function Swipeable(\n props: SwipeableProps,\n ref: ForwardedRef<SwipeableMethods>\n ) {\n const rowState = useSharedValue<number>(0);\n\n const userDrag = useSharedValue<number>(0);\n const appliedTranslation = useSharedValue<number>(0);\n\n const rowWidth = useSharedValue<number>(0);\n const leftWidth = useSharedValue<number>(0);\n const rightWidth = useSharedValue<number>(0);\n const rightOffset = useSharedValue<number>(0);\n\n const leftActionTranslate = useSharedValue<number>(0);\n const rightActionTranslate = useSharedValue<number>(0);\n\n const showLeftProgress = useSharedValue<number>(0);\n const showRightProgress = useSharedValue<number>(0);\n\n const swipeableMethods = useRef<SwipeableMethods>({\n close: () => {\n 'worklet';\n },\n openLeft: () => {\n 'worklet';\n },\n openRight: () => {\n 'worklet';\n },\n reset: () => {\n 'worklet';\n },\n });\n\n const defaultProps = {\n friction: 1,\n overshootFriction: 1,\n };\n\n const {\n friction = defaultProps.friction,\n overshootFriction = defaultProps.overshootFriction,\n } = props;\n\n const overshootLeftProp = props.overshootLeft;\n const overshootRightProp = props.overshootRight;\n\n const calculateCurrentOffset = useCallback(() => {\n 'worklet';\n if (rowState.value === 1) {\n return leftWidth.value;\n } else if (rowState.value === -1) {\n return -rowWidth.value - rightOffset.value;\n }\n return 0;\n }, [leftWidth, rightOffset, rowState, rowWidth]);\n\n const updateAnimatedEvent = () => {\n 'worklet';\n rightWidth.value = Math.max(0, rowWidth.value - rightOffset.value);\n\n const overshootLeft = overshootLeftProp ?? leftWidth.value > 0;\n const overshootRight = overshootRightProp ?? rightWidth.value > 0;\n\n const startOffset =\n rowState.value === 1\n ? leftWidth.value\n : rowState.value === -1\n ? -rightWidth.value\n : 0;\n\n const offsetDrag = userDrag.value / friction + startOffset;\n\n appliedTranslation.value = interpolate(\n offsetDrag,\n [\n -rightWidth.value - 1,\n -rightWidth.value,\n leftWidth.value,\n leftWidth.value + 1,\n ],\n [\n -rightWidth.value - (overshootRight ? 1 / overshootFriction : 0),\n -rightWidth.value,\n leftWidth.value,\n leftWidth.value + (overshootLeft ? 1 / overshootFriction : 0),\n ]\n );\n\n showLeftProgress.value =\n leftWidth.value > 0\n ? interpolate(\n appliedTranslation.value,\n [-1, 0, leftWidth.value],\n [0, 0, 1]\n )\n : 0;\n leftActionTranslate.value = interpolate(\n showLeftProgress.value,\n [0, Number.MIN_VALUE],\n [-10000, 0],\n Extrapolation.CLAMP\n );\n showRightProgress.value =\n rightWidth.value > 0\n ? interpolate(\n appliedTranslation.value,\n [-rightWidth.value, 0, 1],\n [1, 0, 0]\n )\n : 0;\n rightActionTranslate.value = interpolate(\n showRightProgress.value,\n [0, Number.MIN_VALUE],\n [-10000, 0],\n Extrapolation.CLAMP\n );\n };\n\n const dispatchImmediateEvents = useCallback(\n (fromValue: number, toValue: number) => {\n if (toValue > 0 && props.onSwipeableWillOpen) {\n props.onSwipeableWillOpen('left');\n } else if (toValue < 0 && props.onSwipeableWillOpen) {\n props.onSwipeableWillOpen('right');\n } else if (props.onSwipeableWillClose) {\n const closingDirection = fromValue > 0 ? 'left' : 'right';\n props.onSwipeableWillClose(closingDirection);\n }\n },\n [\n props,\n props.onSwipeableWillClose,\n props.onSwipeableWillOpen,\n swipeableMethods,\n ]\n );\n\n const dispatchEndEvents = useCallback(\n (fromValue: number, toValue: number) => {\n if (toValue > 0 && props.onSwipeableOpen) {\n props.onSwipeableOpen('left', swipeableMethods.current);\n } else if (toValue < 0 && props.onSwipeableOpen) {\n props.onSwipeableOpen('right', swipeableMethods.current);\n } else if (props.onSwipeableClose) {\n const closingDirection = fromValue > 0 ? 'left' : 'right';\n props.onSwipeableClose(closingDirection, swipeableMethods.current);\n }\n },\n [props, props.onSwipeableClose, props.onSwipeableOpen, swipeableMethods]\n );\n\n const animationOptionsProp = props.animationOptions;\n\n const animateRow = useCallback(\n (fromValue: number, toValue: number, velocityX?: number) => {\n 'worklet';\n rowState.value = Math.sign(toValue);\n\n const springConfig = {\n duration: 1000,\n dampingRatio: 0.9,\n stiffness: 500,\n velocity: velocityX,\n overshootClamping: true,\n ...animationOptionsProp,\n };\n\n appliedTranslation.value = withSpring(\n toValue,\n springConfig,\n (isFinished) => {\n if (isFinished) {\n runOnJS(dispatchEndEvents)(fromValue, toValue);\n }\n }\n );\n\n const progressTarget = toValue === 0 ? 0 : 1;\n\n // Velocity is in px, while progress is in %\n springConfig.velocity = 0;\n\n showLeftProgress.value =\n leftWidth.value > 0 ? withSpring(progressTarget, springConfig) : 0;\n showRightProgress.value =\n rightWidth.value > 0 ? withSpring(progressTarget, springConfig) : 0;\n\n runOnJS(dispatchImmediateEvents)(fromValue, toValue);\n },\n [\n showLeftProgress,\n appliedTranslation,\n dispatchEndEvents,\n dispatchImmediateEvents,\n animationOptionsProp,\n rowState,\n ]\n );\n\n const onRowLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n rowWidth.value = nativeEvent.layout.width;\n };\n\n const {\n children,\n renderLeftActions,\n renderRightActions,\n dragOffsetFromLeftEdge = 10,\n dragOffsetFromRightEdge = 10,\n } = props;\n\n swipeableMethods.current = {\n close() {\n 'worklet';\n animateRow(calculateCurrentOffset(), 0);\n },\n openLeft() {\n 'worklet';\n animateRow(calculateCurrentOffset(), leftWidth.value);\n },\n openRight() {\n 'worklet';\n rightWidth.value = rowWidth.value - rightOffset.value;\n animateRow(calculateCurrentOffset(), -rightWidth.value);\n },\n reset() {\n 'worklet';\n userDrag.value = 0;\n showLeftProgress.value = 0;\n appliedTranslation.value = 0;\n rowState.value = 0;\n },\n };\n\n const leftAnimatedStyle = useAnimatedStyle(\n () => ({\n transform: [\n {\n translateX: leftActionTranslate.value,\n },\n ],\n }),\n [leftActionTranslate]\n );\n\n const leftElement = renderLeftActions && (\n <Animated.View style={[styles.leftActions, leftAnimatedStyle]}>\n {renderLeftActions(\n showLeftProgress,\n appliedTranslation,\n swipeableMethods.current\n )}\n <View\n onLayout={({ nativeEvent }) =>\n (leftWidth.value = nativeEvent.layout.x)\n }\n />\n </Animated.View>\n );\n\n const rightAnimatedStyle = useAnimatedStyle(\n () => ({\n transform: [\n {\n translateX: rightActionTranslate.value,\n },\n ],\n }),\n [rightActionTranslate]\n );\n\n const rightElement = renderRightActions && (\n <Animated.View style={[styles.rightActions, rightAnimatedStyle]}>\n {renderRightActions(\n showRightProgress,\n appliedTranslation,\n swipeableMethods.current\n )}\n <View\n onLayout={({ nativeEvent }) =>\n (rightOffset.value = nativeEvent.layout.x)\n }\n />\n </Animated.View>\n );\n\n const leftThresholdProp = props.leftThreshold;\n const rightThresholdProp = props.rightThreshold;\n\n const handleRelease = (\n event: GestureStateChangeEvent<PanGestureHandlerEventPayload>\n ) => {\n 'worklet';\n const { velocityX } = event;\n userDrag.value = event.translationX;\n\n rightWidth.value = rowWidth.value - rightOffset.value;\n\n const leftThreshold = leftThresholdProp ?? leftWidth.value / 2;\n const rightThreshold = rightThresholdProp ?? rightWidth.value / 2;\n\n const startOffsetX = calculateCurrentOffset() + userDrag.value / friction;\n const translationX = (userDrag.value + DRAG_TOSS * velocityX) / friction;\n\n let toValue = 0;\n\n if (rowState.value === 0) {\n if (translationX > leftThreshold) {\n toValue = leftWidth.value;\n } else if (translationX < -rightThreshold) {\n toValue = -rightWidth.value;\n }\n } else if (rowState.value === 1) {\n // Swiped to left\n if (translationX > -leftThreshold) {\n toValue = leftWidth.value;\n }\n } else {\n // Swiped to right\n if (translationX < rightThreshold) {\n toValue = -rightWidth.value;\n }\n }\n\n animateRow(startOffsetX, toValue, velocityX / friction);\n };\n\n const close = () => {\n 'worklet';\n animateRow(calculateCurrentOffset(), 0);\n };\n\n const tapGesture = Gesture.Tap().onStart(() => {\n if (rowState.value !== 0) {\n close();\n }\n });\n\n const onSwipeableOpenStartDrag = props.onSwipeableOpenStartDrag;\n const onSwipeableCloseStartDrag = props.onSwipeableCloseStartDrag;\n\n const panGesture = Gesture.Pan()\n .onUpdate((event: GestureUpdateEvent<PanGestureHandlerEventPayload>) => {\n userDrag.value = event.translationX;\n\n const direction =\n rowState.value === -1\n ? 'right'\n : rowState.value === 1\n ? 'left'\n : event.translationX > 0\n ? 'left'\n : 'right';\n\n if (rowState.value === 0 && onSwipeableOpenStartDrag) {\n runOnJS(onSwipeableOpenStartDrag)(direction);\n } else if (rowState.value !== 0 && onSwipeableCloseStartDrag) {\n runOnJS(onSwipeableCloseStartDrag)(direction);\n }\n updateAnimatedEvent();\n })\n .onEnd(\n (event: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => {\n handleRelease(event);\n }\n );\n\n if (props.enableTrackpadTwoFingerGesture) {\n panGesture.enableTrackpadTwoFingerGesture(\n props.enableTrackpadTwoFingerGesture\n );\n }\n\n panGesture.activeOffsetX([\n -dragOffsetFromRightEdge,\n dragOffsetFromLeftEdge,\n ]);\n tapGesture.shouldCancelWhenOutside(true);\n\n useImperativeHandle(ref, () => swipeableMethods.current, [\n swipeableMethods,\n ]);\n\n panGesture.enabled(props.enabled !== false);\n\n const animatedStyle = useAnimatedStyle(\n () => ({\n transform: [{ translateX: appliedTranslation.value }],\n pointerEvents: rowState.value === 0 ? 'auto' : 'box-only',\n }),\n [appliedTranslation, rowState]\n );\n\n const containerStyle = props.containerStyle;\n const childrenContainerStyle = props.childrenContainerStyle;\n\n return (\n <GestureDetector gesture={panGesture} touchAction=\"pan-y\">\n <Animated.View\n onLayout={onRowLayout}\n style={[styles.container, containerStyle]}>\n {leftElement}\n {rightElement}\n <GestureDetector gesture={tapGesture} touchAction=\"pan-y\">\n <Animated.View style={[animatedStyle, childrenContainerStyle]}>\n {children}\n </Animated.View>\n </GestureDetector>\n </Animated.View>\n </GestureDetector>\n );\n }\n);\n\nexport default Swipeable;\nexport type SwipeableRef = ForwardedRef<SwipeableMethods>;\n\nconst styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n },\n leftActions: {\n ...StyleSheet.absoluteFillObject,\n flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row',\n },\n rightActions: {\n ...StyleSheet.absoluteFillObject,\n flexDirection: I18nManager.isRTL ? 'row' : 'row-reverse',\n },\n});\n"]}
1
+ {"version":3,"sources":["ReanimatedSwipeable.tsx"],"names":["DRAG_TOSS","Swipeable","props","ref","leftThreshold","rightThreshold","onSwipeableOpenStartDrag","onSwipeableCloseStartDrag","enableTrackpadTwoFingerGesture","enabled","containerStyle","childrenContainerStyle","animationOptions","overshootLeft","overshootRight","onSwipeableWillOpen","onSwipeableWillClose","onSwipeableOpen","onSwipeableClose","testID","remainingProps","rowState","userDrag","appliedTranslation","rowWidth","leftWidth","rightWidth","rightOffset","leftActionTranslate","rightActionTranslate","showLeftProgress","showRightProgress","swipeableMethods","close","openLeft","openRight","reset","defaultProps","friction","overshootFriction","overshootLeftProp","overshootRightProp","calculateCurrentOffset","value","updateAnimatedEvent","Math","max","startOffset","offsetDrag","Number","MIN_VALUE","Extrapolation","CLAMP","dispatchImmediateEvents","fromValue","toValue","closingDirection","dispatchEndEvents","current","animationOptionsProp","animateRow","velocityX","sign","translationSpringConfig","duration","dampingRatio","stiffness","velocity","overshootClamping","progressSpringConfig","isFinished","progressTarget","onRowLayout","nativeEvent","layout","width","children","renderLeftActions","renderRightActions","dragOffsetFromLeftEdge","dragOffsetFromRightEdge","leftAnimatedStyle","transform","translateX","leftElement","styles","leftActions","x","rightAnimatedStyle","rightElement","rightActions","leftThresholdProp","rightThresholdProp","handleRelease","event","translationX","startOffsetX","tapGesture","Gesture","Tap","onStart","panGesture","Pan","onUpdate","direction","onEnd","activeOffsetX","shouldCancelWhenOutside","animatedStyle","pointerEvents","swipeableComponent","container","StyleSheet","create","overflow","absoluteFillObject","flexDirection","I18nManager","isRTL"],"mappings":";;;;;;;AAIA;;AAOA;;AACA;;AAOA;;AASA;;;;;;;;AASA,MAAMA,SAAS,GAAG,IAAlB;AA+JA,MAAMC,SAAS,gBAAG,uBAChB,SAASA,SAAT,CACEC,KADF,EAEEC,GAFF,EAGE;AACA,QAAM;AACJC,IAAAA,aADI;AAEJC,IAAAA,cAFI;AAGJC,IAAAA,wBAHI;AAIJC,IAAAA,yBAJI;AAKJC,IAAAA,8BALI;AAMJC,IAAAA,OANI;AAOJC,IAAAA,cAPI;AAQJC,IAAAA,sBARI;AASJC,IAAAA,gBATI;AAUJC,IAAAA,aAVI;AAWJC,IAAAA,cAXI;AAYJC,IAAAA,mBAZI;AAaJC,IAAAA,oBAbI;AAcJC,IAAAA,eAdI;AAeJC,IAAAA,gBAfI;AAgBJC,IAAAA,MAhBI;AAiBJ,OAAGC;AAjBC,MAkBFlB,KAlBJ;AAoBA,QAAMmB,QAAQ,GAAG,2CAAuB,CAAvB,CAAjB;AAEA,QAAMC,QAAQ,GAAG,2CAAuB,CAAvB,CAAjB;AACA,QAAMC,kBAAkB,GAAG,2CAAuB,CAAvB,CAA3B;AAEA,QAAMC,QAAQ,GAAG,2CAAuB,CAAvB,CAAjB;AACA,QAAMC,SAAS,GAAG,2CAAuB,CAAvB,CAAlB;AACA,QAAMC,UAAU,GAAG,2CAAuB,CAAvB,CAAnB;AACA,QAAMC,WAAW,GAAG,2CAAuB,CAAvB,CAApB;AAEA,QAAMC,mBAAmB,GAAG,2CAAuB,CAAvB,CAA5B;AACA,QAAMC,oBAAoB,GAAG,2CAAuB,CAAvB,CAA7B;AAEA,QAAMC,gBAAgB,GAAG,2CAAuB,CA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,EAAEQ,UAA1B;AAAsC,IAAA,WAAW,EAAC;AAAlD,kBACE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,CAACW,aAAD,EAAgBjG,sBAAhB;AAAtB,KACGiE,QADH,CADF,CANF,CADF,CADF;;AAiBA,SAAOzD,MAAM,gBACX,6BAAC,iBAAD;AAAM,IAAA,MAAM,EAAEA;AAAd,KAAuB2F,kBAAvB,CADW,GAGXA,kBAHF;AAKD,CArbe,CAAlB;eAwbe7G,S;;;AAGf,MAAMoF,MAAM,GAAG2B,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,SAAS,EAAE;AACTG,IAAAA,QAAQ,EAAE;AADD,GADoB;AAI/B5B,EAAAA,WAAW,EAAE,EACX,GAAG0B,wBAAWG,kBADH;AAEXC,IAAAA,aAAa,EAAEC,yBAAYC,KAAZ,GAAoB,aAApB,GAAoC;AAFxC,GAJkB;AAQ/B5B,EAAAA,YAAY,EAAE,EACZ,GAAGsB,wBAAWG,kBADF;AAEZC,IAAAA,aAAa,EAAEC,yBAAYC,KAAZ,GAAoB,KAApB,GAA4B;AAF/B;AARiB,CAAlB,CAAf","sourcesContent":["// Similarily to the DrawerLayout component this deserves to be put in a\n// separate repo. Although, keeping it here for the time being will allow us to\n// move faster and fix possible issues quicker\n\nimport React, {\n ForwardedRef,\n forwardRef,\n useCallback,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { GestureObjects as Gesture } from '../handlers/gestures/gestureObjects';\nimport { GestureDetector } from '../handlers/gestures/GestureDetector';\nimport {\n GestureStateChangeEvent,\n GestureUpdateEvent,\n} from '../handlers/gestureHandlerCommon';\nimport type { PanGestureHandlerProps } from '../handlers/PanGestureHandler';\nimport type { PanGestureHandlerEventPayload } from '../handlers/GestureHandlerEventPayload';\nimport Animated, {\n Extrapolation,\n SharedValue,\n interpolate,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withSpring,\n} from 'react-native-reanimated';\nimport {\n I18nManager,\n LayoutChangeEvent,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native';\n\nconst DRAG_TOSS = 0.05;\n\ntype SwipeableExcludes = Exclude<\n keyof PanGestureHandlerProps,\n 'onGestureEvent' | 'onHandlerStateChange'\n>;\n\nexport interface SwipeableProps\n extends Pick<PanGestureHandlerProps, SwipeableExcludes> {\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 /**\n * Specifies how much the visual interaction will be delayed compared to the\n * gesture distance. e.g. value of 1 will indicate that the swipeable panel\n * should exactly follow the gesture, 2 means it is going to be two times\n * \"slower\".\n */\n friction?: number;\n\n /**\n * Distance from the left edge at which released panel will animate to the\n * open state (or the open panel will animate into the closed state). By\n * default it's a half of the panel's width.\n */\n leftThreshold?: number;\n\n /**\n * Distance from the right edge at which released panel will animate to the\n * open state (or the open panel will animate into the closed state). By\n * default it's a half of the panel's width.\n */\n rightThreshold?: number;\n\n /**\n * Distance that the panel must be dragged from the left edge to be considered\n * a swipe. The default value is 10.\n */\n dragOffsetFromLeftEdge?: number;\n\n /**\n * Distance that the panel must be dragged from the right edge to be considered\n * a swipe. The default value is 10.\n */\n dragOffsetFromRightEdge?: number;\n\n /**\n * Value indicating if the swipeable panel can be pulled further than the left\n * actions panel's width. It is set to true by default as long as the left\n * panel render method is present.\n */\n overshootLeft?: boolean;\n\n /**\n * Value indicating if the swipeable panel can be pulled further than the\n * right actions panel's width. It is set to true by default as long as the\n * right panel render method is present.\n */\n overshootRight?: boolean;\n\n /**\n * Specifies how much the visual interaction will be delayed compared to the\n * gesture distance at overshoot. Default value is 1, it mean no friction, for\n * a native feel, try 8 or above.\n */\n overshootFriction?: number;\n\n /**\n * Called when action panel gets open (either right or left).\n */\n onSwipeableOpen?: (\n direction: 'left' | 'right',\n swipeable: SwipeableMethods\n ) => void;\n\n /**\n * Called when action panel is closed.\n */\n onSwipeableClose?: (\n direction: 'left' | 'right',\n swipeable: SwipeableMethods\n ) => void;\n\n /**\n * Called when action panel starts animating on open (either right or left).\n */\n onSwipeableWillOpen?: (direction: 'left' | 'right') => void;\n\n /**\n * Called when action panel starts animating on close.\n */\n onSwipeableWillClose?: (direction: 'left' | 'right') => void;\n\n /**\n * Called when action panel starts being shown on dragging to open.\n */\n onSwipeableOpenStartDrag?: (direction: 'left' | 'right') => void;\n\n /**\n * Called when action panel starts being shown on dragging to close.\n */\n onSwipeableCloseStartDrag?: (direction: 'left' | 'right') => void;\n\n /**\n *\n * This map describes the values to use as inputRange for extra interpolation:\n * AnimatedValue: [startValue, endValue]\n *\n * progressAnimatedValue: [0, 1] dragAnimatedValue: [0, +]\n *\n * To support `rtl` flexbox layouts use `flexDirection` styling.\n * */\n renderLeftActions?: (\n progressAnimatedValue: SharedValue<number>,\n dragAnimatedValue: SharedValue<number>,\n swipeable: SwipeableMethods\n ) => React.ReactNode;\n /**\n *\n * This map describes the values to use as inputRange for extra interpolation:\n * AnimatedValue: [startValue, endValue]\n *\n * progressAnimatedValue: [0, 1] dragAnimatedValue: [0, -]\n *\n * To support `rtl` flexbox layouts use `flexDirection` styling.\n * */\n renderRightActions?: (\n progressAnimatedValue: SharedValue<number>,\n dragAnimatedValue: SharedValue<number>,\n swipeable: SwipeableMethods\n ) => React.ReactNode;\n\n animationOptions?: Record<string, unknown>;\n\n /**\n * Style object for the container (`Animated.View`), for example to override\n * `overflow: 'hidden'`.\n */\n containerStyle?: StyleProp<ViewStyle>;\n\n /**\n * Style object for the children container (`Animated.View`), for example to\n * apply `flex: 1`\n */\n childrenContainerStyle?: StyleProp<ViewStyle>;\n}\n\nexport interface SwipeableMethods {\n close: () => void;\n openLeft: () => void;\n openRight: () => void;\n reset: () => void;\n}\n\nconst Swipeable = forwardRef<SwipeableMethods, SwipeableProps>(\n function Swipeable(\n props: SwipeableProps,\n ref: ForwardedRef<SwipeableMethods>\n ) {\n const {\n leftThreshold,\n rightThreshold,\n onSwipeableOpenStartDrag,\n onSwipeableCloseStartDrag,\n enableTrackpadTwoFingerGesture,\n enabled,\n containerStyle,\n childrenContainerStyle,\n animationOptions,\n overshootLeft,\n overshootRight,\n onSwipeableWillOpen,\n onSwipeableWillClose,\n onSwipeableOpen,\n onSwipeableClose,\n testID,\n ...remainingProps\n } = props;\n\n const rowState = useSharedValue<number>(0);\n\n const userDrag = useSharedValue<number>(0);\n const appliedTranslation = useSharedValue<number>(0);\n\n const rowWidth = useSharedValue<number>(0);\n const leftWidth = useSharedValue<number>(0);\n const rightWidth = useSharedValue<number>(0);\n const rightOffset = useSharedValue<number>(0);\n\n const leftActionTranslate = useSharedValue<number>(0);\n const rightActionTranslate = useSharedValue<number>(0);\n\n const showLeftProgress = useSharedValue<number>(0);\n const showRightProgress = useSharedValue<number>(0);\n\n const swipeableMethods = useRef<SwipeableMethods>({\n close: () => {\n 'worklet';\n },\n openLeft: () => {\n 'worklet';\n },\n openRight: () => {\n 'worklet';\n },\n reset: () => {\n 'worklet';\n },\n });\n\n const defaultProps = {\n friction: 1,\n overshootFriction: 1,\n };\n\n const {\n friction = defaultProps.friction,\n overshootFriction = defaultProps.overshootFriction,\n } = props;\n\n const overshootLeftProp = overshootLeft;\n const overshootRightProp = overshootRight;\n\n const calculateCurrentOffset = useCallback(() => {\n 'worklet';\n if (rowState.value === 1) {\n return leftWidth.value;\n } else if (rowState.value === -1) {\n return -rowWidth.value - rightOffset.value;\n }\n return 0;\n }, [leftWidth, rightOffset, rowState, rowWidth]);\n\n const updateAnimatedEvent = () => {\n 'worklet';\n rightWidth.value = Math.max(0, rowWidth.value - rightOffset.value);\n\n const overshootLeft = overshootLeftProp ?? leftWidth.value > 0;\n const overshootRight = overshootRightProp ?? rightWidth.value > 0;\n\n const startOffset =\n rowState.value === 1\n ? leftWidth.value\n : rowState.value === -1\n ? -rightWidth.value\n : 0;\n\n const offsetDrag = userDrag.value / friction + startOffset;\n\n appliedTranslation.value = interpolate(\n offsetDrag,\n [\n -rightWidth.value - 1,\n -rightWidth.value,\n leftWidth.value,\n leftWidth.value + 1,\n ],\n [\n -rightWidth.value - (overshootRight ? 1 / overshootFriction : 0),\n -rightWidth.value,\n leftWidth.value,\n leftWidth.value + (overshootLeft ? 1 / overshootFriction : 0),\n ]\n );\n\n showLeftProgress.value =\n leftWidth.value > 0\n ? interpolate(\n appliedTranslation.value,\n [-1, 0, leftWidth.value],\n [0, 0, 1]\n )\n : 0;\n leftActionTranslate.value = interpolate(\n showLeftProgress.value,\n [0, Number.MIN_VALUE],\n [-10000, 0],\n Extrapolation.CLAMP\n );\n showRightProgress.value =\n rightWidth.value > 0\n ? interpolate(\n appliedTranslation.value,\n [-rightWidth.value, 0, 1],\n [1, 0, 0]\n )\n : 0;\n rightActionTranslate.value = interpolate(\n showRightProgress.value,\n [0, Number.MIN_VALUE],\n [-10000, 0],\n Extrapolation.CLAMP\n );\n };\n\n const dispatchImmediateEvents = useCallback(\n (fromValue: number, toValue: number) => {\n if (toValue > 0 && onSwipeableWillOpen) {\n onSwipeableWillOpen('left');\n } else if (toValue < 0 && onSwipeableWillOpen) {\n onSwipeableWillOpen('right');\n } else if (onSwipeableWillClose) {\n const closingDirection = fromValue > 0 ? 'left' : 'right';\n onSwipeableWillClose(closingDirection);\n }\n },\n [onSwipeableWillClose, onSwipeableWillOpen]\n );\n\n const dispatchEndEvents = useCallback(\n (fromValue: number, toValue: number) => {\n if (toValue > 0 && onSwipeableOpen) {\n onSwipeableOpen('left', swipeableMethods.current);\n } else if (toValue < 0 && onSwipeableOpen) {\n onSwipeableOpen('right', swipeableMethods.current);\n } else if (onSwipeableClose) {\n const closingDirection = fromValue > 0 ? 'left' : 'right';\n onSwipeableClose(closingDirection, swipeableMethods.current);\n }\n },\n [onSwipeableClose, onSwipeableOpen]\n );\n\n const animationOptionsProp = animationOptions;\n\n const animateRow = useCallback(\n (fromValue: number, toValue: number, velocityX?: number) => {\n 'worklet';\n rowState.value = Math.sign(toValue);\n\n const translationSpringConfig = {\n duration: 1000,\n dampingRatio: 0.9,\n stiffness: 500,\n velocity: velocityX,\n overshootClamping: true,\n ...animationOptionsProp,\n };\n\n const progressSpringConfig = {\n ...translationSpringConfig,\n velocity: 0,\n };\n\n appliedTranslation.value = withSpring(\n toValue,\n translationSpringConfig,\n (isFinished) => {\n if (isFinished) {\n runOnJS(dispatchEndEvents)(fromValue, toValue);\n }\n }\n );\n\n const progressTarget = toValue === 0 ? 0 : 1;\n\n showLeftProgress.value =\n leftWidth.value > 0\n ? withSpring(progressTarget, progressSpringConfig)\n : 0;\n showRightProgress.value =\n rightWidth.value > 0\n ? withSpring(progressTarget, progressSpringConfig)\n : 0;\n\n runOnJS(dispatchImmediateEvents)(fromValue, toValue);\n },\n [\n rowState,\n animationOptionsProp,\n appliedTranslation,\n showLeftProgress,\n leftWidth.value,\n showRightProgress,\n rightWidth.value,\n dispatchImmediateEvents,\n dispatchEndEvents,\n ]\n );\n\n const onRowLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n rowWidth.value = nativeEvent.layout.width;\n };\n\n const {\n children,\n renderLeftActions,\n renderRightActions,\n dragOffsetFromLeftEdge = 10,\n dragOffsetFromRightEdge = 10,\n } = props;\n\n swipeableMethods.current = {\n close() {\n 'worklet';\n animateRow(calculateCurrentOffset(), 0);\n },\n openLeft() {\n 'worklet';\n animateRow(calculateCurrentOffset(), leftWidth.value);\n },\n openRight() {\n 'worklet';\n rightWidth.value = rowWidth.value - rightOffset.value;\n animateRow(calculateCurrentOffset(), -rightWidth.value);\n },\n reset() {\n 'worklet';\n userDrag.value = 0;\n showLeftProgress.value = 0;\n appliedTranslation.value = 0;\n rowState.value = 0;\n },\n };\n\n const leftAnimatedStyle = useAnimatedStyle(\n () => ({\n transform: [\n {\n translateX: leftActionTranslate.value,\n },\n ],\n }),\n [leftActionTranslate]\n );\n\n const leftElement = renderLeftActions && (\n <Animated.View style={[styles.leftActions, leftAnimatedStyle]}>\n {renderLeftActions(\n showLeftProgress,\n appliedTranslation,\n swipeableMethods.current\n )}\n <View\n onLayout={({ nativeEvent }) =>\n (leftWidth.value = nativeEvent.layout.x)\n }\n />\n </Animated.View>\n );\n\n const rightAnimatedStyle = useAnimatedStyle(\n () => ({\n transform: [\n {\n translateX: rightActionTranslate.value,\n },\n ],\n }),\n [rightActionTranslate]\n );\n\n const rightElement = renderRightActions && (\n <Animated.View style={[styles.rightActions, rightAnimatedStyle]}>\n {renderRightActions(\n showRightProgress,\n appliedTranslation,\n swipeableMethods.current\n )}\n <View\n onLayout={({ nativeEvent }) =>\n (rightOffset.value = nativeEvent.layout.x)\n }\n />\n </Animated.View>\n );\n\n const leftThresholdProp = leftThreshold;\n const rightThresholdProp = rightThreshold;\n\n const handleRelease = (\n event: GestureStateChangeEvent<PanGestureHandlerEventPayload>\n ) => {\n 'worklet';\n const { velocityX } = event;\n userDrag.value = event.translationX;\n\n rightWidth.value = rowWidth.value - rightOffset.value;\n\n const leftThreshold = leftThresholdProp ?? leftWidth.value / 2;\n const rightThreshold = rightThresholdProp ?? rightWidth.value / 2;\n\n const startOffsetX = calculateCurrentOffset() + userDrag.value / friction;\n const translationX = (userDrag.value + DRAG_TOSS * velocityX) / friction;\n\n let toValue = 0;\n\n if (rowState.value === 0) {\n if (translationX > leftThreshold) {\n toValue = leftWidth.value;\n } else if (translationX < -rightThreshold) {\n toValue = -rightWidth.value;\n }\n } else if (rowState.value === 1) {\n // Swiped to left\n if (translationX > -leftThreshold) {\n toValue = leftWidth.value;\n }\n } else {\n // Swiped to right\n if (translationX < rightThreshold) {\n toValue = -rightWidth.value;\n }\n }\n\n animateRow(startOffsetX, toValue, velocityX / friction);\n };\n\n const close = () => {\n 'worklet';\n animateRow(calculateCurrentOffset(), 0);\n };\n\n const tapGesture = Gesture.Tap().onStart(() => {\n if (rowState.value !== 0) {\n close();\n }\n });\n\n const panGesture = Gesture.Pan()\n .onUpdate((event: GestureUpdateEvent<PanGestureHandlerEventPayload>) => {\n userDrag.value = event.translationX;\n\n const direction =\n rowState.value === -1\n ? 'right'\n : rowState.value === 1\n ? 'left'\n : event.translationX > 0\n ? 'left'\n : 'right';\n\n if (rowState.value === 0 && onSwipeableOpenStartDrag) {\n runOnJS(onSwipeableOpenStartDrag)(direction);\n } else if (rowState.value !== 0 && onSwipeableCloseStartDrag) {\n runOnJS(onSwipeableCloseStartDrag)(direction);\n }\n updateAnimatedEvent();\n })\n .onEnd(\n (event: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => {\n handleRelease(event);\n }\n );\n\n if (enableTrackpadTwoFingerGesture) {\n panGesture.enableTrackpadTwoFingerGesture(enableTrackpadTwoFingerGesture);\n }\n\n panGesture.activeOffsetX([\n -dragOffsetFromRightEdge,\n dragOffsetFromLeftEdge,\n ]);\n tapGesture.shouldCancelWhenOutside(true);\n\n useImperativeHandle(ref, () => swipeableMethods.current, [\n swipeableMethods,\n ]);\n\n panGesture.enabled(enabled !== false);\n\n const animatedStyle = useAnimatedStyle(\n () => ({\n transform: [{ translateX: appliedTranslation.value }],\n pointerEvents: rowState.value === 0 ? 'auto' : 'box-only',\n }),\n [appliedTranslation, rowState]\n );\n\n const swipeableComponent = (\n <GestureDetector gesture={panGesture} touchAction=\"pan-y\">\n <Animated.View\n {...remainingProps}\n onLayout={onRowLayout}\n style={[styles.container, containerStyle]}>\n {leftElement}\n {rightElement}\n <GestureDetector gesture={tapGesture} touchAction=\"pan-y\">\n <Animated.View style={[animatedStyle, childrenContainerStyle]}>\n {children}\n </Animated.View>\n </GestureDetector>\n </Animated.View>\n </GestureDetector>\n );\n\n return testID ? (\n <View testID={testID}>{swipeableComponent}</View>\n ) : (\n swipeableComponent\n );\n }\n);\n\nexport default Swipeable;\nexport type SwipeableRef = ForwardedRef<SwipeableMethods>;\n\nconst styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n },\n leftActions: {\n ...StyleSheet.absoluteFillObject,\n flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row',\n },\n rightActions: {\n ...StyleSheet.absoluteFillObject,\n flexDirection: I18nManager.isRTL ? 'row' : 'row-reverse',\n },\n});\n"]}
@@ -1,2 +1,6 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
2
6
  //# sourceMappingURL=GestureHandlerEventPayload.js.map
@@ -11,7 +11,7 @@ var _gestureHandlerCommon = require("./gestureHandlerCommon");
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
- const longPressGestureHandlerProps = ['minDurationMs', 'maxDist'];
14
+ const longPressGestureHandlerProps = ['minDurationMs', 'maxDist', 'numberOfPointers'];
15
15
  exports.longPressGestureHandlerProps = longPressGestureHandlerProps;
16
16
  const longPressHandlerName = 'LongPressGestureHandler';
17
17
  exports.longPressHandlerName = longPressHandlerName;
@@ -1 +1 @@
1
- {"version":3,"sources":["LongPressGestureHandler.ts"],"names":["longPressGestureHandlerProps","longPressHandlerName","LongPressGestureHandler","name","allowedProps","baseGestureHandlerProps","config","shouldCancelWhenOutside"],"mappings":";;;;;;;AACA;;AACA;;;;AAKO,MAAMA,4BAA4B,GAAG,CAC1C,eAD0C,EAE1C,SAF0C,CAArC;;AAyBA,MAAMC,oBAAoB,GAAG,yBAA7B;;AAGP;AACO,MAAMC,uBAAuB,GAAG,4BAGrC;AACAC,EAAAA,IAAI,EAAEF,oBADN;AAEAG,EAAAA,YAAY,EAAE,CACZ,GAAGC,6CADS,EAEZ,GAAGL,4BAFS,CAFd;AAMAM,EAAAA,MAAM,EAAE;AACNC,IAAAA,uBAAuB,EAAE;AADnB;AANR,CAHqC,CAAhC","sourcesContent":["import { LongPressGestureHandlerEventPayload } from './GestureHandlerEventPayload';\nimport createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const longPressGestureHandlerProps = [\n 'minDurationMs',\n 'maxDist',\n] as const;\n\nexport interface LongPressGestureConfig {\n /**\n * Minimum time, expressed in milliseconds, that a finger must remain pressed on\n * the corresponding view. The default value is 500.\n */\n minDurationMs?: number;\n\n /**\n * Maximum distance, expressed in points, that defines how far the finger is\n * allowed to travel during a long press gesture. If the finger travels\n * further than the defined distance and the handler hasn't yet activated, it\n * will fail to recognize the gesture. The default value is 10.\n */\n maxDist?: number;\n}\n\nexport interface LongPressGestureHandlerProps\n extends BaseGestureHandlerProps<LongPressGestureHandlerEventPayload>,\n LongPressGestureConfig {}\n\nexport const longPressHandlerName = 'LongPressGestureHandler';\n\nexport type LongPressGestureHandler = typeof LongPressGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const LongPressGestureHandler = createHandler<\n LongPressGestureHandlerProps,\n LongPressGestureHandlerEventPayload\n>({\n name: longPressHandlerName,\n allowedProps: [\n ...baseGestureHandlerProps,\n ...longPressGestureHandlerProps,\n ] as const,\n config: {\n shouldCancelWhenOutside: true,\n },\n});\n"]}
1
+ {"version":3,"sources":["LongPressGestureHandler.ts"],"names":["longPressGestureHandlerProps","longPressHandlerName","LongPressGestureHandler","name","allowedProps","baseGestureHandlerProps","config","shouldCancelWhenOutside"],"mappings":";;;;;;;AACA;;AACA;;;;AAKO,MAAMA,4BAA4B,GAAG,CAC1C,eAD0C,EAE1C,SAF0C,EAG1C,kBAH0C,CAArC;;AA+BA,MAAMC,oBAAoB,GAAG,yBAA7B;;AAGP;AACO,MAAMC,uBAAuB,GAAG,4BAGrC;AACAC,EAAAA,IAAI,EAAEF,oBADN;AAEAG,EAAAA,YAAY,EAAE,CACZ,GAAGC,6CADS,EAEZ,GAAGL,4BAFS,CAFd;AAMAM,EAAAA,MAAM,EAAE;AACNC,IAAAA,uBAAuB,EAAE;AADnB;AANR,CAHqC,CAAhC","sourcesContent":["import { LongPressGestureHandlerEventPayload } from './GestureHandlerEventPayload';\nimport createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const longPressGestureHandlerProps = [\n 'minDurationMs',\n 'maxDist',\n 'numberOfPointers',\n] as const;\n\nexport interface LongPressGestureConfig {\n /**\n * Minimum time, expressed in milliseconds, that a finger must remain pressed on\n * the corresponding view. The default value is 500.\n */\n minDurationMs?: number;\n\n /**\n * Maximum distance, expressed in points, that defines how far the finger is\n * allowed to travel during a long press gesture. If the finger travels\n * further than the defined distance and the handler hasn't yet activated, it\n * will fail to recognize the gesture. The default value is 10.\n */\n maxDist?: number;\n\n /**\n * Determine exact number of points required to handle the long press gesture.\n */\n numberOfPointers?: number;\n}\n\nexport interface LongPressGestureHandlerProps\n extends BaseGestureHandlerProps<LongPressGestureHandlerEventPayload>,\n LongPressGestureConfig {}\n\nexport const longPressHandlerName = 'LongPressGestureHandler';\n\nexport type LongPressGestureHandler = typeof LongPressGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const LongPressGestureHandler = createHandler<\n LongPressGestureHandlerProps,\n LongPressGestureHandlerEventPayload\n>({\n name: longPressHandlerName,\n allowedProps: [\n ...baseGestureHandlerProps,\n ...longPressGestureHandlerProps,\n ] as const,\n config: {\n shouldCancelWhenOutside: true,\n },\n});\n"]}