@devries-cameron20 / t3code-1 / commits / 64e7e236e2
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(mobile): swipe actions no longer clip in short thread rows (#37285)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Fattah 💻 committed Nov 16, 2026 at 01:47 UTC 64e7e236e2f3c6e6ad635ee71a289e5ad2d9c174
1 file changed +35 -3
apps/mobile/src/features/home/thread-swipe-actions.tsx
+35 -3
@@ -52,6 +52,8 @@ const COMPACT_ACTION_CIRCLE_SIZE = 28;
52 const COMPACT_ACTION_ICON_SIZE = 13;
53 // At the default app text size, "Unarchive", the longest label, fills its slot at about 1.12x.
54 const ACTION_LABEL_MAX_FONT_SCALE = 1.1;
55 +const ACTION_LABEL_MIN_HEIGHT = 14;
56 +const ACTION_LABEL_OFFSET = 2;
57
58 const THREAD_SWIPE_ACTIONS_WIDTH = ACTION_ITEM_WIDTH * 2;
59 const THREAD_SWIPE_SPRING = {
@@ -82,6 +84,14 @@ function swipeActionsWidth(hasSecondaryAction: boolean) {
84 return hasSecondaryAction ? THREAD_SWIPE_ACTIONS_WIDTH : ACTION_ITEM_WIDTH;
85 }
86
87 +function fullActionStackHeight(labelLineHeight: number, fontScale: number) {
88 + const labelHeight = labelLineHeight * Math.min(fontScale, ACTION_LABEL_MAX_FONT_SCALE);
89 + // The offset shifts the label after centering, so it needs room on both sides.
90 + return (
91 + ACTION_CIRCLE_SIZE + ACTION_LABEL_OFFSET * 2 + Math.max(ACTION_LABEL_MIN_HEIGHT, labelHeight)
92 + );
93 +}
94 +
95 function resolveSecondaryAction(input: {
96 readonly close: () => void;
97 readonly onDelete: () => void;
@@ -422,7 +432,12 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
432 const handleSwipeableClose = useCallback(() => {
433 if (swipeableRef.current) onSwipeableClose?.(swipeableRef.current);
434 }, [onSwipeableClose]);
425 - const compactActions = props.compactActions === true;
435 + const { fontScale } = useWindowDimensions();
436 + const fullActionsHeight = fullActionStackHeight(useScaledTextRole("micro").lineHeight, fontScale);
437 + const [measuredRowHeight, setMeasuredRowHeight] = useState(0);
438 + const compactActions =
439 + props.compactActions === true ||
440 + (measuredRowHeight > 0 && measuredRowHeight < fullActionsHeight);
441 const { secondaryAction, threadTitle } = props;
442 // Swipeable calls this on every render; returning the previous element while nothing it shows
443 // changed keeps a selection change from re-rendering the hidden actions.
@@ -439,6 +454,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
454 actionStyle,
455 backgroundColor,
456 compactActions,
457 + measuredRowHeight,
458 fullSwipeAction,
459 fullSwipeThreshold,
460 handleFullSwipeArmedChange,
@@ -462,6 +478,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
478 <ThreadSwipeActions
479 backgroundColor={backgroundColor}
480 compact={compactActions}
481 + rowHeight={measuredRowHeight}
482 fullSwipeAction={fullSwipeAction}
483 fullSwipeThreshold={fullSwipeThreshold}
484 onFullSwipeArmedChange={handleFullSwipeArmedChange}
@@ -490,6 +507,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
507 <View
508 onLayout={({ nativeEvent: { layout } }) => {
509 rowHeight.set(layout.height);
510 + setMeasuredRowHeight(layout.height);
511 rowWidth.set(layout.width);
512 }}
513 >
@@ -538,6 +556,7 @@ function SwipeActionButton(props: {
556 readonly label: string;
557 readonly menu?: ThreadSwipeAction["menu"];
558 readonly onPress: () => void;
559 + readonly rowHeight: number;
560 readonly stretchesOnFullSwipe: boolean;
561 readonly translation: SharedValue<number>;
562 }) {
@@ -551,7 +570,13 @@ function SwipeActionButton(props: {
570 const circleSize = props.compact ? COMPACT_ACTION_CIRCLE_SIZE : ACTION_CIRCLE_SIZE;
571 const iconSize = props.compact ? COMPACT_ACTION_ICON_SIZE : ACTION_ICON_SIZE;
572 const { fontScale } = useWindowDimensions();
554 - const labelLineHeight = useScaledTextRole("micro").lineHeight;
573 + // Even compact actions can outgrow a short row at large app text sizes; shrink the label's
574 + // leading to the room left under the circle.
575 + const labelRoom =
576 + props.compact && props.rowHeight > 0
577 + ? (props.rowHeight - circleSize) / Math.min(fontScale, ACTION_LABEL_MAX_FONT_SCALE)
578 + : Infinity;
579 + const labelLineHeight = Math.min(useScaledTextRole("micro").lineHeight, labelRoom);
580 // Android scales lineHeight by the full font scale, past maxFontSizeMultiplier.
581 const labelTextStyle = {
582 lineHeight:
@@ -691,7 +716,11 @@ function SwipeActionButton(props: {
716 {/* An offset, not padding: padding would grow the box and move the circle at 1x. */}
717 <Animated.View
718 style={[
694 - { justifyContent: "center", minHeight: 14, top: props.compact ? 0 : 2 },
719 + {
720 + justifyContent: "center",
721 + minHeight: ACTION_LABEL_MIN_HEIGHT,
722 + top: props.compact ? 0 : ACTION_LABEL_OFFSET,
723 + },
724 labelStyle,
725 ]}
726 >
@@ -743,6 +772,7 @@ function ThreadSwipeActions(props: {
772 readonly fullSwipeThreshold: number;
773 readonly onFullSwipeArmedChange: (armed: boolean) => void;
774 readonly primaryAction: ThreadSwipeAction;
775 + readonly rowHeight: number;
776 readonly secondaryAction: ThreadSwipeSecondaryAction | null;
777 readonly translation: SharedValue<number>;
778 }) {
@@ -782,6 +812,7 @@ function ThreadSwipeActions(props: {
812 icon={props.primaryAction.icon}
813 label={props.primaryAction.label}
814 onPress={props.primaryAction.onPress}
815 + rowHeight={props.rowHeight}
816 stretchesOnFullSwipe={fullSwipeIsPrimary}
817 translation={props.translation}
818 />
@@ -797,6 +828,7 @@ function ThreadSwipeActions(props: {
828 label={secondaryAction.label}
829 menu={secondaryAction.menu}
830 onPress={secondaryAction.onPress}
831 + rowHeight={props.rowHeight}
832 stretchesOnFullSwipe={!fullSwipeIsPrimary}
833 translation={props.translation}
834 />