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 22, 18:15 UTC
fix(mobile): keep iPad workspace columns aligned while resizing (#24182)
Alex committed
Oct 23, 2026 at 22:13 UTC
c14cda15b972f20185d9a4145e088c25a6c5e918
4 files changed
+47
-9
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+2
-2
@@ -230,8 +230,8 @@ function AdaptiveWorkspaceLayoutContent(
230
// re-renders on any layout state change, and the inspector registration then loops: each
231
// re-register re-renders its screen, which hands over a new inspector renderer.
232
const baseLayout = useMemo(
233
- () => deriveLayout({ width: viewportWidth, height, nativeMetrics }),
234
- [height, viewportWidth, nativeMetrics],
233
+ () => deriveLayout({ width: viewportWidth, height, nativeMetrics, nativeWorkspace }),
234
+ [height, viewportWidth, nativeMetrics, nativeWorkspace],
235
);
236
const primarySidebarPinned = isPrimarySidebarPinned({
237
pathname,
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+1
@@ -256,6 +256,7 @@ function WorkspaceColumns(
256
ref={hostRef}
257
testID="adaptive-workspace-layout"
258
preferredSplitBehavior="tile"
259
+ primaryBackgroundStyle={deviceType === "pad" ? "none" : "default"}
260
topColumnForCollapsing={compactColumn}
261
onCollapse={() => {
262
collapsed.current = true;
apps/mobile/src/lib/layout.test.ts
+35
@@ -49,6 +49,41 @@ describe("deriveThreadFeedInitialContentInset", () => {
49
});
50
});
51
52
+describe("native workspace sizing", () => {
53
+ it("keeps the detail mounted in a narrow iPad window while UIKit still has two columns", () => {
54
+ const nativeMetrics = {
55
+ width: 715,
56
+ height: 1013.5,
57
+ hasHinge: false,
58
+ horizontalSizeClass: "regular" as const,
59
+ verticalBarEdge: "none" as const,
60
+ safeArea: { top: 32, bottom: 20, left: 0, right: 0 },
61
+ reservedRegions: [],
62
+ };
63
+ expect(deriveLayout({ ...nativeMetrics, nativeMetrics, nativeWorkspace: true })).toMatchObject({
64
+ usesSplitView: true,
65
+ listPaneWidth: 280,
66
+ });
67
+ });
68
+
69
+ it.each([
70
+ { width: 600, horizontalSizeClass: "regular" as const, split: true },
71
+ { width: 599, horizontalSizeClass: "regular" as const, split: false },
72
+ { width: 715, horizontalSizeClass: "compact" as const, split: false },
73
+ ])("respects UIKit collapse and native column minimums: %j", ({ split, ...size }) => {
74
+ const nativeMetrics = {
75
+ ...size,
76
+ height: 800,
77
+ verticalBarEdge: "none" as const,
78
+ safeArea: { top: 32, bottom: 20, left: 0, right: 0 },
79
+ reservedRegions: [],
80
+ };
81
+ expect(
82
+ deriveLayout({ ...nativeMetrics, nativeMetrics, nativeWorkspace: true }).usesSplitView,
83
+ ).toBe(split);
84
+ });
85
+});
86
+
87
describe("isPrimarySidebarPinned", () => {
88
// regression: #20406 sidebar toggle works on iPad and iPhone Duo
89
it("keeps compact native roots pinned so search cannot hide the sidebar for a later split", () => {
apps/mobile/src/lib/layout.ts
+9
-7
@@ -90,12 +90,13 @@ export function deriveLayout(input: {
90
readonly width: number;
91
readonly height: number;
92
readonly nativeMetrics?: NativeLayoutMetrics | null;
93
+ readonly nativeWorkspace?: boolean;
94
}): Layout {
95
const { width, height } = input;
96
const metrics = input.nativeMetrics;
97
const usableWidth = width - (metrics?.safeArea.left ?? 0) - (metrics?.safeArea.right ?? 0);
97
- // UIKit's size class supports the shorter Duo inner display. Geometry remains
98
- // a floor so a narrow multitasking window cannot squeeze both columns.
98
+ // UIKit retains split columns below the generic tablet breakpoint. Native
99
+ // columns follow its size class while reserving room for both column minimums.
100
// Unfolded in portrait, the inner display reports neither a side bar nor a
101
// fold, only its hinge.
102
const hasDuoGeometry =
@@ -103,11 +104,12 @@ export function deriveLayout(input: {
104
(metrics.hasHinge === true ||
105
metrics.verticalBarEdge !== "none" ||
106
metrics.reservedRegions.some((region) => region.kind === "division"));
106
- const wideEnoughForSplit = hasDuoGeometry
107
- ? metrics.horizontalSizeClass === "regular" &&
108
- usableWidth >= SPLIT_SIDEBAR_MIN_WIDTH + 320 &&
109
- height >= 400
110
- : width >= SPLIT_LAYOUT_MIN_WIDTH && height >= SPLIT_LAYOUT_MIN_HEIGHT;
107
+ const wideEnoughForSplit =
108
+ metrics && (input.nativeWorkspace || hasDuoGeometry)
109
+ ? metrics.horizontalSizeClass === "regular" &&
110
+ usableWidth >= SPLIT_SIDEBAR_MIN_WIDTH + 320 &&
111
+ (input.nativeWorkspace || height >= 400)
112
+ : width >= SPLIT_LAYOUT_MIN_WIDTH && height >= SPLIT_LAYOUT_MIN_HEIGHT;
113
114
if (!wideEnoughForSplit) {
115
return {