The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 00:45 UTC
fix(mobile): a full swipe on a thread row finishes even if the pan is cancelled (#33492)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 9, 2026 at 11:21 UTC
7078dcbfbef09b5c970aba2b4771b2f1e8bcfbb9
3 files changed
+49
-25
apps/mobile/src/features/home/thread-swipe-actions.tsx
+2
-2
@@ -391,10 +391,10 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
391
}
392
}, [commitPrimaryAction, content, fullSwipeAction, onDelete]);
393
const handleRelease = useCallback(
394
- (translation: SharedValue<number>) => {
394
+ (translation: SharedValue<number>, canceled: boolean) => {
395
"worklet";
396
if (dismissing.value) return true;
397
- if (-translation.value >= fullSwipeThreshold) {
397
+ if (!canceled && -translation.value >= fullSwipeThreshold) {
398
runOnJS(commitFullSwipe)();
399
return true;
400
}
patches/react-native-gesture-handler@3.5.0.patch
+44
-20
@@ -53,7 +53,7 @@ index cb0666b9e35dc2b76ff0cb592e0a867e1a28b3dd..7f481d90f9993dbe874676c7393f90e2
53
BOOL shouldBegin = [super gestureRecognizerShouldBegin:gestureRecognizer];
54
_lastState = savedState;
55
diff --git a/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js b/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js
56
-index 30e6601d1dd2dbb8fa43b077feee374e0af4e509..2d36194b9f8ca25e9b00b95c8aca01d78493fca7 100644
56
+index 30e6601d1dd2dbb8fa43b077feee374e0af4e509..5e6e99cee482c78aac71fe5ed1dc19e4ccf05ae4 100644
57
--- a/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js
58
+++ b/lib/module/components/ReanimatedSwipeable/ReanimatedSwipeable.js
59
@@ -42,6 +42,8 @@ const Swipeable = props => {
@@ -65,12 +65,23 @@ index 30e6601d1dd2dbb8fa43b077feee374e0af4e509..2d36194b9f8ca25e9b00b95c8aca01d7
65
friction = DEFAULT_FRICTION,
66
overshootFriction = DEFAULT_OVERSHOOT_FRICTION,
67
onSwipeableOpenStartDrag: onSwipeableOpenStartDragProp,
68
-@@ -312,8 +314,12 @@ const Swipeable = props => {
68
+@@ -284,6 +286,10 @@ const Swipeable = props => {
69
+ if (event.canceled) {
70
+ // Restore the row to where it rested before the gesture.
71
+ const restingValue = rowState.value === 1 ? leftWidth.value : rowState.value === -1 ? -rightWidth.value : 0;
72
++ // A caller animating translation (e.g. a dismissal) keeps it.
73
++ if (onSwipeableRelease?.(appliedTranslation, true)) {
74
++ return;
75
++ }
76
+ animateRow(restingValue, 0, true);
77
+ return;
78
+ }
79
+@@ -312,8 +318,12 @@ const Swipeable = props => {
80
toValue = -rightWidth.value;
81
}
82
}
83
+ // Let a UI-thread full-swipe commit take over before the return spring.
73
-+ if (onSwipeableRelease?.(appliedTranslation)) {
84
++ if (onSwipeableRelease?.(appliedTranslation, false)) {
85
+ return;
86
+ }
87
animateRow(toValue, velocityX / friction);
@@ -79,7 +90,7 @@ index 30e6601d1dd2dbb8fa43b077feee374e0af4e509..2d36194b9f8ca25e9b00b95c8aca01d7
90
const close = useCallback(() => {
91
'worklet';
92
82
-@@ -359,6 +365,8 @@ const Swipeable = props => {
93
+@@ -359,6 +369,8 @@ const Swipeable = props => {
94
enabled: enabled ?? true,
95
enableTrackpadTwoFingerGesture: enableTrackpadTwoFingerGesture,
96
activeOffsetX: [dragOffsetFromRight, dragOffsetFromLeft],
@@ -89,23 +100,24 @@ index 30e6601d1dd2dbb8fa43b077feee374e0af4e509..2d36194b9f8ca25e9b00b95c8aca01d7
100
requireToFail,
101
block,
102
diff --git a/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts b/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts
92
-index e97b6dbbced1bcbd359cf35293b7f10cbf13b0e7..de07f26423bee66ecd7d0f9bb33233bcb3215751 100644
103
+index e97b6dbbced1bcbd359cf35293b7f10cbf13b0e7..b7d03718c4ce50a0a69f0f478ae5114d9310d9f3 100644
104
--- a/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts
105
+++ b/lib/typescript/components/ReanimatedSwipeable/ReanimatedSwipeableProps.d.ts
95
-@@ -59,6 +59,12 @@ export type SwipeableProps = {
106
+@@ -59,6 +59,13 @@ export type SwipeableProps = {
107
* Called when action panel is closed.
108
*/
109
onSwipeableClose?: (direction: SwipeDirection.LEFT | SwipeDirection.RIGHT) => void;
110
+ /**
100
-+ * UI-thread worklet called on release before the built-in spring starts.
111
++ * UI-thread worklet called on release before the built-in spring starts,
112
++ * including a canceled pan (`canceled`), which must not commit an action.
113
+ * Return true to consume the release and take ownership of translation.
114
+ * The caller must reset or remove the row after its custom animation.
115
+ */
104
-+ onSwipeableRelease?: (translation: SharedValue<number>) => boolean;
116
++ onSwipeableRelease?: (translation: SharedValue<number>, canceled: boolean) => boolean;
117
/**
118
* Called when action panel starts animating on open (either right or left).
119
*/
108
-@@ -150,6 +156,13 @@ export type SwipeableProps = {
120
+@@ -150,6 +157,13 @@ export type SwipeableProps = {
121
* The horizontal offset from the starting point required to trigger a left-swipe gesture. Defaults to -10.
122
*/
123
dragOffsetFromRight?: number;
@@ -120,7 +132,7 @@ index e97b6dbbced1bcbd359cf35293b7f10cbf13b0e7..de07f26423bee66ecd7d0f9bb33233bc
132
export interface SwipeableMethods {
133
close: () => void;
134
diff --git a/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx b/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx
123
-index 2b3789a5277404e57607c05db96dc062d6db1b10..0dcf61dcb12fc5d0b676a3312aefc26cd3823ee1 100644
135
+index 2b3789a5277404e57607c05db96dc062d6db1b10..0c23c2ce6b0a07540c68204a8528b655b5624f84 100644
136
--- a/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx
137
+++ b/src/components/ReanimatedSwipeable/ReanimatedSwipeable.tsx
138
@@ -80,6 +80,8 @@ const Swipeable = (props: SwipeableProps) => {
@@ -132,19 +144,30 @@ index 2b3789a5277404e57607c05db96dc062d6db1b10..0dcf61dcb12fc5d0b676a3312aefc26c
144
friction = DEFAULT_FRICTION,
145
overshootFriction = DEFAULT_OVERSHOOT_FRICTION,
146
onSwipeableOpenStartDrag: onSwipeableOpenStartDragProp,
135
-@@ -552,6 +554,11 @@ const Swipeable = (props: SwipeableProps) => {
147
+@@ -520,6 +522,10 @@ const Swipeable = (props: SwipeableProps) => {
148
+ : rowState.value === -1
149
+ ? -rightWidth.value
150
+ : 0;
151
++ // A caller animating translation (e.g. a dismissal) keeps it.
152
++ if (onSwipeableRelease?.(appliedTranslation, true)) {
153
++ return;
154
++ }
155
+ animateRow(restingValue, 0, true);
156
+ return;
157
+ }
158
+@@ -552,6 +558,11 @@ const Swipeable = (props: SwipeableProps) => {
159
}
160
}
161
162
+ // Let a UI-thread full-swipe commit take over before the return spring.
140
-+ if (onSwipeableRelease?.(appliedTranslation)) {
163
++ if (onSwipeableRelease?.(appliedTranslation, false)) {
164
+ return;
165
+ }
166
+
167
animateRow(toValue, velocityX / friction);
168
},
169
[
147
-@@ -563,6 +570,8 @@ const Swipeable = (props: SwipeableProps) => {
170
+@@ -563,6 +574,8 @@ const Swipeable = (props: SwipeableProps) => {
171
rightWidth,
172
rowState,
173
userDrag,
@@ -153,7 +176,7 @@ index 2b3789a5277404e57607c05db96dc062d6db1b10..0dcf61dcb12fc5d0b676a3312aefc26c
176
]
177
);
178
156
-@@ -640,6 +649,7 @@ const Swipeable = (props: SwipeableProps) => {
179
+@@ -640,6 +653,7 @@ const Swipeable = (props: SwipeableProps) => {
180
typeof dragOffsetFromRight,
181
typeof dragOffsetFromLeft,
182
],
@@ -161,7 +184,7 @@ index 2b3789a5277404e57607c05db96dc062d6db1b10..0dcf61dcb12fc5d0b676a3312aefc26c
184
simultaneousWith,
185
requireToFail,
186
block,
164
-@@ -653,6 +663,7 @@ const Swipeable = (props: SwipeableProps) => {
187
+@@ -653,6 +667,7 @@ const Swipeable = (props: SwipeableProps) => {
188
block,
189
dragOffsetFromLeft,
190
dragOffsetFromRight,
@@ -170,24 +193,25 @@ index 2b3789a5277404e57607c05db96dc062d6db1b10..0dcf61dcb12fc5d0b676a3312aefc26c
193
enabled,
194
handleFinalize,
195
diff --git a/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts b/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts
173
-index 1e1246f709feb04c01cf3221472cc1219a8fffac..f526d4fe2d2738becbe8d29c59d1105afa11ae60 100644
196
+index 1e1246f709feb04c01cf3221472cc1219a8fffac..9099c53aa5e2ff164beeb0f43897fd56eef663fa 100644
197
--- a/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts
198
+++ b/src/components/ReanimatedSwipeable/ReanimatedSwipeableProps.ts
176
-@@ -77,6 +77,13 @@ export type SwipeableProps = {
199
+@@ -77,6 +77,14 @@ export type SwipeableProps = {
200
direction: SwipeDirection.LEFT | SwipeDirection.RIGHT
201
) => void;
202
203
+ /**
181
-+ * UI-thread worklet called on release before the built-in spring starts.
204
++ * UI-thread worklet called on release before the built-in spring starts,
205
++ * including a canceled pan (`canceled`), which must not commit an action.
206
+ * Return true to consume the release and take ownership of translation.
207
+ * The caller must reset or remove the row after its custom animation.
208
+ */
185
-+ onSwipeableRelease?: (translation: SharedValue<number>) => boolean;
209
++ onSwipeableRelease?: (translation: SharedValue<number>, canceled: boolean) => boolean;
210
+
211
/**
212
* Called when action panel starts animating on open (either right or left).
213
*/
190
-@@ -196,6 +203,14 @@ export type SwipeableProps = {
214
+@@ -196,6 +204,14 @@ export type SwipeableProps = {
215
* The horizontal offset from the starting point required to trigger a left-swipe gesture. Defaults to -10.
216
*/
217
dragOffsetFromRight?: number;
pnpm-lock.yaml
+3
-3
@@ -380,7 +380,7 @@ patchedDependencies:
380
micromark-extension-llm-math@3.1.0: 4eeb9d9e27ebc75e98795e21c0719005483dad7d233055698257f7d10e91603b
381
micromark@4.0.2: cb79edde7eca83bbcaaafb6ceb7b044b81b987314cde4910823b15257ecada67
382
node-pty@1.2.0-beta.15: f1e680afec85f650699ea756f91f469844ec4c976f4f168492a45c6b3f67d651
383
- react-native-gesture-handler@3.5.0: 25b41728fe1796cc791bf394ec07fbe232072e78c508cf325759a96ca19db0d8
383
+ react-native-gesture-handler@3.5.0: 171379dd378f8f11e9187876dec2116e5cbf5f21cef6576cdde6956518324f98
384
react-native-image-viewing@0.2.2: 4aa038d541c7ddcc8f1437eb3e7b4f769f61de78e7f91b53f9805dfca608474d
385
react-native-keyboard-controller@1.23.0: 1c7c80317ef050e08d4aabe034a0813d03b497dff2dc8b37fb5f4a6e3b20fddb
386
react-native-pdf-jsi@5.0.0: 6f52854210f61bef499850ebd498229a111bc34ec5b2a4925e644f2f48f42760
@@ -738,7 +738,7 @@ importers:
738
version: file:apps/mobile/deps/react-native-enriched-markdown-1.2.0-t3.18-497fbe63.tgz(katex@0.16.47)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0)
739
react-native-gesture-handler:
740
specifier: 3.5.0
741
- version: 3.5.0(patch_hash=25b41728fe1796cc791bf394ec07fbe232072e78c508cf325759a96ca19db0d8)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0)
741
+ version: 3.5.0(patch_hash=171379dd378f8f11e9187876dec2116e5cbf5f21cef6576cdde6956518324f98)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0)
742
react-native-image-viewing:
743
specifier: 0.2.2
744
version: 0.2.2(patch_hash=4aa038d541c7ddcc8f1437eb3e7b4f769f61de78e7f91b53f9805dfca608474d)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0)
@@ -21053,7 +21053,7 @@ snapshots:
21053
optionalDependencies:
21054
katex: 0.16.47
21055
21056
- react-native-gesture-handler@3.5.0(patch_hash=25b41728fe1796cc791bf394ec07fbe232072e78c508cf325759a96ca19db0d8)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0):
21056
+ react-native-gesture-handler@3.5.0(patch_hash=171379dd378f8f11e9187876dec2116e5cbf5f21cef6576cdde6956518324f98)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0):
21057
dependencies:
21058
'@types/react-test-renderer': 19.1.0
21059
invariant: 2.2.4