@devries-cameron20 / t3code-1 / commits / 7b1332674b
Fork 0

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

fix(mobile): iOS composer text follows the system text size (#34670)

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

MarcoDotIO committed Nov 14, 2026 at 14:30 UTC 7b1332674b67215a184279e914c1ee499133fd66
6 files changed +36 -7
apps/mobile/src/components/ComposerEditor.ios.test.tsx
+1 -1
@@ -128,7 +128,7 @@ vi.mock("../lib/useUniwindTheme", () => ({ useUniwindTheme: () => ({}) }));
128 vi.mock("../lib/nativeComposerTheme", () => ({ createNativeComposerTheme: () => ({}) }));
129 vi.mock("../lib/contextChipIconSource", () => ({ contextChipIconUri: () => "" }));
130 vi.mock("../features/settings/appearance/useScaledTextRole", () => ({
131 - useScaledTextRole: () => ({ fontSize: 16, lineHeight: 22 }),
131 + useComposerTextRole: () => ({ fontSize: 16, lineHeight: 22 }),
132 }));
133 vi.mock("../lib/uuid", () => ({ uuidv4: () => "uuid", randomHex: () => "0000" }));
134 vi.mock("../state/assets", () => ({ assetEnvironment: {} }));
apps/mobile/src/features/settings/appearance/useScaledTextRole.ts
+9 -1
@@ -1,4 +1,6 @@
1 -import { resolveScaledTextRole } from "../../../lib/appearancePreferences";
1 +import { Platform, useWindowDimensions } from "react-native";
2 +
3 +import { resolveComposerTextRole, resolveScaledTextRole } from "../../../lib/appearancePreferences";
4 import { MOBILE_TYPOGRAPHY } from "../../../lib/typography";
5 import { useAppearancePreferences } from "./AppearancePreferencesProvider";
6
@@ -12,3 +14,9 @@ export function useScaledTextRole(role: keyof typeof MOBILE_TYPOGRAPHY): ScaledT
14 const { appearance } = useAppearancePreferences();
15 return resolveScaledTextRole(role, appearance.baseFontSize);
16 }
17 +
18 +export function useComposerTextRole(): ScaledTextRole {
19 + const body = useScaledTextRole("body");
20 + const { fontScale } = useWindowDimensions();
21 + return resolveComposerTextRole(body, fontScale, Platform.OS);
22 +}
apps/mobile/src/features/threads/ThreadComposer.tsx
+2 -2
@@ -96,7 +96,7 @@ import {
96 isModelSelectionUnavailable,
97 serverConfigForCwd,
98 } from "../../lib/modelOptions";
99 -import { useScaledTextRole, type ScaledTextRole } from "../settings/appearance/useScaledTextRole";
99 +import { useComposerTextRole, type ScaledTextRole } from "../settings/appearance/useScaledTextRole";
100 import type { RemoteClientConnectionState } from "../../lib/connection";
101 import { MOBILE_TYPOGRAPHY } from "../../lib/typography";
102 import { Menu } from "../../components/ui/Menu";
@@ -432,7 +432,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
432 const composerPanel = materialTheme["--color-composer-panel"];
433 const navigation = useNavigation();
434 const foregroundColor = useUniwindTheme()["--color-foreground"];
435 - const bodyText = useScaledTextRole("body");
435 + const bodyText = useComposerTextRole();
436 const fallbackInputRef = useRef<ComposerEditorHandle>(null);
437 const inputRef = props.editorRef ?? fallbackInputRef;
438 const [isFocused, setIsFocused] = useState(false);
apps/mobile/src/lib/appearancePreferences.test.ts
+11 -1
@@ -1,6 +1,6 @@
1 import { describe, expect, it } from "vite-plus/test";
2
3 -import { resolveAppearancePreferences } from "./appearancePreferences";
3 +import { resolveAppearancePreferences, resolveComposerTextRole } from "./appearancePreferences";
4
5 describe("appearancePreferences", () => {
6 it("migrates the legacy markdownFontSize key to baseFontSize", () => {
@@ -9,4 +9,14 @@ describe("appearancePreferences", () => {
9 resolveAppearancePreferences({ baseFontSize: 16, markdownFontSize: 18 }).baseFontSize,
10 ).toBe(16);
11 });
12 +
13 + it("scales the iOS composer text with the system text size", () => {
14 + const body = { fontSize: 16, lineHeight: 23 };
15 + expect(resolveComposerTextRole(body, 1, "ios")).toEqual(body);
16 + expect(resolveComposerTextRole(body, 2.643, "ios")).toEqual({
17 + fontSize: 16 * 2.643,
18 + lineHeight: 23 * 2.643,
19 + });
20 + expect(resolveComposerTextRole(body, 2.643, "android")).toEqual(body);
21 + });
22 });
apps/mobile/src/lib/appearancePreferences.ts
+11
@@ -205,6 +205,17 @@ export function resolveScaledTextRole(role: keyof typeof MOBILE_TYPOGRAPHY, base
205 };
206 }
207
208 +// React Native text applies the system text size itself, but the iOS composer sets a fixed
209 +// UIFont, so it needs pre-scaled metrics. Android's editor already sizes text in sp.
210 +export function resolveComposerTextRole(
211 + role: { readonly fontSize: number; readonly lineHeight: number },
212 + fontScale: number,
213 + os: string,
214 +) {
215 + if (os !== "ios") return role;
216 + return { fontSize: role.fontSize * fontScale, lineHeight: role.lineHeight * fontScale };
217 +}
218 +
219 export function resolveNativeMarkdownTypography(baseFontSize: number): NativeMarkdownTypography {
220 const fontSizes = resolveMarkdownFontSizes(baseFontSize);
221 return {
apps/mobile/src/native/T3ComposerEditor.ios.tsx
+2 -2
@@ -27,7 +27,7 @@ import { contextChipIconUri, modelChipIcon, modelChipIconUri } from "../lib/cont
27 import { useUniwindTheme } from "../lib/useUniwindTheme";
28 import { createNativeComposerTheme } from "../lib/nativeComposerTheme";
29 import { FONT_FAMILIES } from "../lib/fontFamilies";
30 -import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
30 +import { useComposerTextRole } from "../features/settings/appearance/useScaledTextRole";
31 import {
32 acknowledgeComposerNativeEvent,
33 assumeComposerControlledState,
@@ -176,7 +176,7 @@ export function ComposerEditor({
176 });
177 setConfirmedTokens({ value: props.value, tokens });
178 }
179 - const bodyText = useScaledTextRole("body");
179 + const bodyText = useComposerTextRole();
180 const theme = useUniwindTheme();
181 const fontFamily = FONT_FAMILIES.regular;
182