@devries-cameron20 / t3code-1 / commits / 32ea1a1d67
Fork 0

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

fix(mobile): keep the composer text box off the model button on RTL phones (#26090)

Co-authored-by: maria-rcks <maria@kuuro.net>

S3333F committed Oct 31, 2026 at 00:18 UTC 32ea1a1d677024d54d9f24aa9d28eaf0c31190a7
3 files changed +45 -3
apps/mobile/src/features/threads/ThreadComposer.tsx
+11 -3
@@ -32,7 +32,7 @@ import {
32 import { StackActions, useFocusEffect, useNavigation } from "@react-navigation/native";
33 import type { ReactNode } from "react";
34 import { useEffect, useEffectEvent, useRef, useState, type RefObject } from "react";
35 -import { Keyboard, Platform, View, type ViewStyle } from "react-native";
35 +import { I18nManager, Keyboard, Platform, View, type ViewStyle } from "react-native";
36 import { composerImageGallery } from "../../lib/composerImageGallery";
37 import { filePreviewGallery } from "../../lib/filePreviewGallery";
38 import { FilePreviewModal, type FilePreviewSource } from "../../components/FilePreviewModal";
@@ -97,6 +97,7 @@ import {
97 resolveComposerSendPresentation,
98 type ComposerSendPresentation,
99 } from "./composerSendPresentation";
100 +import { compactEditorInsets } from "./compactEditorInsets";
101 import { ComposerCommandPopover } from "./ComposerCommandPopover";
102 import { ComposerPopoverAnchor } from "./ComposerPopoverAnchor";
103 import { ComposerQueuedEditAttachments } from "./ComposerQueuedEdit";
@@ -157,12 +158,19 @@ function useCompactComposerEditor(text: ScaledTextRole, value: string) {
158 (contentHeight > text.lineHeight * 1.5 ||
159 (compactWidth > 0 && contentSize.width > compactWidth));
160 const compactRowHeight = Math.max(44, minimum);
161 + const isRTL = I18nManager.isRTL;
162 const editorStyle = useAnimatedStyle(() => ({
163 position: "absolute",
164 overflow: "hidden",
165 height,
164 - left: isExpanded ? 14 : editorX.value + 4,
165 - right: isExpanded ? 14 : rowWidth.value - editorX.value - editorWidth.value + 4,
166 + ...(isExpanded
167 + ? { left: 14, right: 14 }
168 + : compactEditorInsets({
169 + slotX: editorX.value,
170 + slotWidth: editorWidth.value,
171 + rowWidth: rowWidth.value,
172 + isRTL,
173 + })),
174 // The full-width editor must move above the controls in the same frame it widens.
175 bottom: isExpanded ? 52 : (compactRowHeight - minimum) / 2,
176 }));
apps/mobile/src/features/threads/compactEditorInsets.test.ts new
+17
@@ -0,0 +1,17 @@
1 +import { describe, expect, it } from "vite-plus/test";
2 +
3 +import { compactEditorInsets } from "./compactEditorInsets";
4 +
5 +describe("compact editor insets", () => {
6 + it("keeps the measured slot position in left-to-right layouts", () => {
7 + expect(compactEditorInsets({ slotX: 48, slotWidth: 200, rowWidth: 360, isRTL: false })).toEqual(
8 + { left: 52, right: 116 },
9 + );
10 + });
11 +
12 + it("swaps the insets in right-to-left layouts so the editor stays over its slot", () => {
13 + expect(compactEditorInsets({ slotX: 112, slotWidth: 200, rowWidth: 360, isRTL: true })).toEqual(
14 + { left: 52, right: 116 },
15 + );
16 + });
17 +});
apps/mobile/src/features/threads/compactEditorInsets.ts new
+17
@@ -0,0 +1,17 @@
1 +const COMPACT_EDITOR_SLOT_INSET = 4;
2 +
3 +/**
4 + * Places the floating editor over its slot. Layout x is measured from the left,
5 + * but React Native swaps left and right styles in RTL, so the insets trade places.
6 + */
7 +export function compactEditorInsets(input: {
8 + readonly slotX: number;
9 + readonly slotWidth: number;
10 + readonly rowWidth: number;
11 + readonly isRTL: boolean;
12 +}): { left: number; right: number } {
13 + "worklet";
14 + const fromLeft = input.slotX + COMPACT_EDITOR_SLOT_INSET;
15 + const fromRight = input.rowWidth - input.slotX - input.slotWidth + COMPACT_EDITOR_SLOT_INSET;
16 + return input.isRTL ? { left: fromRight, right: fromLeft } : { left: fromLeft, right: fromRight };
17 +}