Open History to see the last commit
1diff --git a/apple/Handlers/RNHoverHandler.m b/apple/Handlers/RNHoverHandler.m
2index 320cb8cb2652bfcfe1ecc65ebd81a8d208e4260f..a88ac5f04a9663fd7a62ee89e42d85ec41dcaf55 100644
3--- a/apple/Handlers/RNHoverHandler.m
4+++ b/apple/Handlers/RNHoverHandler.m
5@@ -132,8 +132,10 @@ - (void)unbindFromView
6 {
7 #if CHECK_TARGET(13_4)
8 if (@available(iOS 13.4, *)) {
9+ // The superclass detaches the recognizer, clearing recognizer.view. Remove
10+ // the interaction from its own view before it can be recycled by Fabric.
11+ [_pointerInteraction.view removeInteraction:_pointerInteraction];
12 [super unbindFromView];
13- [self.recognizer.view removeInteraction:_pointerInteraction];
14 }
15 #endif
16 }
17diff --git a/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js b/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js
18index 551ab92bf58db0b79d428dcd2f2df898ef686493..13db26d88bff975bc5d46bb6432cbf9fda3d489a 100644
19--- a/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js
20+++ b/lib/commonjs/components/ReanimatedSwipeable/ReanimatedSwipeable.js
21@@ -34,11 +34,13 @@ const Swipeable = props => {
22 enableTrackpadTwoFingerGesture = DEFAULT_ENABLE_TRACKING_TWO_FINGER_GESTURE,
23 dragOffsetFromLeftEdge = DEFAULT_DRAG_OFFSET,
24 dragOffsetFromRightEdge = DEFAULT_DRAG_OFFSET,
25+ failOffsetY,
26 friction = DEFAULT_FRICTION,
27 overshootFriction = DEFAULT_OVERSHOOT_FRICTION,
28 onSwipeableOpenStartDrag,
29 onSwipeableCloseStartDrag,
30 onSwipeableWillOpen,
31+ onSwipeableRelease,
32 onSwipeableWillClose,
33 onSwipeableOpen,
34 onSwipeableClose,
35@@ -248,8 +250,13 @@ const Swipeable = props => {
36 toValue = -rightWidth.value;
37 }
38 }
39+ // Let a UI-thread full-swipe commit take over before the return spring.
40+ if (onSwipeableRelease?.(appliedTranslation)) {
41+ return;
42+ }
43+
44 animateRow(toValue, velocityX / friction);
45- }, [animateRow, friction, leftThreshold, leftWidth, rightThreshold, rightWidth, rowState, userDrag]);
46+ }, [animateRow, friction, leftThreshold, leftWidth, rightThreshold, rightWidth, rowState, userDrag, onSwipeableRelease, appliedTranslation]);
47 const close = (0, _react.useCallback)(() => {
48 'worklet';
50@@ -285,11 +292,14 @@ const Swipeable = props => {
51 }).onFinalize(() => {
52 dragStarted.value = false;
53 });
54+ if (failOffsetY !== undefined) {
55+ pan.failOffsetY(failOffsetY);
56+ }
57 Object.entries(relationProps).forEach(([relationName, relation]) => {
58 (0, _utils.applyRelationProp)(pan, relationName, relation);
59 });
60 return pan;
61- }, [enabled, hitSlop, enableTrackpadTwoFingerGesture, dragOffsetFromRightEdge, dragOffsetFromLeftEdge, updateElementWidths, relationProps, userDrag, rowState, dragStarted, updateAnimatedEvent, onSwipeableOpenStartDrag, onSwipeableCloseStartDrag, handleRelease]);
62+ }, [enabled, hitSlop, enableTrackpadTwoFingerGesture, dragOffsetFromRightEdge, dragOffsetFromLeftEdge, failOffsetY, updateElementWidths, relationProps, userDrag, rowState, dragStarted, updateAnimatedEvent, onSwipeableOpenStartDrag, onSwipeableCloseStartDrag, handleRelease]);
63 (0, _react.useImperativeHandle)(ref, () => swipeableMethods, [swipeableMethods]);
64 const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
65 transform: [{
66diff --git a/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js b/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js
67index a2835d5416ffd5cf9a04e98774516b9e6569691e..055afce410d6eb655532e7a09371dfc22eae5e9c 100644
68--- a/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js
69+++ b/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js
70@@ -29,11 +29,13 @@ const Swipeable = props => {
71 enableTrackpadTwoFingerGesture = DEFAULT_ENABLE_TRACKING_TWO_FINGER_GESTURE,
72 dragOffsetFromLeftEdge = DEFAULT_DRAG_OFFSET,
73 dragOffsetFromRightEdge = DEFAULT_DRAG_OFFSET,
74+ failOffsetY,
75 friction = DEFAULT_FRICTION,
76 overshootFriction = DEFAULT_OVERSHOOT_FRICTION,
77 onSwipeableOpenStartDrag,
78 onSwipeableCloseStartDrag,
79 onSwipeableWillOpen,
80+ onSwipeableRelease,
81 onSwipeableWillClose,
82 onSwipeableOpen,
83 onSwipeableClose,
84@@ -243,8 +245,13 @@ const Swipeable = props => {
85 toValue = -rightWidth.value;
86 }
87 }
88+ // Let a UI-thread full-swipe commit take over before the return spring.
89+ if (onSwipeableRelease?.(appliedTranslation)) {
90+ return;
91+ }
92+
93 animateRow(toValue, velocityX / friction);
94- }, [animateRow, friction, leftThreshold, leftWidth, rightThreshold, rightWidth, rowState, userDrag]);
95+ }, [animateRow, friction, leftThreshold, leftWidth, rightThreshold, rightWidth, rowState, userDrag, onSwipeableRelease, appliedTranslation]);
96 const close = useCallback(() => {
97 'worklet';
99@@ -280,11 +287,14 @@ const Swipeable = props => {
100 }).onFinalize(() => {
101 dragStarted.value = false;
102 });
103+ if (failOffsetY !== undefined) {
104+ pan.failOffsetY(failOffsetY);
105+ }
106 Object.entries(relationProps).forEach(([relationName, relation]) => {
107 applyRelationProp(pan, relationName, relation);
108 });
109 return pan;
110- }, [enabled, hitSlop, enableTrackpadTwoFingerGesture, dragOffsetFromRightEdge, dragOffsetFromLeftEdge, updateElementWidths, relationProps, userDrag, rowState, dragStarted, updateAnimatedEvent, onSwipeableOpenStartDrag, onSwipeableCloseStartDrag, handleRelease]);
111+ }, [enabled, hitSlop, enableTrackpadTwoFingerGesture, dragOffsetFromRightEdge, dragOffsetFromLeftEdge, failOffsetY, updateElementWidths, relationProps, userDrag, rowState, dragStarted, updateAnimatedEvent, onSwipeableOpenStartDrag, onSwipeableCloseStartDrag, handleRelease]);
112 useImperativeHandle(ref, () => swipeableMethods, [swipeableMethods]);
113 const animatedStyle = useAnimatedStyle(() => ({
114 transform: [{
115diff --git a/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts b/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts
116index ac8b76830d468edfbc29052b452a36221323c3de..cac72ebaafaf746af7640783a16e99c93ecad2a4 100644
117--- a/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts
118+++ b/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts
119@@ -64,6 +64,13 @@ export interface SwipeableProps {
120 * a swipe. The default value is 10.
121 */
122 dragOffsetFromRightEdge?: number;
123+ /**
124+ * Range along the Y axis (in points) that, once exceeded before the swipe
125+ * activates, makes the pan fail. Lets vertically-dominant pans (list
126+ * scrolling, especially trackpad two-finger pans) skip the swipe entirely.
127+ * Passed straight to the underlying Pan gesture's `failOffsetY`.
128+ */
129+ failOffsetY?: number | [start: number, end: number];
130 /**
131 * Value indicating if the swipeable panel can be pulled further than the left
132 * actions panel's width. It is set to true by default as long as the left
133@@ -90,6 +97,13 @@ export interface SwipeableProps {
134 * Called when action panel is closed.
135 */
136 onSwipeableClose?: (direction: SwipeDirection.LEFT | SwipeDirection.RIGHT) => void;
137+ /**
138+ * UI-thread worklet called on release before the built-in spring starts.
139+ * Return true to consume the release and take ownership of translation.
140+ * The caller must reset or remove the row after its custom animation.
141+ */
142+ onSwipeableRelease?: (translation: SharedValue<number>) => boolean;
143+
144 /**
145 * Called when action panel starts animating on open (either right or left).
146 */
147diff --git a/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx b/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx
148index b6134c908624adc590ebd264e90e558b88e235d5..fa4b1c1749bd0e86cbf5f5546f295d8099e1a481 100644
149--- a/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx
150+++ b/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx
151@@ -58,11 +58,13 @@ const Swipeable = (props: SwipeableProps) => {
152 enableTrackpadTwoFingerGesture = DEFAULT_ENABLE_TRACKING_TWO_FINGER_GESTURE,
153 dragOffsetFromLeftEdge = DEFAULT_DRAG_OFFSET,
154 dragOffsetFromRightEdge = DEFAULT_DRAG_OFFSET,
155+ failOffsetY,
156 friction = DEFAULT_FRICTION,
157 overshootFriction = DEFAULT_OVERSHOOT_FRICTION,
158 onSwipeableOpenStartDrag,
159 onSwipeableCloseStartDrag,
160 onSwipeableWillOpen,
161+ onSwipeableRelease,
162 onSwipeableWillClose,
163 onSwipeableOpen,
164 onSwipeableClose,
165@@ -457,6 +459,11 @@ const Swipeable = (props: SwipeableProps) => {
166 }
167 }
169+ // Let a UI-thread full-swipe commit take over before the return spring.
170+ if (onSwipeableRelease?.(appliedTranslation)) {
171+ return;
172+ }
173+
174 animateRow(toValue, velocityX / friction);
175 },
176 [
177@@ -468,6 +475,8 @@ const Swipeable = (props: SwipeableProps) => {
178 rightWidth,
179 rowState,
180 userDrag,
181+ onSwipeableRelease,
182+ appliedTranslation,
183 ]
184 );
186@@ -537,6 +546,10 @@ const Swipeable = (props: SwipeableProps) => {
187 dragStarted.value = false;
188 });
190+ if (failOffsetY !== undefined) {
191+ pan.failOffsetY(failOffsetY);
192+ }
193+
194 Object.entries(relationProps).forEach(([relationName, relation]) => {
195 applyRelationProp(
196 pan,
197@@ -552,6 +565,7 @@ const Swipeable = (props: SwipeableProps) => {
198 enableTrackpadTwoFingerGesture,
199 dragOffsetFromRightEdge,
200 dragOffsetFromLeftEdge,
201+ failOffsetY,
202 updateElementWidths,
203 relationProps,
204 userDrag,
205diff --git a/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts b/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts
206index 0c0e517e0d340faf50ff78c3d48e7a2bbcf808ec..3ab14d240da346b1927792e480f5b1e902b03bf8 100644
207--- a/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts
208+++ b/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts
209@@ -77,6 +77,14 @@ export interface SwipeableProps {
210 */
211 dragOffsetFromRightEdge?: number;
213+ /**
214+ * Range along the Y axis (in points) that, once exceeded before the swipe
215+ * activates, makes the pan fail. Lets vertically-dominant pans (list
216+ * scrolling, especially trackpad two-finger pans) skip the swipe entirely.
217+ * Passed straight to the underlying Pan gesture's `failOffsetY`.
218+ */
219+ failOffsetY?: number | [start: number, end: number];
220+
221 /**
222 * Value indicating if the swipeable panel can be pulled further than the left
223 * actions panel's width. It is set to true by default as long as the left
224@@ -112,6 +120,13 @@ export interface SwipeableProps {
225 direction: SwipeDirection.LEFT | SwipeDirection.RIGHT
226 ) => void;
228+ /**
229+ * UI-thread worklet called on release before the built-in spring starts.
230+ * Return true to consume the release and take ownership of translation.
231+ * The caller must reset or remove the row after its custom animation.
232+ */
233+ onSwipeableRelease?: (translation: SharedValue<number>) => boolean;
234+
235 /**
236 * Called when action panel starts animating on open (either right or left).
237 */