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 23, 00:30 UTC
fix(mobile): iOS composer text stays vertically aligned at every text size (#17855)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Akbar Danial Akma committed
Oct 20, 2026 at 08:57 UTC
d6c67ceb1f9d682a1c8fa0d28f39b79119e90065
1 file changed
+19
-2
apps/mobile/src/features/threads/ThreadComposer.tsx
+19
-2
@@ -88,8 +88,9 @@ import {
88
groupByProvider,
89
isModelSelectionUnavailable,
90
} from "../../lib/modelOptions";
91
-import { useScaledTextRole } from "../settings/appearance/useScaledTextRole";
91
+import { useScaledTextRole, type ScaledTextRole } from "../settings/appearance/useScaledTextRole";
92
import type { RemoteClientConnectionState } from "../../lib/connection";
93
+import { MOBILE_TYPOGRAPHY } from "../../lib/typography";
94
import { resolveProviderOptionDescriptors } from "../../lib/providerOptions";
95
import { Menu } from "../../components/ui/Menu";
96
import type { ActiveTurnComposerAction } from "@t3tools/client-runtime/state/composer-dispatch";
@@ -127,6 +128,20 @@ import {
128
129
export const COMPOSER_COLLAPSED_CHROME = 60;
130
131
+const COLLAPSED_EDITOR_DEFAULT_INSET = 6;
132
+// iOS puts line-height slack above glyphs. DM Sans's lowercase midline is
133
+// descender (0.31em) + half x-height (0.504em) above the line bottom.
134
+const LOWERCASE_MIDLINE_EM = 0.562;
135
+
136
+function lowercaseMidline(text: ScaledTextRole): number {
137
+ return text.lineHeight - LOWERCASE_MIDLINE_EM * text.fontSize;
138
+}
139
+
140
+function collapsedEditorInset(text: ScaledTextRole): number {
141
+ const shift = lowercaseMidline(text) - lowercaseMidline(MOBILE_TYPOGRAPHY.body);
142
+ return Math.max(0, Math.round(COLLAPSED_EDITOR_DEFAULT_INSET - shift));
143
+}
144
+
145
export const COMPOSER_EXPANDED_CHROME = 156;
146
147
export interface ThreadComposerProps {
@@ -914,7 +929,9 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
929
}
930
scrollEnabled={isExpanded}
931
singleLineCentered={!isExpanded}
917
- contentInsetVertical={isExpanded || Platform.OS === "android" ? 0 : 6}
932
+ contentInsetVertical={
933
+ isExpanded || Platform.OS === "android" ? 0 : collapsedEditorInset(bodyText)
934
+ }
935
style={
936
isExpanded
937
? {