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, 04:30 UTC
fix(mobile): the Duo inspector stops at its widest instead of vanishing (#31665)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 5, 2026 at 12:12 UTC
6a4031a4a0f1bbb106eb5bae3dce99b113c12715
4 files changed
+43
-12
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+9
-7
@@ -244,10 +244,14 @@ function AdaptiveWorkspaceLayoutContent(
244
const [primarySidebarPreferredVisible, setPrimarySidebarPreferredVisible] = useState(true);
245
const [fileInspectorPreferredVisible, setFileInspectorPreferredVisible] = useState(true);
246
const [nativeInspectorWidthFraction, setNativeInspectorWidthFraction] = useState(0.4);
247
- const nativeInspectorWidth = nativeInspectorColumnWidth(
248
- viewportWidth,
249
- nativeInspectorWidthFraction,
250
- );
247
+ const inspectorWidthFor = (fraction: number) =>
248
+ nativeInspectorColumnWidth({
249
+ viewportWidth,
250
+ horizontalSafeArea:
251
+ (nativeMetrics?.safeArea.left ?? 0) + (nativeMetrics?.safeArea.right ?? 0),
252
+ fraction,
253
+ });
254
+ const nativeInspectorWidth = inspectorWidthFor(nativeInspectorWidthFraction);
255
const [fileInspectorPreferredWidth, setFileInspectorPreferredWidth] = useState<number | null>(
256
null,
257
);
@@ -1000,9 +1004,7 @@ function AdaptiveWorkspaceLayoutContent(
1004
setAuxiliaryPaneWidth: setFileInspectorPreferredWidth,
1005
nativeInspectorWidth,
1006
setNativeInspectorWidth: (width: number) =>
1003
- setNativeInspectorWidthFraction(
1004
- nativeInspectorColumnWidth(viewportWidth, width / viewportWidth) / viewportWidth,
1005
- ),
1007
+ setNativeInspectorWidthFraction(inspectorWidthFor(width / viewportWidth) / viewportWidth),
1008
composerKeyboardActive,
1009
keyboardHoldsSidebar,
1010
setComposerEditing,
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+2
-1
@@ -33,6 +33,7 @@ import { Split, type SplitHostCommands } from "react-native-screens";
33
import { SafeAreaView } from "react-native-safe-area-context";
34
import { GestureHandlerRootView } from "react-native-gesture-handler";
35
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
36
+import { NATIVE_INSPECTOR_MIN_MAIN_WIDTH } from "../../lib/layout";
37
import { scopedThreadKey } from "../../lib/scopedEntities";
38
import { WorkspaceTabsProvider, useWorkspaceTabs } from "../workspace/WorkspaceTabsContext";
39
import {
@@ -389,7 +390,7 @@ function WorkspaceColumns(
390
minimumPrimaryColumnWidth: 280,
391
maximumPrimaryColumnWidth: Math.max(380, layout.listPaneWidth ?? 0),
392
preferredPrimaryColumnWidthOrFraction: layout.listPaneWidth ?? 320,
392
- minimumSecondaryColumnWidth: 320,
393
+ minimumSecondaryColumnWidth: NATIVE_INSPECTOR_MIN_MAIN_WIDTH,
394
// UIKit can retain its automatic width despite a new preference; constrain both edges.
395
minimumInspectorColumnWidth: inspectorWidth,
396
maximumInspectorColumnWidth: inspectorWidth,
apps/mobile/src/lib/layout.test.ts
+16
-1
@@ -169,7 +169,11 @@ describe("deriveWorkspacePaneLayout", () => {
169
nativeWorkspace: true,
170
primarySidebarPreferredVisible,
171
auxiliaryPanePreferredVisible: true,
172
- nativeInspectorWidth: nativeInspectorColumnWidth(width, 0.4),
172
+ nativeInspectorWidth: nativeInspectorColumnWidth({
173
+ viewportWidth: width,
174
+ horizontalSafeArea: 0,
175
+ fraction: 0.4,
176
+ }),
177
}),
178
).toMatchObject({
179
primarySidebarVisible: primarySidebarPreferredVisible && !suppressed,
@@ -180,6 +184,17 @@ describe("deriveWorkspacePaneLayout", () => {
184
},
185
);
186
187
+ it.each([
188
+ { viewportWidth: 1_376, horizontalSafeArea: 0 },
189
+ { viewportWidth: 951, horizontalSafeArea: 76 },
190
+ ])(
191
+ "never widens the native inspector past the page's minimum ($viewportWidth wide)",
192
+ ({ viewportWidth, horizontalSafeArea }) => {
193
+ const width = nativeInspectorColumnWidth({ viewportWidth, horizontalSafeArea, fraction: 1 });
194
+ expect(viewportWidth - horizontalSafeArea - width).toBeGreaterThanOrEqual(320);
195
+ },
196
+ );
197
+
198
it("keeps an explicitly hidden thread sidebar hidden when the file inspector is visible", () => {
199
const layout = deriveLayout({ width: 1_024, height: 1_366 });
200
apps/mobile/src/lib/layout.ts
+16
-3
@@ -60,7 +60,7 @@ const FILE_INSPECTOR_MIN_VIEWPORT_WIDTH = 820;
60
const FILE_INSPECTOR_MIN_MAIN_WIDTH = 560;
61
// UIKit's inspector column keeps its own width, so the sidebar steps aside only when the page
62
// would get narrower than this: landscape 11" and 13" iPads keep three columns, portrait ones don't.
63
-const NATIVE_INSPECTOR_MIN_MAIN_WIDTH = 320;
63
+export const NATIVE_INSPECTOR_MIN_MAIN_WIDTH = 320;
64
65
/**
66
* The window's width class. Compact: the sidebar is the root and pages push over it. Medium: the
@@ -268,8 +268,21 @@ export function deriveWorkspacePaneLayout(input: {
268
};
269
}
270
271
-export function nativeInspectorColumnWidth(viewportWidth: number, fraction: number) {
272
- return Math.max(260, Math.min(viewportWidth * 0.6, viewportWidth * fraction));
271
+/**
272
+ * UIKit drops the inspector column, and refuses to show it again, once the page beside it would
273
+ * fall under its minimum inside the safe area (the Duo's system bar takes width from the window).
274
+ */
275
+export function nativeInspectorColumnWidth(input: {
276
+ readonly viewportWidth: number;
277
+ readonly horizontalSafeArea: number;
278
+ readonly fraction: number;
279
+}) {
280
+ const { viewportWidth } = input;
281
+ const maxWidth = Math.min(
282
+ viewportWidth * 0.6,
283
+ viewportWidth - input.horizontalSafeArea - NATIVE_INSPECTOR_MIN_MAIN_WIDTH,
284
+ );
285
+ return Math.max(260, Math.min(maxWidth, viewportWidth * input.fraction));
286
}
287
288
export function deriveFileInspectorPaneLayout(input: {