Open History to see the last commit
1diff --git a/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js b/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js
2index 551ab92bf58db0b79d428dcd2f2df898ef686493..f1c355b8e40cd4f583ef3a501b044fb6770f4a24 100644
3--- a/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js
4+++ b/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js
5@@ -34,6 +34,7 @@ const Swipeable = props => {
6 enableTrackpadTwoFingerGesture = DEFAULT_ENABLE_TRACKING_TWO_FINGER_GESTURE,
7 dragOffsetFromLeftEdge = DEFAULT_DRAG_OFFSET,
8 dragOffsetFromRightEdge = DEFAULT_DRAG_OFFSET,
9+ failOffsetY,
10 friction = DEFAULT_FRICTION,
11 overshootFriction = DEFAULT_OVERSHOOT_FRICTION,
12 onSwipeableOpenStartDrag,
13@@ -285,11 +286,14 @@ const Swipeable = props => {
14 }).onFinalize(() => {
15 dragStarted.value = false;
16 });
17+ if (failOffsetY !== undefined) {
18+ pan.failOffsetY(failOffsetY);
19+ }
20 Object.entries(relationProps).forEach(([relationName, relation]) => {
21 (0, _utils.applyRelationProp)(pan, relationName, relation);
22 });
23 return pan;
24- }, [enabled, hitSlop, enableTrackpadTwoFingerGesture, dragOffsetFromRightEdge, dragOffsetFromLeftEdge, updateElementWidths, relationProps, userDrag, rowState, dragStarted, updateAnimatedEvent, onSwipeableOpenStartDrag, onSwipeableCloseStartDrag, handleRelease]);
25+ }, [enabled, hitSlop, enableTrackpadTwoFingerGesture, dragOffsetFromRightEdge, dragOffsetFromLeftEdge, failOffsetY, updateElementWidths, relationProps, userDrag, rowState, dragStarted, updateAnimatedEvent, onSwipeableOpenStartDrag, onSwipeableCloseStartDrag, handleRelease]);
26 (0, _react.useImperativeHandle)(ref, () => swipeableMethods, [swipeableMethods]);
27 const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
28 transform: [{
29diff --git a/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js b/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js
30index a2835d5416ffd5cf9a04e98774516b9e6569691e..b73c177227bf3a232737b0eb1c0e2bb830493c22 100644
31--- a/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js
32+++ b/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js
33@@ -29,6 +29,7 @@ const Swipeable = props => {
34 enableTrackpadTwoFingerGesture = DEFAULT_ENABLE_TRACKING_TWO_FINGER_GESTURE,
35 dragOffsetFromLeftEdge = DEFAULT_DRAG_OFFSET,
36 dragOffsetFromRightEdge = DEFAULT_DRAG_OFFSET,
37+ failOffsetY,
38 friction = DEFAULT_FRICTION,
39 overshootFriction = DEFAULT_OVERSHOOT_FRICTION,
40 onSwipeableOpenStartDrag,
41@@ -280,11 +281,14 @@ const Swipeable = props => {
42 }).onFinalize(() => {
43 dragStarted.value = false;
44 });
45+ if (failOffsetY !== undefined) {
46+ pan.failOffsetY(failOffsetY);
47+ }
48 Object.entries(relationProps).forEach(([relationName, relation]) => {
49 applyRelationProp(pan, relationName, relation);
50 });
51 return pan;
52- }, [enabled, hitSlop, enableTrackpadTwoFingerGesture, dragOffsetFromRightEdge, dragOffsetFromLeftEdge, updateElementWidths, relationProps, userDrag, rowState, dragStarted, updateAnimatedEvent, onSwipeableOpenStartDrag, onSwipeableCloseStartDrag, handleRelease]);
53+ }, [enabled, hitSlop, enableTrackpadTwoFingerGesture, dragOffsetFromRightEdge, dragOffsetFromLeftEdge, failOffsetY, updateElementWidths, relationProps, userDrag, rowState, dragStarted, updateAnimatedEvent, onSwipeableOpenStartDrag, onSwipeableCloseStartDrag, handleRelease]);
54 useImperativeHandle(ref, () => swipeableMethods, [swipeableMethods]);
55 const animatedStyle = useAnimatedStyle(() => ({
56 transform: [{
57diff --git a/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts b/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts
58index ac8b76830d468edfbc29052b452a36221323c3de..589e329d2aa706ddfff0d1037df0d85a050edbb0 100644
59--- a/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts
60+++ b/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts
61@@ -64,6 +64,13 @@ export interface SwipeableProps {
62 * a swipe. The default value is 10.
63 */
64 dragOffsetFromRightEdge?: number;
65+ /**
66+ * Range along the Y axis (in points) that, once exceeded before the swipe
67+ * activates, makes the pan fail. Lets vertically-dominant pans (list
68+ * scrolling, especially trackpad two-finger pans) skip the swipe entirely.
69+ * Passed straight to the underlying Pan gesture's `failOffsetY`.
70+ */
71+ failOffsetY?: number | [start: number, end: number];
72 /**
73 * Value indicating if the swipeable panel can be pulled further than the left
74 * actions panel's width. It is set to true by default as long as the left
75diff --git a/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx b/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx
76index b6134c908624adc590ebd264e90e558b88e235d5..41535348e937ad7762bd531d5b63ba6e092ea997 100644
77--- a/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx
78+++ b/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx
79@@ -58,6 +58,7 @@ const Swipeable = (props: SwipeableProps) => {
80 enableTrackpadTwoFingerGesture = DEFAULT_ENABLE_TRACKING_TWO_FINGER_GESTURE,
81 dragOffsetFromLeftEdge = DEFAULT_DRAG_OFFSET,
82 dragOffsetFromRightEdge = DEFAULT_DRAG_OFFSET,
83+ failOffsetY,
84 friction = DEFAULT_FRICTION,
85 overshootFriction = DEFAULT_OVERSHOOT_FRICTION,
86 onSwipeableOpenStartDrag,
87@@ -537,6 +538,10 @@ const Swipeable = (props: SwipeableProps) => {
88 dragStarted.value = false;
89 });
91+ if (failOffsetY !== undefined) {
92+ pan.failOffsetY(failOffsetY);
93+ }
94+
95 Object.entries(relationProps).forEach(([relationName, relation]) => {
96 applyRelationProp(
97 pan,
98@@ -552,6 +557,7 @@ const Swipeable = (props: SwipeableProps) => {
99 enableTrackpadTwoFingerGesture,
100 dragOffsetFromRightEdge,
101 dragOffsetFromLeftEdge,
102+ failOffsetY,
103 updateElementWidths,
104 relationProps,
105 userDrag,
106diff --git a/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts b/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts
107index 0c0e517e0d340faf50ff78c3d48e7a2bbcf808ec..d4b6ff508077728c8be83762923d866dc95b144c 100644
108--- a/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts
109+++ b/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts
110@@ -77,6 +77,14 @@ export interface SwipeableProps {
111 */
112 dragOffsetFromRightEdge?: number;
114+ /**
115+ * Range along the Y axis (in points) that, once exceeded before the swipe
116+ * activates, makes the pan fail. Lets vertically-dominant pans (list
117+ * scrolling, especially trackpad two-finger pans) skip the swipe entirely.
118+ * Passed straight to the underlying Pan gesture's `failOffsetY`.
119+ */
120+ failOffsetY?: number | [start: number, end: number];
121+
122 /**
123 * Value indicating if the swipeable panel can be pulled further than the left
124 * actions panel's width. It is set to true by default as long as the left