@devries-cameron20 / t3code-1 / commits / 0e233fc3ec
Fork 0

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

fix(mobile): every inspector pane draws its bar through AppBar

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 4, 2026 at 17:52 UTC 0e233fc3ec495d0eef42cb1a33b11ee6f1763550
5 files changed +111 -63
apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx
+17 -14
@@ -9,7 +9,8 @@ import {
9 import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";
10 import { EnvironmentId, ThreadId } from "@t3tools/contracts";
11 import * as Cause from "effect/Cause";
12 -import { useEffect, useRef, useState, type RefObject } from "react";
12 +import { use, useEffect, useRef, useState, type RefObject } from "react";
13 +import { HeaderHeightContext } from "@react-navigation/elements";
14 import * as Haptics from "expo-haptics";
15 import { Accelerometer } from "expo-sensors";
16 import { Pressable, StatusBar, View } from "react-native";
@@ -26,6 +27,7 @@ import {
27 androidHeaderMenuActions,
28 findHeaderMenuAction,
29 } from "../../components/ui/headerMenu.android";
30 +import { AppBar } from "../../components/ui/AppBar";
31 import type { AppBarMenuItem } from "../../components/ui/AppBar.types";
32 import { useAppForeground } from "../../lib/appState";
33 import { useHardwareBack } from "../../lib/backHandler";
@@ -88,6 +90,8 @@ export function DevicePreviewScreen({
90 }) {
91 const embedded = onMaximize !== undefined;
92 const insets = useSafeAreaInsets();
93 + // In a pane the stream sits below the pane's bar, which content otherwise slides under.
94 + const headerHeight = use(HeaderHeightContext) ?? 0;
95 // NativeColumnContent already insets the sides, so only a book fold moves the hidden-controls pill.
96 const handleBounds = deriveBottomControlInsets(useNativeColumnLayoutMetrics());
97 const { themeVariables } = useAppearancePreferences();
@@ -265,20 +269,19 @@ export function DevicePreviewScreen({
269 <View className="flex-1" style={{ backgroundColor: themeVariables["--color-sheet-solid"] }}>
270 {!embedded ? <StatusBar hidden animated /> : null}
271 {embedded ? (
268 - <View
269 - className="flex-row items-center gap-1 px-2 pb-2"
270 - style={{ paddingTop: Math.max(insets.top, 8) }}
271 - >
272 - <SheetCloseButton accessibilityLabel="Close device preview" onClose={onClose} />
273 - <AppText numberOfLines={1} className="min-w-0 flex-1 font-t3-medium text-sm">
274 - {preview?.name ?? "Devices"}
275 - </AppText>
276 - <ControlPill
277 - accessibilityLabel="Maximize device"
278 - icon="arrow.up.left.and.arrow.down.right"
279 - onPress={() => onMaximize(preview?.key ?? null)}
272 + <>
273 + <AppBar
274 + title={preview?.name ?? "Devices"}
275 + actions={[
276 + {
277 + accessibilityLabel: "Maximize device",
278 + icon: "arrow.up.left.and.arrow.down.right",
279 + onPress: () => onMaximize(preview?.key ?? null),
280 + },
281 + ]}
282 />
281 - </View>
283 + <View style={{ height: headerHeight }} />
284 + </>
285 ) : null}
286 {preview && focused && foreground ? (
287 <OpenDevicePreview
apps/mobile/src/features/layout/inspector-host.tsx
+2 -8
@@ -47,14 +47,8 @@ function PaneScreenContent(props: {
47 return (
48 <InspectorCloseContext value={props.onClose}>
49 <PaneContext value="inspector">
50 - {props.pane.nativeStack ? (
51 - content
52 - ) : (
53 - <>
54 - <PaneHeader store={store} />
55 - <NativeColumnContent>{content}</NativeColumnContent>
56 - </>
57 - )}
50 + <PaneHeader store={store} />
51 + <NativeColumnContent>{content}</NativeColumnContent>
52 </PaneContext>
53 </InspectorCloseContext>
54 );
apps/mobile/src/features/layout/inspector-panes.ts
-2
@@ -5,8 +5,6 @@ export interface InspectorPane {
5 readonly render: () => ReactNode;
6 /** Opening one of these panes soon mounts the others too, so switching between them is instant. */
7 readonly prewarm?: boolean;
8 - /** The pane is a native stack of its own, which draws its bar and insets its content itself. */
9 - readonly nativeStack?: boolean;
8 }
9
10 /** What a route shows in the workspace's inspector: its panes and the one on screen. */
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
-2
@@ -631,8 +631,6 @@ function ThreadRouteContent(
631 {
632 key: "preview",
633 render: renderPreviewInspector,
634 - // A thread preview runs its own navigator, whose screens draw its bar.
635 - nativeStack: previewTarget?.type === "thread",
634 },
635 ]
636 : []),
apps/mobile/src/features/threads/thread-inspector-preview.tsx
+92 -37
@@ -1,20 +1,33 @@
1 import {
2 + createNavigatorFactory,
3 NavigationContainer,
4 NavigationIndependentTree,
5 + StackRouter,
6 useIsFocused,
7 useNavigation,
8 + useNavigationBuilder,
9 + type NavigatorTypeBagBase,
10 + type ParamListBase,
11 + type StackActionHelpers,
12 + type StackNavigationState,
13 + type StackRouterOptions,
14 + type StaticConfig,
15 type StaticScreenProps,
16 + type TypedNavigator,
17 } from "@react-navigation/native";
18 +import type {
19 + NativeStackNavigationEventMap,
20 + NativeStackNavigationOptions,
21 + NativeStackNavigatorProps,
22 + NativeStackTypeBag,
23 +} from "@react-navigation/native-stack";
24 import { EnvironmentId, ThreadId } from "@t3tools/contracts";
25 import { type ReactNode } from "react";
26 import { View } from "react-native";
27
12 -import { IconButton } from "../../components/ui/IconButton";
28 +import { AppBar } from "../../components/ui/AppBar";
29 import { SheetHeader } from "../../components/ui/SheetHeader";
14 -import { InspectorCloseContext } from "../layout/inspector-bar-store";
15 -import { createV5StackNavigator } from "../../native/createV5StackNavigator";
30 import { NativeStackScreenOptions } from "../../native/StackHeader";
17 -import { WorkspaceSlotOptionsContext } from "../../native/v5-workspace-context";
31 import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
32 import { DevicePreviewScreen } from "../devices/DevicePreviewRouteScreen";
33 import {
@@ -26,50 +39,96 @@ import {
39 type ThreadInspectorTarget,
40 } from "./thread-inspector-navigation";
41
29 -export interface ThreadInspectorPresentation {
30 - readonly onClose: () => void;
31 - readonly onMaximize?: () => void;
32 -}
42 +/** A thread shown outside its route: in the inspector pane, or presented full screen with a close. */
43 +export type ThreadInspectorPresentation =
44 + | { readonly onMaximize: () => void }
45 + | { readonly onClose: () => void };
46
47 export function ThreadInspectorHeader(
48 props: ThreadInspectorPresentation & { readonly title: string },
49 ) {
50 + if ("onMaximize" in props) {
51 + return (
52 + <AppBar
53 + title={props.title}
54 + actions={[
55 + {
56 + accessibilityLabel: "Maximize thread",
57 + icon: "arrow.up.left.and.arrow.down.right",
58 + onPress: props.onMaximize,
59 + },
60 + ]}
61 + />
62 + );
63 + }
64 return (
65 <>
66 <NativeStackScreenOptions options={{ headerShown: true, headerTransparent: true }} />
40 - <SheetHeader
41 - title={props.title}
42 - onClose={props.onClose}
43 - accessibilityLabel="Close thread preview"
44 - trailing={
45 - props.onMaximize ? (
46 - <IconButton
47 - icon="arrow.up.left.and.arrow.down.right"
48 - accessibilityLabel="Maximize thread"
49 - onPress={props.onMaximize}
50 - />
51 - ) : undefined
52 - }
53 - />
67 + <SheetHeader title={props.title} onClose={props.onClose} accessibilityLabel="Close thread" />
68 </>
69 );
70 }
71
58 -const PreviewStack = createV5StackNavigator<{
72 +/**
73 + * Gives the previewed thread a route of its own, so its route hooks and actions never reach the
74 + * host thread. It draws nothing: the thread's AppBar writes into the pane's bar.
75 + */
76 +function PreviewRouteNavigator({
77 + id,
78 + initialRouteName,
79 + UNSTABLE_routeNamesChangeBehavior,
80 + children,
81 + layout,
82 + screenListeners,
83 + screenOptions,
84 + screenLayout,
85 + UNSTABLE_router,
86 +}: NativeStackNavigatorProps) {
87 + const { state, descriptors, NavigationContent } = useNavigationBuilder<
88 + StackNavigationState<ParamListBase>,
89 + StackRouterOptions,
90 + StackActionHelpers<ParamListBase>,
91 + NativeStackNavigationOptions,
92 + NativeStackNavigationEventMap
93 + >(StackRouter, {
94 + id,
95 + initialRouteName,
96 + UNSTABLE_routeNamesChangeBehavior,
97 + children,
98 + layout,
99 + screenListeners,
100 + screenOptions,
101 + screenLayout,
102 + UNSTABLE_router,
103 + });
104 + const route = state.routes[state.index];
105 + return <NavigationContent>{route ? descriptors[route.key]?.render() : null}</NavigationContent>;
106 +}
107 +
108 +type PreviewTypeBag<ParamList extends ParamListBase> = Omit<
109 + NativeStackTypeBag<ParamList, undefined>,
110 + "Navigator"
111 +> & { Navigator: typeof PreviewRouteNavigator };
112 +function createPreviewRouteNavigator<
113 + const ParamList extends ParamListBase,
114 + const TypeBag extends NavigatorTypeBagBase = PreviewTypeBag<ParamList>,
115 + const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,
116 +>(config?: Config): TypedNavigator<TypeBag, Config> {
117 + return createNavigatorFactory(PreviewRouteNavigator)(config);
118 +}
119 +
120 +const PreviewStack = createPreviewRouteNavigator<{
121 Thread: { readonly environmentId: string; readonly threadId: string };
122 }>();
123
124 +/** A thread shown beside or over the workspace does not take the workspace's content width. */
125 export function InspectorContentScope({ children }: { readonly children: ReactNode }) {
126 return (
64 - <WorkspaceSlotOptionsContext value={null}>
65 - <InspectorCloseContext value={null}>
66 - <WorkspaceContentWidthContext value={null}>
67 - <WorkspaceSettledContentWidthContext value={null}>
68 - {children}
69 - </WorkspaceSettledContentWidthContext>
70 - </WorkspaceContentWidthContext>
71 - </InspectorCloseContext>
72 - </WorkspaceSlotOptionsContext>
127 + <WorkspaceContentWidthContext value={null}>
128 + <WorkspaceSettledContentWidthContext value={null}>
129 + {children}
130 + </WorkspaceSettledContentWidthContext>
131 + </WorkspaceContentWidthContext>
132 );
133 }
134
@@ -112,16 +171,12 @@ export function ThreadInspectorPreview(props: {
171 <View className="flex-1 bg-screen">
172 <NavigationIndependentTree>
173 <NavigationContainer theme={theme} onUnhandledAction={navigation.dispatch}>
115 - <PreviewStack.Navigator
116 - key={`${target.environmentId}:${target.threadId}`}
117 - screenOptions={{ headerBackVisible: false }}
118 - >
174 + <PreviewStack.Navigator key={`${target.environmentId}:${target.threadId}`}>
175 <PreviewStack.Screen name="Thread" initialParams={target}>
176 {(screen) =>
177 props.renderThread({
178 route: screen.route,
179 inspectorPresentation: {
124 - onClose: props.onClose,
180 onMaximize: () =>
181 navigation.navigate("ThreadInspectorFullscreen", {
182 environmentId: screen.route.params.environmentId,