@devries-cameron20 / t3code Mirror · read-only / commits / bc1dc2a81e
Fork 0

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 21, 16:00 UTC

fix(mobile): keep the thread column out of the iPhone Duo fold (#26923)

Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Joseph Chekanoff committed Nov 14, 2026 at 05:54 UTC bc1dc2a81ee51bf0d2883bc55470e4c70ca1990e
5 files changed +112 -27
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+3 -2
@@ -331,6 +331,7 @@ function WorkspaceColumns(
331
332 const primary = props.descriptors[props.primary.key];
333 if (!primary) return null;
334 + const primaryColumnWidth = (layout.listPaneWidth ?? 320) + (layout.listPaneGap ?? 0) / 2;
335 return (
336 <Split.Host
337 ref={hostRef}
@@ -388,8 +389,8 @@ function WorkspaceColumns(
389 onInspectorHide={hideInspector}
390 columnMetrics={{
391 minimumPrimaryColumnWidth: 280,
391 - maximumPrimaryColumnWidth: Math.max(380, layout.listPaneWidth ?? 0),
392 - preferredPrimaryColumnWidthOrFraction: layout.listPaneWidth ?? 320,
392 + maximumPrimaryColumnWidth: Math.max(380, primaryColumnWidth),
393 + preferredPrimaryColumnWidthOrFraction: primaryColumnWidth,
394 minimumSecondaryColumnWidth: NATIVE_INSPECTOR_MIN_MAIN_WIDTH,
395 // UIKit can retain its automatic width despite a new preference; constrain both edges.
396 minimumInspectorColumnWidth: inspectorWidth,
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+6 -2
@@ -37,7 +37,11 @@ import { useKeyboardScrollToEnd } from "@legendapp/list/keyboard";
37 import { resolveProviderSkillsForCwd } from "@t3tools/client-runtime/providerSkills";
38 import type { LegendListRef } from "@legendapp/list/react-native";
39 import { NativeLayoutObserver } from "../../native/NativeLayoutObserver";
40 -import { deriveBottomControlInsets, type NativeLayoutMetrics } from "../../lib/reserved-regions";
40 +import {
41 + deriveBottomControlInsets,
42 + deriveContentSideInsets,
43 + type NativeLayoutMetrics,
44 +} from "../../lib/reserved-regions";
45 import type {
46 EnvironmentId,
47 MessageId,
@@ -1525,7 +1529,7 @@ function ThreadDetailBody(
1529 }
1530 contentMaxWidth={contentMaxWidth}
1531 historyControls={props.historyControls}
1528 - contentSideInsets={nativeMetrics?.safeArea}
1532 + contentSideInsets={deriveContentSideInsets(nativeMetrics)}
1533 layoutVariant={layoutVariant}
1534 usesAutomaticContentInsets={props.usesAutomaticContentInsets}
1535 onHeaderMaterialVisibilityChange={props.onHeaderMaterialVisibilityChange}
apps/mobile/src/features/threads/ThreadFeed.tsx
+9 -7
@@ -3799,13 +3799,15 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
3799
3800 if (props.contentPresentation.kind === "unavailable" && props.queuedMessages.length === 0) {
3801 return (
3802 - <ThreadFeedPlaceholder
3803 - title={props.contentPresentation.title}
3804 - detail={props.contentPresentation.detail}
3805 - topInset={topContentInset}
3806 - bottomInset={bottomContentInset}
3807 - horizontalPadding={horizontalPadding}
3808 - />
3802 + <View style={{ flex: 1, marginLeft: contentLeftInset, marginRight: contentRightInset }}>
3803 + <ThreadFeedPlaceholder
3804 + title={props.contentPresentation.title}
3805 + detail={props.contentPresentation.detail}
3806 + topInset={topContentInset}
3807 + bottomInset={bottomContentInset}
3808 + horizontalPadding={horizontalPadding}
3809 + />
3810 + </View>
3811 );
3812 }
3813
apps/mobile/src/lib/reserved-regions.test.ts
+68 -10
@@ -1,5 +1,9 @@
1 import { describe, expect, it } from "vite-plus/test";
2 -import { deriveBottomControlInsets, type NativeLayoutMetrics } from "./reserved-regions";
2 +import {
3 + deriveBottomControlInsets,
4 + deriveContentSideInsets,
5 + type NativeLayoutMetrics,
6 +} from "./reserved-regions";
7 import { deriveLayout, deriveWorkspacePaneLayout } from "./layout";
8
9 const innerDisplay: NativeLayoutMetrics = {
@@ -21,26 +25,27 @@ describe("bottom controls around reserved regions", () => {
25 expect(innerDisplay.width - insets.left - insets.right).toBeGreaterThan(320);
26 });
27
24 - it("does not reserve a hinge twice when a native column starts at the division", () => {
28 + it("starts the editor after a fold that covers a native column's leading edge", () => {
29 expect(
30 deriveBottomControlInsets({
31 ...innerDisplay,
28 - width: 412,
32 + width: 411.33,
33 + height: 669,
34 safeArea: { top: 82, bottom: 34, left: 0, right: 0 },
30 - reservedRegions: [{ kind: "division", x: 0, y: 0, width: 40, height: 560 }],
35 + reservedRegions: [{ kind: "division", x: 0, y: 0, width: 39.83, height: 669 }],
36 }),
32 - ).toEqual({ left: 0, right: 0, bottom: 0 });
37 + ).toEqual({ left: 39.83, right: 0, bottom: 0 });
38 });
39
35 - it("keeps a native column's trailing division at its existing edge", () => {
40 + it("does not reserve a hinge twice when the safe area already covers it", () => {
41 expect(
42 deriveBottomControlInsets({
43 ...innerDisplay,
39 - width: 456,
40 - safeArea: { top: 82, bottom: 34, left: 0, right: 0 },
41 - reservedRegions: [{ kind: "division", x: 455.75, y: 0, width: 0.25, height: 560 }],
44 + width: 412,
45 + safeArea: { top: 82, bottom: 34, left: 40, right: 0 },
46 + reservedRegions: [{ kind: "division", x: 0, y: 0, width: 40, height: 560 }],
47 }),
43 - ).toEqual({ left: 0, right: 0, bottom: 0 });
48 + ).toEqual({ left: 40, right: 0, bottom: 0 });
49 });
50
51 it("keeps controls below a horizontal fold in a hands-free pose", () => {
@@ -65,6 +70,59 @@ describe("bottom controls around reserved regions", () => {
70 });
71 });
72
73 +describe("content side insets around reserved regions", () => {
74 + it("keeps transcript text on the wider side of a book fold", () => {
75 + expect(
76 + deriveContentSideInsets({
77 + ...innerDisplay,
78 + reservedRegions: [{ kind: "division", x: 456, y: 0, width: 48, height: 560 }],
79 + }),
80 + ).toEqual({ left: 8, right: 504 });
81 + expect(
82 + deriveContentSideInsets({
83 + ...innerDisplay,
84 + width: 800,
85 + reservedRegions: [{ kind: "division", x: 240, y: 0, width: 40, height: 560 }],
86 + }),
87 + ).toEqual({ left: 280, right: 72 });
88 + });
89 +
90 + it("starts transcript text after a fold that covers a native column's leading edge", () => {
91 + expect(
92 + deriveContentSideInsets({
93 + ...innerDisplay,
94 + width: 411.33,
95 + height: 669,
96 + safeArea: { top: 82, bottom: 34, left: 0, right: 0 },
97 + reservedRegions: [{ kind: "division", x: 0, y: 0, width: 39.83, height: 669 }],
98 + }),
99 + ).toEqual({ left: 39.83, right: 0 });
100 + });
101 +
102 + it("ends transcript text before a fold at a native column's trailing edge", () => {
103 + expect(
104 + deriveContentSideInsets({
105 + ...innerDisplay,
106 + width: 456,
107 + safeArea: { top: 82, bottom: 34, left: 0, right: 0 },
108 + reservedRegions: [{ kind: "division", x: 416, y: 0, width: 40, height: 560 }],
109 + }),
110 + ).toEqual({ left: 0, right: 40 });
111 + });
112 +
113 + it("ignores a horizontal fold and bottom cameras", () => {
114 + expect(
115 + deriveContentSideInsets({
116 + ...innerDisplay,
117 + reservedRegions: [
118 + { kind: "division", x: 0, y: 240, width: 960, height: 40 },
119 + { kind: "occlusion", x: 8, y: 510, width: 60, height: 50 },
120 + ],
121 + }),
122 + ).toEqual({ left: 8, right: 72 });
123 + });
124 +});
125 +
126 describe("Duo workspace sizing", () => {
127 it("shows both columns on the unfolded inner display in portrait", () => {
128 // Reported by the iOS 27.1 Duo simulator: no side bar or fold, only the hinge.
apps/mobile/src/lib/reserved-regions.ts
+26 -6
@@ -23,6 +23,30 @@ export interface NativeLayoutMetrics {
23 readonly bottomBarInset?: number;
24 }
25
26 +function isFullHeightDivision(region: ReservedRegion, metrics: NativeLayoutMetrics) {
27 + return region.kind === "division" && region.height >= metrics.height / 2;
28 +}
29 +
30 +function sideOfDivision(left: number, right: number, x: number, endX: number) {
31 + if (x <= left) return { left: Math.min(right, endX), right };
32 + if (endX >= right) return { left, right: Math.max(left, x) };
33 + return right - endX >= x - left ? { left: endX, right } : { left, right: x };
34 +}
35 +
36 +export function deriveContentSideInsets(metrics: NativeLayoutMetrics | null) {
37 + if (!metrics) return { left: 0, right: 0 };
38 + let left = metrics.safeArea.left;
39 + let right = metrics.width - metrics.safeArea.right;
40 + for (const region of metrics.reservedRegions) {
41 + if (!isFullHeightDivision(region, metrics)) continue;
42 + const x = Math.max(left, region.x);
43 + const endX = Math.min(right, region.x + region.width);
44 + if (endX <= x) continue;
45 + ({ left, right } = sideOfDivision(left, right, x, endX));
46 + }
47 + return { left, right: metrics.width - right };
48 +}
49 +
50 export function deriveBottomControlInsets(metrics: NativeLayoutMetrics | null) {
51 if (!metrics) return { left: 0, right: 0, bottom: 0 };
52 let left = metrics.safeArea.left;
@@ -34,12 +58,8 @@ export function deriveBottomControlInsets(metrics: NativeLayoutMetrics | null) {
58 const y = Math.max(0, region.y);
59 const endY = Math.min(bottom, region.y + region.height);
60 if (endX <= x || endY <= y) continue;
37 - if (region.kind === "division" && region.height >= metrics.height / 2) {
38 - // A native column ending at a division is already split there. Only an
39 - // interior division needs to move these controls into one side of the view.
40 - if (x <= left || endX >= right) continue;
41 - if (right - endX >= x - left) left = endX;
42 - else right = x;
61 + if (isFullHeightDivision(region, metrics)) {
62 + ({ left, right } = sideOfDivision(left, right, x, endX));
63 } else if (endY >= bottom - metrics.safeArea.bottom) {
64 if (region.width >= right - left) bottom = y;
65 else if (right - endX >= x - left) left = endX;