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
refactor(mobile): the inspector's bar is its pane's AppBar (#27205)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 3, 2026 at 16:53 UTC
7448ad8f5843224accbb179bc266c01b75c0958c
29 files changed
+654
-917
apps/mobile/modules/t3-native-controls/ios/T3ScrollEdgeBleedView.swift
+4
-1
@@ -95,8 +95,11 @@ final class T3ScrollEdgeBleedView: ExpoView {
95
// The vertical-bar API ships in the iOS 27.1 SDK (UIKit 9127.0.85); see T3LayoutMetricsView.
96
#if canImport(UIKit, _version: 9127.0.85)
97
if #available(iOS 27.1, *) {
98
+ // UIKit leaves the trait unset in a split view's inspector column, though the bar overlaps
99
+ // it; the flush check above still decides whether this view sits at the bar.
100
+ let traits = window?.rootViewController?.traitCollection ?? traitCollection
101
let rtl = effectiveUserInterfaceLayoutDirection == .rightToLeft
99
- switch traitCollection.verticalBarEdge {
102
+ switch traits.verticalBarEdge {
103
case .leading: return rtl ? .right : .left
104
case .trailing: return rtl ? .left : .right
105
default: return nil
apps/mobile/src/Stack.tsx
+2
-26
@@ -11,10 +11,7 @@ import {
11
StackActions,
12
useNavigation,
13
} from "@react-navigation/native";
14
-import {
15
- createNativeStackScreen,
16
- type NativeStackNavigationOptions,
17
-} from "@react-navigation/native-stack";
14
+import { createNativeStackScreen } from "@react-navigation/native-stack";
15
import type { ReactNode } from "react";
16
import { Platform, Pressable, ScrollView, StyleSheet, useWindowDimensions } from "react-native";
17
import { useResolveClassNames } from "uniwind";
@@ -141,33 +138,12 @@ import {
138
SettingsLegalDocumentCloseHeaderButton,
139
SettingsLegalDocumentExternalHeaderButton,
140
} from "./features/settings/components/SettingsLegalDocumentRouteScreen";
144
-import { NATIVE_LIQUID_GLASS_SUPPORTED } from "./native/native-glass";
141
+import { GLASS_HEADER_OPTIONS, type AppScreenOptions } from "./native/glass-header-options";
142
import { deriveLayout } from "./lib/layout";
143
import { useNativeLayoutMetrics } from "./native/native-layout-metrics";
147
-import { nativeHeaderScrollEdgeEffects } from "./native/StackHeader";
144
import { HORIZONTAL_FORM_SHEET_OPTIONS, formSheetDetents } from "./native/sheet-surface";
145
import { workspaceDetailRouter } from "./features/workspace/workspace-detail-selection";
146
151
-const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
152
-
153
-type AppScreenOptions = NativeStackNavigationOptions & {
154
- readonly unstable_navigationItemStyle?: "editor";
155
- readonly unstable_headerMinimizationBehavior?: "onScrollUp" | "never";
156
-};
157
-
158
-const GLASS_HEADER_OPTIONS: AppScreenOptions = {
159
- headerBackButtonDisplayMode: "minimal",
160
- headerBackTitle: "",
161
- headerLargeTitle: false,
162
- headerShadowVisible: false,
163
- headerShown: true,
164
- headerStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? { backgroundColor: "transparent" } : undefined,
165
- headerTitleStyle: { fontSize: 18, fontWeight: "800" },
166
- headerTransparent: NATIVE_LIQUID_GLASS_SUPPORTED,
167
- scrollEdgeEffects: NATIVE_LIQUID_GLASS_SUPPORTED ? HEADER_SCROLL_EDGE_EFFECTS : undefined,
168
- unstable_navigationItemStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? "editor" : undefined,
169
-};
170
-
147
// Hiding Android's native header after mount can leave detail panes measured short.
148
// These screens render their own Material toolbar, so hide it from the first layout.
149
const DETAIL_HEADER_OPTIONS: AppScreenOptions = {
apps/mobile/src/components/ui/AppBar.android.tsx
+19
-13
@@ -1,9 +1,10 @@
1
-import { type RefObject, useRef, useState } from "react";
1
+import { type RefObject, use, useRef, useState } from "react";
2
import { Keyboard, type TextInputInstance, View } from "react-native";
3
import { useHardwareBack } from "../../lib/backHandler";
4
import { useToolbarLayout } from "./useToolbarLayout";
5
import { NativeStackScreenOptions } from "../../native/StackHeader";
6
import { useSidebarToggle } from "../../features/layout/useSidebarToggle";
7
+import { InspectorCloseContext } from "../../features/layout/inspector-bar-store";
8
import { useAppearancePreferences } from "../../features/settings/appearance/AppearancePreferencesProvider";
9
import { AndroidHeaderIconButton, AndroidScreenHeader } from "./AndroidScreenHeader";
10
import { ScreenHeaderButton } from "./ScreenHeaderButton.android";
@@ -69,8 +70,15 @@ function AppBarView(props: AppBarProps & { readonly searchState?: SearchState })
70
const { themeVariables } = useAppearancePreferences();
71
const inWorkspace = useHasWorkspaceAppBar();
72
const sidebarToggle = useSidebarToggle();
73
+ const closeInspector = use(InspectorCloseContext);
74
const inline = search?.mode === "inline";
75
const searching = searchState?.searching === true;
76
+ const actions = props.refresh
77
+ ? [
78
+ ...(props.actions ?? []),
79
+ { ...props.refresh, icon: "arrow.clockwise" as const, overflowOnly: true },
80
+ ]
81
+ : props.actions;
82
const openSearch = () => searchState?.open();
83
const closeSearch = () => searchState?.close();
84
@@ -177,24 +185,22 @@ function AppBarView(props: AppBarProps & { readonly searchState?: SearchState })
185
icon: "magnifyingglass",
186
onPress: openSearch,
187
},
180
- ...(search.refreshInToolbar && search.onRefresh
181
- ? [
182
- {
183
- accessibilityLabel: search.refreshAccessibilityLabel ?? "Refresh",
184
- icon: "arrow.clockwise" as const,
185
- onPress: search.onRefresh,
186
- },
187
- ]
188
- : []),
189
- ...(props.actions ?? []),
188
+ ...(actions ?? []),
189
]
191
- : props.actions
190
+ : actions
191
}
192
trailing={
194
- menuView?.length || props.trailing ? (
193
+ menuView?.length || props.trailing || closeInspector ? (
194
<>
195
{menuView}
196
{props.trailing}
197
+ {closeInspector ? (
198
+ <AndroidHeaderIconButton
199
+ accessibilityLabel="Close inspector"
200
+ icon="xmark"
201
+ onPress={closeInspector}
202
+ />
203
+ ) : null}
204
</>
205
) : undefined
206
}
apps/mobile/src/components/ui/AppBar.tsx
+41
-29
@@ -1,15 +1,17 @@
1
import { Toolbar } from "./Toolbar";
2
import { AppActivityIndicator } from "./AppActivityIndicator";
3
import type { HeaderBarButtonMailSearchToolbarItem } from "react-native-screens";
4
-import { useId } from "react";
4
+import { use, useId, useLayoutEffect } from "react";
5
import { View } from "react-native";
6
import { createNativeHeaderMenu } from "./nativeHeaderMenu.ios";
7
import { ScreenHeaderButton } from "./ScreenHeaderButton";
8
-import { NativeStackScreenOptions } from "../../native/StackHeader";
8
+import { NativeStackScreenOptions, useScreenOptionsWriter } from "../../native/StackHeader";
9
import { useNativeWorkspaceColumnsSupported } from "../../native/NativeWorkspaceColumns";
10
import { useDeviceType } from "../../native/native-layout-metrics";
11
+import { isDuoDevice } from "../../lib/device-type";
12
import { useAdaptiveWorkspaceLayout } from "../../features/layout/AdaptiveWorkspaceLayout";
13
import { useSidebarToggle } from "../../features/layout/useSidebarToggle";
14
+import { InspectorCloseContext } from "../../features/layout/inspector-bar-store";
15
import {
16
createNativeMailSearchToolbarItem,
17
NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED,
@@ -44,6 +46,15 @@ export function AppBar(props: AppBarProps) {
46
const headerId = useId();
47
const { layout } = useAdaptiveWorkspaceLayout();
48
const sidebarToggle = useSidebarToggle();
49
+ const closeInspector = use(InspectorCloseContext);
50
+ const setOptions = useScreenOptionsWriter();
51
+ const ownsInspectorBar = closeInspector !== null && !props.embedded && !props.sheet;
52
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- an inspector pane that stops drawing its bar must not leave it in the out-of-tree inspector bar
53
+ useLayoutEffect(() => {
54
+ if (!ownsInspectorBar || !setOptions) return;
55
+ setOptions({ headerShown: true });
56
+ return () => setOptions({ headerShown: false });
57
+ }, [ownsInspectorBar, setOptions]);
58
// The Duo's native columns show their own sidebar button while the sidebar is open.
59
const showsSidebarToggle =
60
sidebarToggle !== null &&
@@ -62,16 +73,18 @@ export function AppBar(props: AppBarProps) {
73
(search.compactToolbar ?? !layout.usesSplitView) &&
74
usesNativeMailSearchToolbar;
75
const visibleMenus = compactSearch ? (menus?.slice(1) ?? []) : (menus ?? []);
65
- const refresh = search?.refreshInToolbar ? search.onRefresh : undefined;
76
+ // Where the mail toolbar isn't used, the Duo keeps search at the bottom of the pane like its
77
+ // workspace lists; elsewhere inline search is a button in the bar.
78
+ const duoBottomSearch =
79
+ search !== undefined &&
80
+ !compactSearch &&
81
+ NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED &&
82
+ isDuoDevice(deviceType);
83
if (props.embedded || props.sheet) return null;
84
return (
85
<>
86
<NativeStackScreenOptions
70
- optionsVersion={[
71
- props.optionsVersion,
72
- compactSearch ? menu : undefined,
73
- compactSearch ? refresh : undefined,
74
- ]}
87
+ optionsVersion={[props.optionsVersion, compactSearch ? menu : undefined]}
88
options={{
89
headerShown: true,
90
headerBackVisible: splitBack === null,
@@ -89,13 +102,6 @@ export function AppBar(props: AppBarProps) {
102
placeholder: search.compactPlaceholder ?? search.placeholder,
103
onSearchTextChange: search.onChangeText,
104
searchTextChangeId: `${headerId}-search-text`,
92
- ...(refresh
93
- ? {
94
- composeButtonId: `${headerId}-refresh`,
95
- composeSystemImageName: "arrow.clockwise",
96
- onComposePress: refresh,
97
- }
98
- : undefined),
105
...(menu
106
? {
107
filterButtonId: `${headerId}-filter`,
@@ -110,12 +116,16 @@ export function AppBar(props: AppBarProps) {
116
? undefined
117
: {
118
allowToolbarIntegration: true,
113
- ...(NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED && search.mode === "inline"
114
- ? { placement: "integratedButton" as const }
115
- : undefined),
119
+ ...(duoBottomSearch
120
+ ? { placement: "integrated" as const }
121
+ : NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED && search.mode === "inline"
122
+ ? { placement: "integratedButton" as const }
123
+ : undefined),
124
autoCapitalize: "none",
125
hideNavigationBar: false,
118
- ...(search.mode === "inline" ? { obscureBackground: false } : undefined),
126
+ ...(search.mode === "inline" || duoBottomSearch
127
+ ? { obscureBackground: false }
128
+ : undefined),
129
placeholder: search.placeholder,
130
onChangeText: (event) => search.onChangeText(event.nativeEvent.text),
131
onCancelButtonPress: () => search.onChangeText(""),
@@ -140,10 +150,7 @@ export function AppBar(props: AppBarProps) {
150
) : null}
151
</Toolbar>
152
) : null}
143
- {(props.actions?.length ||
144
- (!compactSearch && refresh) ||
145
- visibleMenus.length ||
146
- props.trailing) &&
153
+ {(props.actions?.length || visibleMenus.length || props.trailing || closeInspector) &&
154
props.options?.unstable_headerRightItems === undefined ? (
155
<Toolbar placement="right">
156
{props.actions?.map(({ loading, ...action }) =>
@@ -165,16 +172,21 @@ export function AppBar(props: AppBarProps) {
172
/>
173
),
174
)}
168
- {refresh && !compactSearch ? (
175
+ {visibleMenus.map(createNativeHeaderMenu)}
176
+ {props.trailing}
177
+ {closeInspector ? (
178
<ScreenHeaderButton
170
- accessibilityLabel={search?.refreshAccessibilityLabel}
171
- icon="arrow.clockwise"
172
- onPress={refresh}
179
+ accessibilityLabel="Close inspector"
180
+ icon="xmark"
181
+ onPress={closeInspector}
182
separateBackground
183
/>
184
) : null}
176
- {visibleMenus.map(createNativeHeaderMenu)}
177
- {props.trailing}
185
+ </Toolbar>
186
+ ) : null}
187
+ {duoBottomSearch ? (
188
+ <Toolbar placement="bottom">
189
+ <Toolbar.SearchBarSlot />
190
</Toolbar>
191
) : null}
192
</>
apps/mobile/src/components/ui/AppBar.types.ts
+2
-3
@@ -57,9 +57,6 @@ export interface AppBarSearch {
57
readonly compactPlaceholder?: string;
58
readonly closeAccessibilityLabel?: string;
59
readonly clearAccessibilityLabel?: string;
60
- readonly onRefresh?: () => void;
61
- readonly refreshAccessibilityLabel?: string;
62
- readonly refreshInToolbar?: boolean;
60
/** Controlled open state. The owner then also handles back and the keyboard shortcut. */
61
readonly active?: boolean;
62
readonly onOpen?: () => void;
@@ -72,6 +69,8 @@ export interface AppBarProps {
69
readonly titleContent?: ReactNode;
70
readonly subtitle?: string | null;
71
readonly actions?: ReadonlyArray<AppBarAction>;
72
+ /** Pull-to-refresh is the gesture on both platforms; Android also lists this in the overflow menu. */
73
+ readonly refresh?: Pick<AppBarAction, "accessibilityLabel" | "disabled" | "onPress">;
74
readonly menus?: ReadonlyArray<AppBarMenu>;
75
readonly search?: AppBarSearch;
76
readonly onBack?: () => void;
apps/mobile/src/features/files/FilesHeader.tsx
deleted
-98
@@ -1,98 +0,0 @@
1
-import { useRef, useState, type ReactNode } from "react";
2
-import { Keyboard, type TextInputInstance, View } from "react-native";
3
-
4
-import { AndroidHeaderIconButton } from "../../components/ui/AndroidScreenHeader";
5
-import { AppBar } from "../../components/ui/AppBar";
6
-import { AndroidAnchoredMenu } from "../../components/ui/AndroidAnchoredMenu";
7
-import { SearchField } from "../../components/ui/SearchField";
8
-import { useToolbarLayout } from "../../components/ui/useToolbarLayout";
9
-import { useHardwareBack } from "../../lib/backHandler";
10
-
11
-export function FilesHeader(props: {
12
- readonly projectName: string;
13
- readonly searchQuery: string;
14
- readonly onSearchQueryChange: (query: string) => void;
15
- readonly onRefresh: () => void;
16
- readonly onBack?: () => void;
17
- readonly leading?: ReactNode;
18
-}) {
19
- const { paddingTop, paddingBottom } = useToolbarLayout();
20
- const searchRef = useRef<TextInputInstance>(null);
21
- const [searchOpen, setSearchOpen] = useState(false);
22
- const searching = searchOpen || props.searchQuery.length > 0;
23
- const { onSearchQueryChange } = props;
24
- const closeSearch = () => {
25
- onSearchQueryChange("");
26
- setSearchOpen(false);
27
- Keyboard.dismiss();
28
- };
29
-
30
- useHardwareBack(searching, () => {
31
- closeSearch();
32
- return true;
33
- });
34
-
35
- return (
36
- <View>
37
- {}
38
- <View
39
- pointerEvents={searching ? "none" : "auto"}
40
- accessibilityElementsHidden={searching}
41
- importantForAccessibility={searching ? "no-hide-descendants" : "auto"}
42
- style={{ opacity: searching ? 0 : 1 }}
43
- >
44
- <AppBar
45
- embedded
46
- title="Files"
47
- subtitle={props.projectName}
48
- hideBottomBorder
49
- onBack={props.onBack}
50
- leading={props.leading}
51
- actions={[
52
- {
53
- accessibilityLabel: "Search files",
54
- icon: "magnifyingglass",
55
- onPress: () => setSearchOpen(true),
56
- },
57
- ]}
58
- trailing={
59
- <AndroidAnchoredMenu
60
- title="File options"
61
- actions={[{ id: "refresh", title: "Refresh files" }]}
62
- onPressAction={({ nativeEvent }) => {
63
- if (nativeEvent.event === "refresh") props.onRefresh();
64
- }}
65
- >
66
- {(open) => (
67
- <AndroidHeaderIconButton
68
- accessibilityLabel="File options"
69
- icon="ellipsis"
70
- onPress={open}
71
- />
72
- )}
73
- </AndroidAnchoredMenu>
74
- }
75
- />
76
- </View>
77
- {searching ? (
78
- <View className="absolute inset-0 bg-header px-2" style={{ paddingTop, paddingBottom }}>
79
- <View className="flex-1 flex-row items-center gap-1">
80
- <AndroidHeaderIconButton
81
- accessibilityLabel="Close file search"
82
- icon="arrow.left"
83
- onPress={closeSearch}
84
- />
85
- <SearchField
86
- inputRef={searchRef}
87
- accessibilityLabel="Search files"
88
- clearAccessibilityLabel="Clear file search"
89
- placeholder="Search files"
90
- value={props.searchQuery}
91
- onChangeText={onSearchQueryChange}
92
- />
93
- </View>
94
- </View>
95
- ) : null}
96
- </View>
97
- );
98
-}
apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx
+9
-15
@@ -42,7 +42,6 @@ import { useAppearancePreferences } from "../settings/appearance/AppearancePrefe
42
import { ThreadRouteScreen } from "../threads/ThreadRouteScreen";
43
import { FilePreviewLoading, FilePreviewNotice } from "./FilePreviewFeedback";
44
import { FileMarkdownPreview } from "./FileMarkdownPreview";
45
-import { ThreadInspectorContentStack } from "../threads/thread-inspector-content-stack";
45
import { FileTreeBrowser } from "./FileTreeBrowser";
46
import { useFileTreeEntries } from "./useFileTreeEntries";
47
import { preloadWorkspaceFileContents } from "./preload-workspace-file";
@@ -486,12 +485,11 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
485
}
486
navigation.navigate("ThreadFile", params);
487
};
489
- const renderInspector = (headerInset: number) =>
488
+ const renderInspector = () =>
489
environmentId !== null && cwd !== null ? (
490
<ThreadFileNavigatorPane
491
cwd={cwd}
492
environmentId={environmentId}
494
- headerInset={headerInset}
493
projectName={projectName}
494
selectedPath={null}
495
onSelectFile={handleSelectFile}
@@ -749,12 +747,11 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
747
if (directoryPath !== null) navigation.dispatch(StackActions.push("ThreadFile", destination));
748
else navigation.navigate("ThreadFile", destination);
749
};
752
- const renderInspector = (headerInset: number) =>
750
+ const renderInspector = () =>
751
fileInspector.supported && environmentId !== null && cwd !== null ? (
752
<ThreadFileNavigatorPane
753
cwd={directoryPath ?? cwd}
754
environmentId={environmentId}
757
- headerInset={headerInset}
755
projectName={directoryPath ?? projectName}
756
selectedPath={directoryPath === null ? relativePath : null}
757
onSelectFile={(path) => {
@@ -763,17 +760,14 @@ export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {
760
}}
761
/>
762
) : undefined;
766
- const safeAreaInsets = useSafeAreaInsets();
767
- const inspectorHeaderInset = Platform.OS === "ios" ? 0 : safeAreaInsets.top;
768
- const renderWorkspaceInspector = () => (
769
- <ThreadInspectorContentStack
770
- mode="files"
771
- resetKeys={[threadId, cwd]}
772
- renderFiles={() => renderInspector(inspectorHeaderInset)}
773
- />
774
- );
763
const inspector = fileInspector.supported ? (
776
- <Inspector>{renderWorkspaceInspector()}</Inspector>
764
+ <Inspector
765
+ content={{
766
+ active: "files",
767
+ resetKeys: [threadId, cwd],
768
+ panes: [{ key: "files", render: renderInspector }],
769
+ }}
770
+ />
771
) : null;
772
const withInspector = (content: ReactNode) => (
773
<>
apps/mobile/src/features/files/thread-file-navigator-pane.tsx
+14
-149
@@ -1,46 +1,27 @@
1
import { resolveFilesystemReadAccess } from "@t3tools/client-runtime/state/filesystem";
2
import { environmentSession } from "../../state/session";
3
import type { EnvironmentId } from "@t3tools/contracts";
4
-import { SymbolView } from "../../components/ui/AppSymbol";
4
+import { AppBar } from "../../components/ui/AppBar";
5
import { ScreenContent } from "../../components/ui/ScreenContent";
6
-import { useState, type ComponentProps } from "react";
7
-import { Platform, Pressable, View, type NativeSyntheticEvent } from "react-native";
8
-import {
9
- Screen,
10
- ScreenStack,
11
- ScreenStackHeaderConfig,
12
- ScreenStackHeaderSearchBarView,
13
- SearchBar,
14
-} from "react-native-screens";
6
+import { useState } from "react";
7
+import { View } from "react-native";
8
16
-import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
17
-import { FilesHeader } from "./FilesHeader";
18
-import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
19
-import { useUniwindTheme } from "../../lib/useUniwindTheme";
9
import { useEnvironmentQuery } from "../../state/query";
10
import { useEnvironmentPresentation } from "../../state/presentation";
11
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
12
import { FileTreeBrowser } from "./FileTreeBrowser";
24
-import { NativeInspectorContent } from "../../native/NativeInspectorContent";
13
import { useFileTreeEntries } from "./useFileTreeEntries";
14
import { preloadWorkspaceFileContents } from "./preload-workspace-file";
27
-import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
15
16
export function ThreadFileNavigatorPane(props: {
17
readonly cwd: string;
18
readonly environmentId: EnvironmentId;
32
- readonly headerInset: number;
19
readonly projectName: string;
20
readonly selectedPath: string | null;
21
readonly onSelectFile: (path: string) => void;
22
}) {
23
const [searchQuery, setSearchQuery] = useState("");
38
- const { toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout();
24
const { themeAppearance: highlightTheme } = useAppearancePreferences();
40
- const theme = useUniwindTheme();
41
- const foregroundColor = theme["--color-foreground"];
42
- const sheetColor = theme["--color-sheet"];
43
- const headerScrollEdgeEffects = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
25
const fileAccessSession = useEnvironmentQuery(
26
environmentSession.sessionStateAtom(props.environmentId),
27
);
@@ -65,18 +46,6 @@ export function ThreadFileNavigatorPane(props: {
46
theme: highlightTheme,
47
});
48
};
68
- const nativeHeaderRightBarButtonItems = [
69
- {
70
- accessibilityLabel: "Close files",
71
- icon: { name: "xmark", type: "sfSymbol" as const },
72
- identifier: "thread-file-navigator-close",
73
- onPress: toggleAuxiliaryPane,
74
- sharesBackground: false,
75
- tintColor: foregroundColor,
76
- type: "button" as const,
77
- },
78
- ] as ComponentProps<typeof ScreenStackHeaderConfig>["headerRightBarButtonItems"];
79
-
49
const fileTree = (
50
<FileTreeBrowser
51
key={JSON.stringify([props.environmentId, props.cwd])}
@@ -108,122 +77,18 @@ export function ThreadFileNavigatorPane(props: {
77
/>
78
);
79
111
- if (Platform.OS === "ios") {
112
- return (
113
- <View className="flex-1 border-l border-border bg-sheet">
114
- <ScreenStack style={{ flex: 1 }}>
115
- <Screen
116
- activityState={2}
117
- enabled
118
- isNativeStack
119
- screenId="thread-file-navigator-native"
120
- scrollEdgeEffects={headerScrollEdgeEffects}
121
- style={{ backgroundColor: sheetColor, flex: 1 }}
122
- >
123
- <NativeInspectorContent>{fileTree}</NativeInspectorContent>
124
- <ScreenStackHeaderConfig
125
- backgroundColor="rgba(0,0,0,0)"
126
- color={foregroundColor}
127
- headerRightBarButtonItems={nativeHeaderRightBarButtonItems}
128
- hideBackButton
129
- hideShadow={false}
130
- navigationItemStyle="editor"
131
- subtitle={props.projectName}
132
- title="Files"
133
- titleColor={foregroundColor}
134
- titleFontSize={17}
135
- titleFontWeight="700"
136
- translucent
137
- >
138
- <ScreenStackHeaderSearchBarView>
139
- <SearchBar
140
- allowToolbarIntegration
141
- autoCapitalize="none"
142
- barTintColor={sheetColor}
143
- hideNavigationBar={false}
144
- hideWhenScrolling={false}
145
- obscureBackground={false}
146
- onCancelButtonPress={() => {
147
- setSearchQuery("");
148
- }}
149
- onChangeText={(event: NativeSyntheticEvent<{ readonly text?: string }>) => {
150
- setSearchQuery(event.nativeEvent.text ?? "");
151
- }}
152
- placement="integratedButton"
153
- placeholder="Search files"
154
- textColor={foregroundColor}
155
- tintColor={foregroundColor}
156
- />
157
- </ScreenStackHeaderSearchBarView>
158
- </ScreenStackHeaderConfig>
159
- </Screen>
160
- </ScreenStack>
161
- </View>
162
- );
163
- }
164
-
80
return (
166
- <View
167
- className={
168
- Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 border-l border-border bg-sheet"
169
- }
170
- >
171
- <View
172
- className="ios:border-b ios:border-border android:bg-header"
173
- style={{ paddingTop: Platform.OS === "android" ? 0 : props.headerInset }}
174
- >
175
- {Platform.OS === "android" ? (
176
- <FilesHeader
177
- projectName={props.projectName}
178
- searchQuery={searchQuery}
179
- onSearchQueryChange={setSearchQuery}
180
- onRefresh={entriesQuery.refresh}
181
- />
182
- ) : (
183
- <View className="h-12 flex-row items-center gap-2 px-3">
184
- <View className="min-w-0 flex-1">
185
- <Text className="text-sm font-t3-bold text-foreground">Files</Text>
186
- <Text className="text-xs text-foreground-muted" numberOfLines={1}>
187
- {props.projectName}
188
- </Text>
189
- </View>
190
- <Pressable
191
- accessibilityRole="button"
192
- accessibilityLabel="Refresh files"
193
- hitSlop={8}
194
- className="h-8 w-8 items-center justify-center rounded-full active:bg-subtle"
195
- onPress={entriesQuery.refresh}
196
- >
197
- <SymbolView
198
- name="arrow.clockwise"
199
- size={14}
200
- tintColorClassName="accent-icon-muted"
201
- type="monochrome"
202
- />
203
- </Pressable>
204
- </View>
205
- )}
206
- {Platform.OS !== "android" ? (
207
- <View className="flex-row items-center gap-2 border-t border-border px-3 py-2">
208
- <SymbolView
209
- name="magnifyingglass"
210
- size={15}
211
- tintColorClassName="accent-icon-muted"
212
- type="monochrome"
213
- />
214
- <TextInput
215
- accessibilityLabel="Search files"
216
- autoCapitalize="none"
217
- autoCorrect={false}
218
- clearButtonMode="while-editing"
219
- className="min-h-10 flex-1 rounded-xl py-2 text-sm"
220
- placeholder="Search files"
221
- value={searchQuery}
222
- onChangeText={setSearchQuery}
223
- />
224
- </View>
225
- ) : null}
226
- </View>
81
+ <View className="flex-1 ios:bg-sheet android:bg-header">
82
+ <AppBar
83
+ title="Files"
84
+ subtitle={props.projectName}
85
+ search={{
86
+ value: searchQuery,
87
+ onChangeText: setSearchQuery,
88
+ placeholder: "Search files",
89
+ }}
90
+ refresh={{ accessibilityLabel: "Refresh files", onPress: entriesQuery.refresh }}
91
+ />
92
<ScreenContent insetHorizontal>{fileTree}</ScreenContent>
93
</View>
94
);
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+31
-21
@@ -82,6 +82,7 @@ import { PaneContext } from "../../components/ui/Pane";
82
import { WORKSPACE_PANE_TIMING } from "./workspace-pane-animation";
83
import { WorkspaceInspectorPane } from "./workspace-inspector-pane";
84
import { WorkspaceInspectorSheet } from "./workspace-inspector-sheet";
85
+import type { InspectorContent } from "./inspector-panes";
86
import {
87
WorkspaceContentWidthContext,
88
WorkspaceSettledContentWidthContext,
@@ -112,24 +113,31 @@ import { WorkspaceThreadSidebar } from "../workspace/WorkspaceThreadSidebar";
113
export { useAdaptiveWorkspaceLayout };
114
115
/**
115
- * Shows its children in the workspace's inspector column while this screen is focused. Register on
116
- * focus events because frozen blurred screens may never clean up.
116
+ * Shows these panes in the workspace's inspector while this screen is focused. Register on focus
117
+ * events because frozen blurred screens may never clean up.
118
*/
119
export function Inspector(props: {
119
- readonly children: ReactNode;
120
+ readonly content: InspectorContent;
121
/** Opens the column the first time this key registers while its route stays on the stack. */
122
readonly revealKey?: string;
123
}) {
124
const { registerWorkspaceInspector } = useAdaptiveWorkspaceLayout();
125
const navigation = use(NavigationContext);
126
const route = use(NavigationRouteContext);
126
- const render = () => (
127
- <NavigationContext.Provider value={navigation}>
128
- <NavigationRouteContext.Provider value={route}>
129
- {props.children}
130
- </NavigationRouteContext.Provider>
131
- </NavigationContext.Provider>
132
- );
127
+ const content: InspectorContent = {
128
+ ...props.content,
129
+ resetKeys: [route?.key, ...(props.content.resetKeys ?? [])],
130
+ panes: props.content.panes.map((pane) => ({
131
+ ...pane,
132
+ render: () => (
133
+ <NavigationContext.Provider value={navigation}>
134
+ <NavigationRouteContext.Provider value={route}>
135
+ {pane.render()}
136
+ </NavigationRouteContext.Provider>
137
+ </NavigationContext.Provider>
138
+ ),
139
+ })),
140
+ };
141
const focusedRef = useRef(false);
142
const deactivateRef = useRef<(() => void) | null>(null);
143
@@ -138,7 +146,7 @@ export function Inspector(props: {
146
deactivateRef.current?.();
147
return;
148
}
141
- deactivateRef.current = registerWorkspaceInspector(render, route?.key, props.revealKey);
149
+ deactivateRef.current = registerWorkspaceInspector(content, route?.key, props.revealKey);
150
});
151
152
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Navigation focus events own the inspector registration lifetime.
@@ -171,7 +179,7 @@ export function Inspector(props: {
179
syncRegistration();
180
}
181
// oxlint-disable-next-line react/exhaustive-effect-dependencies -- Changed column content replaces its existing native workspace registration.
174
- }, [props.children, props.revealKey]);
182
+ }, [props.content, props.revealKey]);
183
return null;
184
}
185
@@ -350,7 +358,7 @@ function AdaptiveWorkspaceLayoutContent(
358
],
359
);
360
const [workspaceInspector, setWorkspaceInspector] = useState<{
353
- readonly render: () => ReactNode;
361
+ readonly content: InspectorContent;
362
readonly active: boolean;
363
readonly routeKey: string | undefined;
364
} | null>(null);
@@ -393,13 +401,13 @@ function AdaptiveWorkspaceLayoutContent(
401
const revealedInspectors = useRef<ReadonlyMap<string, string>>(new Map());
402
const workspaceInspectorOwner = useRef<symbol | null>(null);
403
const registerWorkspaceInspector = (
396
- render: () => ReactNode,
404
+ content: InspectorContent,
405
routeKey: string | undefined,
406
revealKey?: string,
407
) => {
408
const owner = Symbol("workspace-inspector");
409
workspaceInspectorOwner.current = owner;
402
- setWorkspaceInspector({ render, active: true, routeKey });
410
+ setWorkspaceInspector({ content, active: true, routeKey });
411
if (
412
routeKey !== undefined &&
413
revealKey !== undefined &&
@@ -828,9 +836,11 @@ function AdaptiveWorkspaceLayoutContent(
836
};
837
838
const inspectorSheet = (
831
- <WorkspaceInspectorSheet open={inspectorSheetOpen} onClose={dismissInspectorSheet}>
832
- {workspaceInspector?.render()}
833
- </WorkspaceInspectorSheet>
839
+ <WorkspaceInspectorSheet
840
+ open={inspectorSheetOpen}
841
+ onClose={dismissInspectorSheet}
842
+ content={workspaceInspector?.content}
843
+ />
844
);
845
if (nativeWorkspace) {
846
return (
@@ -842,7 +852,7 @@ function AdaptiveWorkspaceLayoutContent(
852
<NativeWorkspaceInspectorContext
853
value={{
854
// Without a column the sheet shows it; the hidden native column must not mount it too.
845
- render: fileInspector.supported ? workspaceInspector?.render : undefined,
855
+ content: fileInspector.supported ? workspaceInspector?.content : undefined,
856
visible: inspectorColumnTargetWidth > 0,
857
}}
858
>
@@ -999,12 +1009,12 @@ function AdaptiveWorkspaceLayoutContent(
1009
) : null}
1010
<PaneContext value="inspector">
1011
<WorkspaceInspectorPane
1002
- pathname={props.pathname}
1012
renderedInspectorWidth={renderedInspectorWidth}
1013
active={workspaceInspector?.active ?? false}
1014
panes={panes}
1006
- renderInspector={workspaceInspector?.render}
1015
+ content={workspaceInspector?.content}
1016
setAuxiliaryPaneWidth={setFileInspectorPreferredWidth}
1017
+ onClose={() => setFileInspectorPreferredVisible(false)}
1018
onClosed={handleWorkspaceInspectorClosed}
1019
/>
1020
</PaneContext>
apps/mobile/src/features/layout/adaptive-workspace-context.ts
+3
-2
@@ -1,5 +1,6 @@
1
import type { WorkspaceTab } from "../workspace/workspace-tabs-state";
2
-import { createContext, use, type ReactNode } from "react";
2
+import { createContext, use } from "react";
3
+import type { InspectorContent } from "./inspector-panes";
4
import type {
5
WorkspaceDetail,
6
WorkspaceDetailSheet,
@@ -22,7 +23,7 @@ interface AdaptiveWorkspaceContextValue {
23
/** Use `useSelectWorkspaceDetail`, which also works outside the layout. */
24
readonly selectDetail?: (detail: WorkspaceDetail, sheet?: WorkspaceDetailSheet) => void;
25
readonly registerWorkspaceInspector: (
25
- render: () => ReactNode,
26
+ content: InspectorContent,
27
routeKey: string | undefined,
28
revealKey?: string,
29
) => () => void;
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+42
-48
@@ -48,6 +48,7 @@ import {
48
useNativeWorkspaceColumnsSupported,
49
} from "../../native/NativeWorkspaceColumns";
50
import { V5StackHeader } from "../../native/V5StackHeader.ios";
51
+import { InspectorColumnScreens } from "./inspector-host";
52
import { PaneContext } from "../../components/ui/Pane";
53
import { useWorkspaceSidebarHeaderItem } from "./useWorkspaceSidebarHeaderItem";
54
import type { AppNativeStackNavigationOptions } from "../../native/StackHeader";
@@ -248,6 +249,9 @@ function WorkspaceColumns(
249
? openNewTask
250
: undefined;
251
const inspector = use(NativeWorkspaceInspectorContext);
252
+ const hideInspector = () => {
253
+ if (inspector.visible) toggleAuxiliaryPane();
254
+ };
255
const hostRef = useRef<SplitHostCommands>(null);
256
const activeDetailKey = props.detail.at(-1)?.key;
257
const compactColumn = activeDetailKey ? "secondary" : "primary";
@@ -369,9 +373,7 @@ function WorkspaceColumns(
373
displayModeButtonVisibility="never"
374
presentsWithGesture
375
showInspector={inspector.visible}
372
- onInspectorHide={() => {
373
- if (inspector.visible) toggleAuxiliaryPane();
374
- }}
376
+ onInspectorHide={hideInspector}
377
columnMetrics={{
378
minimumPrimaryColumnWidth: 280,
379
maximumPrimaryColumnWidth: Math.max(380, layout.listPaneWidth ?? 0),
@@ -434,52 +436,44 @@ function WorkspaceColumns(
436
})}
437
</Split.Stack>
438
</Split.Column>
437
- <Split.Inspector>
438
- <Split.HeaderConfig hidden />
439
- {/* Inspector panes host their own native stacks, which UIKit insets for the Duo's
440
- vertical bar wherever they sit, so each pane insets its own content instead. */}
441
- <ColumnContent insetHorizontally={false}>
442
- <View className="flex-1 bg-screen">
443
- <PaneContext value="inspector">{inspector.render?.()}</PaneContext>
444
- {inspector.visible ? (
445
- <GestureHandlerRootView
446
- style={[StyleSheet.absoluteFill, { zIndex: 100 }]}
447
- pointerEvents="box-none"
448
- collapsable={false}
449
- >
450
- <SafeAreaView
451
- style={{ flex: 1 }}
452
- edges={["left", "right"]}
453
- pointerEvents="box-none"
454
- >
455
- <View className="flex-1" pointerEvents="box-none">
456
- <View
457
- className="absolute inset-y-0 left-0 w-[22px] flex-row"
458
- pointerEvents="box-none"
459
- >
460
- <WorkspacePaneDivider
461
- accessibilityLabel="Resize inspector"
462
- currentWidth={inspectorWidth}
463
- resizeDirection={-1}
464
- onResizeStart={() => {
465
- resizeStartWidth.current = inspectorWidth;
466
- }}
467
- onResizeBy={(delta) => {
468
- const width = Math.max(
469
- 260,
470
- Math.min(viewportWidth * 0.6, resizeStartWidth.current + delta),
471
- );
472
- setInspectorWidthFraction(width / viewportWidth);
473
- }}
474
- />
475
- </View>
439
+ <InspectorColumnScreens
440
+ content={inspector.content}
441
+ onClose={hideInspector}
442
+ overlay={
443
+ inspector.visible ? (
444
+ <GestureHandlerRootView
445
+ style={[StyleSheet.absoluteFill, { zIndex: 100 }]}
446
+ pointerEvents="box-none"
447
+ collapsable={false}
448
+ >
449
+ <SafeAreaView style={{ flex: 1 }} edges={["left", "right"]} pointerEvents="box-none">
450
+ <View className="flex-1" pointerEvents="box-none">
451
+ <View
452
+ className="absolute inset-y-0 left-0 w-[22px] flex-row"
453
+ pointerEvents="box-none"
454
+ >
455
+ <WorkspacePaneDivider
456
+ accessibilityLabel="Resize inspector"
457
+ currentWidth={inspectorWidth}
458
+ resizeDirection={-1}
459
+ onResizeStart={() => {
460
+ resizeStartWidth.current = inspectorWidth;
461
+ }}
462
+ onResizeBy={(delta) => {
463
+ const width = Math.max(
464
+ 260,
465
+ Math.min(viewportWidth * 0.6, resizeStartWidth.current + delta),
466
+ );
467
+ setInspectorWidthFraction(width / viewportWidth);
468
+ }}
469
+ />
470
</View>
477
- </SafeAreaView>
478
- </GestureHandlerRootView>
479
- ) : null}
480
- </View>
481
- </ColumnContent>
482
- </Split.Inspector>
471
+ </View>
472
+ </SafeAreaView>
473
+ </GestureHandlerRootView>
474
+ ) : null
475
+ }
476
+ />
477
</Split.Host>
478
);
479
}
apps/mobile/src/features/layout/inspector-bar-store.tsx
new
+40
@@ -0,0 +1,40 @@
1
+import { createContext, useMemo, useState } from "react";
2
+
3
+/** Closes the inspector from its bar: hides the column, or dismisses the sheet. */
4
+export const InspectorCloseContext = createContext<(() => void) | null>(null);
5
+
6
+const NO_ROUTES: ReadonlyMap<string, object> = new Map();
7
+
8
+/** The options a pane's AppBar sets. External so a write re-renders the bar, not the pane. */
9
+function createInspectorBarStore() {
10
+ let snapshot: object | undefined;
11
+ const listeners = new Set<() => void>();
12
+ return {
13
+ set(options: object) {
14
+ snapshot = { ...snapshot, ...options };
15
+ for (const listener of listeners) listener();
16
+ },
17
+ subscribe(listener: () => void) {
18
+ listeners.add(listener);
19
+ return () => {
20
+ listeners.delete(listener);
21
+ };
22
+ },
23
+ getSnapshot: () => snapshot,
24
+ };
25
+}
26
+
27
+export type InspectorBarStore = ReturnType<typeof createInspectorBarStore>;
28
+
29
+/** Routes a pane's AppBar options into its own bar instead of the thread route's. */
30
+export function useInspectorBarSlot() {
31
+ const [store] = useState(createInspectorBarStore);
32
+ const slot = useMemo(
33
+ () => ({
34
+ byRoute: NO_ROUTES,
35
+ set: (_routeKey: string, options: object) => store.set(options),
36
+ }),
37
+ [store],
38
+ );
39
+ return { store, slot };
40
+}
apps/mobile/src/features/layout/inspector-host.android.tsx
new
+67
@@ -0,0 +1,67 @@
1
+import { View } from "react-native";
2
+
3
+import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
4
+import { PaneContext } from "../../components/ui/Pane";
5
+import { WorkspaceSlotOptionsContext } from "../../native/v5-workspace-context";
6
+import { InspectorCloseContext, useInspectorBarSlot } from "./inspector-bar-store";
7
+import {
8
+ useMountedInspectorPanes,
9
+ type InspectorContent,
10
+ type InspectorPane,
11
+} from "./inspector-panes";
12
+
13
+// AppBar draws the bar inline on Android; the slot keeps a pane's options off the thread's route.
14
+function PaneContent(props: {
15
+ readonly pane: InspectorPane;
16
+ readonly resetKeys: ReadonlyArray<unknown> | undefined;
17
+}) {
18
+ const { slot } = useInspectorBarSlot();
19
+ return (
20
+ <WorkspaceSlotOptionsContext value={slot}>
21
+ <RenderErrorBoundary
22
+ resetKeys={props.resetKeys}
23
+ renderFallback={(fallback) => (
24
+ <RenderFailureView {...fallback} title="The inspector couldn't be displayed" />
25
+ )}
26
+ >
27
+ {props.pane.render()}
28
+ </RenderErrorBoundary>
29
+ </WorkspaceSlotOptionsContext>
30
+ );
31
+}
32
+
33
+/** The inspector's panes, stacked in place: Android draws no native chrome a hidden pane could leave. */
34
+export function InspectorPanes(props: {
35
+ readonly content: InspectorContent | undefined;
36
+ readonly onClose: () => void;
37
+}) {
38
+ const panes = useMountedInspectorPanes(props.content);
39
+ return (
40
+ <InspectorCloseContext value={props.onClose}>
41
+ <PaneContext value="inspector">
42
+ <View className="flex-1">
43
+ {panes.map((pane) => {
44
+ const visible = pane.key === props.content?.active;
45
+ return (
46
+ <View
47
+ key={pane.key}
48
+ accessibilityElementsHidden={!visible}
49
+ focusable={visible}
50
+ importantForAccessibility={visible ? "auto" : "no-hide-descendants"}
51
+ pointerEvents={visible ? "auto" : "none"}
52
+ style={{
53
+ position: "absolute",
54
+ inset: 0,
55
+ opacity: visible ? 1 : 0,
56
+ zIndex: visible ? 1 : 0,
57
+ }}
58
+ >
59
+ <PaneContent pane={pane} resetKeys={props.content?.resetKeys} />
60
+ </View>
61
+ );
62
+ })}
63
+ </View>
64
+ </PaneContext>
65
+ </InspectorCloseContext>
66
+ );
67
+}
apps/mobile/src/features/layout/inspector-host.tsx
new
+117
@@ -0,0 +1,117 @@
1
+import { useSyncExternalStore, type ReactNode } from "react";
2
+import { Split, Stack } from "react-native-screens";
3
+
4
+import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
5
+import { PaneContext } from "../../components/ui/Pane";
6
+import { GLASS_HEADER_OPTIONS } from "../../native/glass-header-options";
7
+import { NativeColumnContent } from "../../native/NativeColumnContent.ios";
8
+import { V5StackHeader } from "../../native/V5StackHeader.ios";
9
+import { WorkspaceSlotOptionsContext } from "../../native/v5-workspace-context";
10
+import {
11
+ InspectorCloseContext,
12
+ useInspectorBarSlot,
13
+ type InspectorBarStore,
14
+} from "./inspector-bar-store";
15
+import {
16
+ useMountedInspectorPanes,
17
+ type InspectorContent,
18
+ type InspectorPane,
19
+} from "./inspector-panes";
20
+
21
+// A pane without an AppBar has no bar; one with it gets the glass the workspace's screens get.
22
+const PANE_HEADER_OPTIONS = { ...GLASS_HEADER_OPTIONS, headerShown: false };
23
+
24
+function PaneHeader(props: { readonly store: InspectorBarStore }) {
25
+ const options = useSyncExternalStore(props.store.subscribe, props.store.getSnapshot);
26
+ return <V5StackHeader options={{ ...PANE_HEADER_OPTIONS, ...options }} canGoBack={false} />;
27
+}
28
+
29
+function PaneScreenContent(props: {
30
+ readonly pane: InspectorPane;
31
+ readonly resetKeys: ReadonlyArray<unknown> | undefined;
32
+ readonly onClose: () => void;
33
+}) {
34
+ const { store, slot } = useInspectorBarSlot();
35
+ const content = (
36
+ <WorkspaceSlotOptionsContext value={slot}>
37
+ <RenderErrorBoundary
38
+ resetKeys={props.resetKeys}
39
+ renderFallback={(fallback) => (
40
+ <RenderFailureView {...fallback} title="The inspector couldn't be displayed" />
41
+ )}
42
+ >
43
+ {props.pane.render()}
44
+ </RenderErrorBoundary>
45
+ </WorkspaceSlotOptionsContext>
46
+ );
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
+ )}
58
+ </PaneContext>
59
+ </InspectorCloseContext>
60
+ );
61
+}
62
+
63
+/**
64
+ * The inspector column's panes, each a screen of the column like the detail column's routes.
65
+ * Only the active one is attached, so UIKit sees one bar, one toolbar and one scroll view.
66
+ */
67
+export function InspectorColumnScreens(props: {
68
+ readonly content: InspectorContent | undefined;
69
+ readonly onClose: () => void;
70
+ /** Drawn over the active pane. */
71
+ readonly overlay?: ReactNode;
72
+}) {
73
+ const panes = useMountedInspectorPanes(props.content);
74
+ return panes.map((pane) => {
75
+ const active = pane.key === props.content?.active;
76
+ return (
77
+ <Split.Inspector
78
+ key={pane.key}
79
+ screenKey={`inspector:${pane.key}`}
80
+ activityMode={active ? "attached" : "detached"}
81
+ >
82
+ <PaneScreenContent
83
+ pane={pane}
84
+ resetKeys={props.content?.resetKeys}
85
+ onClose={props.onClose}
86
+ />
87
+ {active ? props.overlay : null}
88
+ </Split.Inspector>
89
+ );
90
+ });
91
+}
92
+
93
+/** The inspector's panes where it has no column: a native stack with the active one attached. */
94
+export function InspectorPanes(props: {
95
+ readonly content: InspectorContent | undefined;
96
+ readonly onClose: () => void;
97
+}) {
98
+ const panes = useMountedInspectorPanes(props.content);
99
+ if (panes.length === 0) return null;
100
+ return (
101
+ <Stack.Host>
102
+ {panes.map((pane) => (
103
+ <Stack.Screen
104
+ key={pane.key}
105
+ screenKey={`inspector:${pane.key}`}
106
+ activityMode={pane.key === props.content?.active ? "attached" : "detached"}
107
+ >
108
+ <PaneScreenContent
109
+ pane={pane}
110
+ resetKeys={props.content?.resetKeys}
111
+ onClose={props.onClose}
112
+ />
113
+ </Stack.Screen>
114
+ ))}
115
+ </Stack.Host>
116
+ );
117
+}
apps/mobile/src/features/layout/inspector-panes.ts
new
+51
@@ -0,0 +1,51 @@
1
+import { useEffect, useState, type ReactNode } from "react";
2
+
3
+export interface InspectorPane {
4
+ readonly key: string;
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;
10
+}
11
+
12
+/** What a route shows in the workspace's inspector: its panes and the one on screen. */
13
+export interface InspectorContent {
14
+ readonly panes: ReadonlyArray<InspectorPane>;
15
+ readonly active: string;
16
+ /** A failed pane renders again when one of these changes. */
17
+ readonly resetKeys?: ReadonlyArray<unknown>;
18
+}
19
+
20
+const PREWARM_DELAY_MS = 350;
21
+
22
+/**
23
+ * The panes to keep mounted: every pane opened since the inspector appeared, plus prewarmed ones.
24
+ * A mounted pane keeps its state and scroll position while another is on screen.
25
+ */
26
+export function useMountedInspectorPanes(content: InspectorContent | undefined) {
27
+ const [opened, setOpened] = useState<ReadonlySet<string>>(() => new Set());
28
+ const active = content?.active;
29
+ const prewarms = content?.panes.filter((pane) => pane.prewarm) ?? [];
30
+ const prewarmSignature = prewarms.some((pane) => pane.key === active)
31
+ ? prewarms.map((pane) => pane.key).join("\n")
32
+ : "";
33
+
34
+ if (active !== undefined && !opened.has(active)) {
35
+ setOpened(new Set([...opened, active]));
36
+ }
37
+
38
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- prewarms the other panes on a timer after one opens
39
+ useEffect(() => {
40
+ if (prewarmSignature === "") return;
41
+ const timeout = setTimeout(() => {
42
+ setOpened((current) => {
43
+ const keys = prewarmSignature.split("\n");
44
+ return keys.every((key) => current.has(key)) ? current : new Set([...current, ...keys]);
45
+ });
46
+ }, PREWARM_DELAY_MS);
47
+ return () => clearTimeout(timeout);
48
+ }, [prewarmSignature]);
49
+
50
+ return content?.panes.filter((pane) => opened.has(pane.key)) ?? [];
51
+}
apps/mobile/src/features/layout/workspace-inspector-pane.tsx
+7
-17
@@ -1,4 +1,4 @@
1
-import { useEffect, useRef, useState, type ReactNode } from "react";
1
+import { useEffect, useRef, useState } from "react";
2
import Animated, {
3
cubicBezier,
4
runOnJS,
@@ -10,26 +10,27 @@ import Animated, {
10
} from "react-native-reanimated";
11
12
import { constrainAuxiliaryPaneWidth, type WorkspacePaneLayout } from "../../lib/layout";
13
-import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
13
import { WORKSPACE_PANE_TIMING } from "./workspace-pane-animation";
14
import { WorkspacePaneDivider } from "./workspace-pane-divider";
15
+import { InspectorPanes } from "./inspector-host";
16
+import type { InspectorContent } from "./inspector-panes";
17
18
// CSS form of WORKSPACE_PANE_TIMING's Easing.inOut(Easing.cubic).
19
const PANE_EASING = cubicBezier(0.65, 0, 0.35, 1);
20
21
/** Pass layout props to avoid an import cycle with AdaptiveWorkspaceLayout. */
22
export function WorkspaceInspectorPane(props: {
22
- readonly pathname: string;
23
readonly renderedInspectorWidth: SharedValue<number>;
24
readonly active?: boolean;
25
+ readonly onClose: () => void;
26
readonly onClosed?: () => void;
27
readonly panes: WorkspacePaneLayout;
27
- readonly renderInspector?: () => ReactNode;
28
+ readonly content: InspectorContent | undefined;
29
readonly setAuxiliaryPaneWidth: (width: number) => void;
30
}) {
31
const { panes, setAuxiliaryPaneWidth } = props;
32
const inspectorWidth = panes.auxiliaryPaneWidth;
32
- const inspectorSupported = props.renderInspector !== undefined && inspectorWidth !== null;
33
+ const inspectorSupported = props.content !== undefined && inspectorWidth !== null;
34
const inspectorVisible =
35
inspectorSupported && panes.auxiliaryPaneVisible && (props.active ?? true);
36
const resizeStartWidth = useRef(0);
@@ -116,21 +117,10 @@ export function WorkspaceInspectorPane(props: {
117
style={inspectorStyle}
118
>
119
<Animated.View className="flex-1" style={inspectorContentStyle}>
119
- <RenderErrorBoundary
120
- resetKeys={[props.pathname]}
121
- renderFallback={(fallback) => (
122
- <RenderFailureView {...fallback} title="The inspector couldn't be displayed" />
123
- )}
124
- >
125
- <InspectorRenderer render={props.renderInspector} />
126
- </RenderErrorBoundary>
120
+ <InspectorPanes content={props.content} onClose={props.onClose} />
121
</Animated.View>
122
</Animated.View>
123
) : null}
124
</>
125
);
126
}
133
-
134
-function InspectorRenderer(props: { readonly render?: () => ReactNode }) {
135
- return <>{props.render?.()}</>;
136
-}
apps/mobile/src/features/layout/workspace-inspector-sheet.tsx
+6
-11
@@ -1,13 +1,14 @@
1
-import { createContext, useRef, useState, type ReactNode } from "react";
1
+import { createContext, useRef, useState } from "react";
2
import { Platform, View } from "react-native";
3
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
4
import { FormSheet } from "react-native-screens";
5
import { useResolveClassNames } from "uniwind";
6
7
-import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
7
import { PaneContext } from "../../components/ui/Pane";
8
import { RoutedFormSheetContext } from "../../components/ui/RoutedFormSheetContext";
9
import { formSheetDetents } from "../../native/sheet-surface";
10
+import { InspectorPanes } from "./inspector-host";
11
+import type { InspectorContent } from "./inspector-panes";
12
13
/**
14
* Closes the inspector sheet around the inspector, then runs `then` once it is gone: a route
@@ -15,11 +16,11 @@ import { formSheetDetents } from "../../native/sheet-surface";
16
*/
17
export const InspectorSheetContext = createContext<((then?: () => void) => void) | null>(null);
18
18
-/** The inspector where the window has no column for it. Its content draws its own bar. */
19
+/** The inspector where the window has no column for it. Its panes draw their own bars. */
20
export function WorkspaceInspectorSheet(props: {
21
readonly open: boolean;
22
readonly onClose: () => void;
22
- readonly children: ReactNode;
23
+ readonly content: InspectorContent | undefined;
24
}) {
25
const containerStyle = useResolveClassNames(Platform.OS === "android" ? "bg-header" : "bg-sheet");
26
const insets = useSafeAreaInsets();
@@ -77,13 +78,7 @@ export function WorkspaceInspectorSheet(props: {
78
Platform.OS === "android" ? "absolute inset-0 bg-header pt-3" : "flex-1 bg-sheet"
79
}
80
>
80
- <RenderErrorBoundary
81
- renderFallback={(fallback) => (
82
- <RenderFailureView {...fallback} title="The inspector couldn't be displayed" />
83
- )}
84
- >
85
- {props.children}
86
- </RenderErrorBoundary>
81
+ <InspectorPanes content={props.content} onClose={() => close()} />
82
{Platform.OS === "android" ? (
83
<View
84
pointerEvents="none"
apps/mobile/src/features/review/ReviewSheet.tsx
+22
-82
@@ -4,12 +4,10 @@ import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
4
import { formatDiffCount } from "@t3tools/client-runtime/diff-count";
5
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
6
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
7
-import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
7
import { AppBar } from "../../components/ui/AppBar";
8
import type { AppBarMenuItem } from "../../components/ui/AppBar.types";
9
import type { ReviewSectionItem } from "./reviewModel";
10
import { useReviewHeaderPresentation } from "./useReviewHeaderPresentation";
12
-import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";
11
import { type Ref, type ReactElement, useImperativeHandle, useRef, useState } from "react";
12
import {
13
FlatList,
@@ -24,7 +22,7 @@ import {
22
import { useSafeAreaInsets } from "react-native-safe-area-context";
23
import { useReduceMotionEnabled } from "../../lib/appState";
24
import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
27
-import { NativeInspectorContent } from "../../native/NativeInspectorContent";
25
+import { NativeScrollView } from "../../native/NativeScrollViewMarker";
26
27
import { AppText as Text } from "../../components/ui/AppText";
28
import { SymbolView } from "../../components/ui/AppSymbol";
@@ -284,23 +282,12 @@ interface ReviewFileNavigatorHandle {
282
283
interface ReviewFileNavigatorProps {
284
readonly files: ReadonlyArray<ReviewNavigatorFile>;
287
- readonly headerInset: number;
285
readonly sectionId: string | null;
286
readonly onSelectFile: (fileId: string | null) => void;
287
readonly ref?: Ref<ReviewFileNavigatorHandle>;
288
}
289
293
-function ReviewFileNavigator({
294
- files,
295
- headerInset,
296
- sectionId,
297
- onSelectFile,
298
- ref,
299
-}: ReviewFileNavigatorProps) {
300
- const theme = useUniwindTheme();
301
- const sheetColor = theme["--color-sheet"];
302
- const foregroundColor = theme["--color-foreground"];
303
- const headerScrollEdgeEffects = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
290
+function ReviewFileNavigator({ files, sectionId, onSelectFile, ref }: ReviewFileNavigatorProps) {
291
const [fileSelection, setFileSelection] = useState<{
292
readonly sectionId: string | null;
293
readonly fileId: string | null;
@@ -343,73 +330,24 @@ function ReviewFileNavigator({
330
/>
331
);
332
346
- const fileList = (
347
- <FlatList
348
- data={files}
349
- extraData={selectedFileId}
350
- keyExtractor={(file) => file.id}
351
- contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
352
- contentContainerStyle={{ paddingHorizontal: 8, paddingVertical: 8 }}
353
- renderItem={renderFile}
354
- />
355
- );
356
-
357
- if (Platform.OS === "ios") {
358
- return (
359
- <View className="flex-1 border-l border-border bg-sheet">
360
- <ScreenStack style={{ flex: 1 }}>
361
- <Screen
362
- activityState={2}
363
- enabled
364
- isNativeStack
365
- screenId="review-file-navigator-native"
366
- scrollEdgeEffects={headerScrollEdgeEffects}
367
- style={{ backgroundColor: sheetColor, flex: 1 }}
368
- >
369
- <NativeInspectorContent>{fileList}</NativeInspectorContent>
370
- <ScreenStackHeaderConfig
371
- backgroundColor="rgba(0,0,0,0)"
372
- color={foregroundColor}
373
- hideBackButton
374
- hideShadow={false}
375
- navigationItemStyle="editor"
376
- subtitle={`${files.length} ${files.length === 1 ? "file" : "files"}`}
377
- title="Changed files"
378
- titleColor={foregroundColor}
379
- titleFontSize={17}
380
- titleFontWeight="700"
381
- translucent
382
- />
383
- </Screen>
384
- </ScreenStack>
385
- </View>
386
- );
387
- }
388
-
333
return (
390
- <View
391
- className={
392
- Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 border-l border-border bg-sheet"
393
- }
394
- >
395
- {Platform.OS === "android" ? (
396
- <AppBar
397
- embedded
398
- title="Changed files"
399
- subtitle={`${files.length} ${files.length === 1 ? "file" : "files"}`}
400
- hideBottomBorder
334
+ <View className="flex-1 ios:bg-sheet android:bg-header">
335
+ <AppBar
336
+ title="Changed files"
337
+ subtitle={`${files.length} ${files.length === 1 ? "file" : "files"}`}
338
+ hideBottomBorder={Platform.OS === "android"}
339
+ />
340
+ <ScreenContent insetHorizontal>
341
+ <FlatList
342
+ renderScrollComponent={Platform.OS === "ios" ? NativeScrollView : undefined}
343
+ data={files}
344
+ extraData={selectedFileId}
345
+ keyExtractor={(file) => file.id}
346
+ contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
347
+ contentContainerStyle={{ paddingHorizontal: 8, paddingVertical: 8 }}
348
+ renderItem={renderFile}
349
/>
402
- ) : (
403
- <View className="border-b border-border" style={{ paddingTop: headerInset }}>
404
- <View className="px-4 py-3">
405
- <Text className="text-sm font-t3-bold text-foreground">Changed files</Text>
406
- <Text className="text-xs text-foreground-muted">
407
- {files.length} {files.length === 1 ? "file" : "files"}
408
- </Text>
409
- </View>
410
- </View>
411
- )}
412
- <ScreenContent insetHorizontal>{fileList}</ScreenContent>
350
+ </ScreenContent>
351
</View>
352
);
353
}
@@ -568,7 +506,6 @@ export function ReviewSheet(props: ReviewSheetProps) {
506
<ReviewFileNavigator
507
ref={reviewFileNavigatorRef}
508
files={nativeReviewDiffData.files}
571
- headerInset={insets.top}
509
sectionId={selectedSection?.id ?? null}
510
onSelectFile={(fileId) => void handleSelectFile(fileId)}
511
/>
@@ -672,7 +609,10 @@ export function ReviewSheet(props: ReviewSheetProps) {
609
return (
610
<>
611
{showChangedFilesPane ? (
675
- <Inspector revealKey={`${environmentId}:${threadId}`}>{renderInspector()}</Inspector>
612
+ <Inspector
613
+ revealKey={`${environmentId}:${threadId}`}
614
+ content={{ active: "changes", panes: [{ key: "changes", render: renderInspector }] }}
615
+ />
616
) : null}
617
<ReviewHeader
618
environmentId={environmentId}
apps/mobile/src/features/threads/ThreadHeader.tsx
+1
-1
@@ -3,7 +3,7 @@ import { AppBar } from "../../components/ui/AppBar";
3
import { ScreenHeaderButton } from "../../components/ui/ScreenHeaderButton";
4
import type { AppBarAction } from "../../components/ui/AppBar.types";
5
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
6
-import type { ThreadInspectorMode } from "./thread-inspector-content-stack";
6
+import type { ThreadInspectorMode } from "./thread-inspector-navigation";
7
import { useThreadHeaderOptions } from "./useThreadHeaderOptions";
8
import { useWorkspaceBackNavigation } from "../workspace/useAndroidWorkspaceNavigation";
9
import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+46
-61
@@ -32,7 +32,6 @@ import {
32
} from "@t3tools/shared/projectScripts";
33
import { Platform } from "react-native";
34
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
35
-import { useSafeAreaInsets } from "react-native-safe-area-context";
35
import { useConnectionsReady } from "../../state/workspace";
36
import { useEnvironmentShellReadiness } from "../../state/shell";
37
import { restoredNewTaskDraftKey } from "../../state/new-task-draft-key";
@@ -93,10 +92,7 @@ import { useAppearancePreferences } from "../settings/appearance/AppearancePrefe
92
import { Inspector, useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
93
import { ThreadFileNavigatorPane } from "../files/thread-file-navigator-pane";
94
import { InspectorSheetContext } from "../layout/workspace-inspector-sheet";
96
-import {
97
- ThreadInspectorContentStack,
98
- type ThreadInspectorMode,
99
-} from "./thread-inspector-content-stack";
95
+import type { InspectorContent } from "../layout/inspector-panes";
96
import {
97
threadDetailErrorIsCurrent,
98
threadRouteIsHydrating,
@@ -115,7 +111,7 @@ import {
111
ThreadInspectorPreview,
112
type ThreadInspectorPresentation,
113
} from "./thread-inspector-preview";
118
-import type { ThreadInspectorTarget } from "./thread-inspector-navigation";
114
+import type { ThreadInspectorMode, ThreadInspectorTarget } from "./thread-inspector-navigation";
115
import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
116
117
function firstRouteParam(value: string | string[] | undefined): string | null {
@@ -166,7 +162,7 @@ type ThreadRouteScreenRouteProps = StaticScreenProps<{
162
interface ThreadRouteScreenProps extends ThreadRouteScreenRouteProps {
163
readonly inspectorPresentation?: ThreadInspectorPresentation;
164
readonly onReturnToThread?: () => void;
169
- readonly renderInspector?: (headerInset: number) => ReactNode;
165
+ readonly renderInspector?: () => ReactNode;
166
}
167
168
function ThreadUnavailableScreen(props: {
@@ -579,42 +575,28 @@ function ThreadRouteContent(
575
navigation.navigate("ThreadFile", params);
576
};
577
const renderGitInspector = () => (
582
- <InspectorHeaderInset>
583
- {(headerInset) => (
584
- <GitOverviewSheet
585
- headerInset={headerInset}
586
- presentation="inspector"
587
- route={{ params: { environmentId: environmentId!, threadId: threadId! } }}
588
- />
589
- )}
590
- </InspectorHeaderInset>
578
+ <GitOverviewSheet
579
+ presentation="inspector"
580
+ route={{ params: { environmentId: environmentId!, threadId: threadId! } }}
581
+ />
582
);
583
const renderFilesInspector = () =>
584
selectedThread !== null && selectedThreadCwd !== null ? (
594
- <InspectorHeaderInset>
595
- {(headerInset) => (
596
- <InspectorSheetContext.Consumer>
597
- {(closeInspectorSheet) => (
598
- <ThreadFileNavigatorPane
599
- cwd={selectedThreadCwd}
600
- environmentId={selectedThread.environmentId}
601
- headerInset={headerInset}
602
- projectName={selectedThreadProject?.title ?? "Files"}
603
- selectedPath={null}
604
- onSelectFile={(path) =>
605
- closeInspectorSheet
606
- ? closeInspectorSheet(() => handleSelectInspectorFile(path))
607
- : handleSelectInspectorFile(path)
608
- }
609
- />
610
- )}
611
- </InspectorSheetContext.Consumer>
585
+ <InspectorSheetContext.Consumer>
586
+ {(closeInspectorSheet) => (
587
+ <ThreadFileNavigatorPane
588
+ cwd={selectedThreadCwd}
589
+ environmentId={selectedThread.environmentId}
590
+ projectName={selectedThreadProject?.title ?? "Files"}
591
+ selectedPath={null}
592
+ onSelectFile={(path) =>
593
+ closeInspectorSheet
594
+ ? closeInspectorSheet(() => handleSelectInspectorFile(path))
595
+ : handleSelectInspectorFile(path)
596
+ }
597
+ />
598
)}
613
- </InspectorHeaderInset>
614
- ) : null;
615
- const renderRouteInspector = () =>
616
- props.renderInspector ? (
617
- <InspectorHeaderInset>{props.renderInspector}</InspectorHeaderInset>
599
+ </InspectorSheetContext.Consumer>
600
) : null;
601
const renderPreviewInspector = () =>
602
previewTarget && panes.auxiliaryPaneVisible ? (
@@ -635,18 +617,28 @@ function ThreadRouteContent(
617
}}
618
/>
619
) : null;
638
- const renderInspectorStack = () =>
639
- inspectorMode === null ? null : (
640
- <ThreadInspectorContentStack
641
- renderPreview={renderPreviewInspector}
642
- renderFiles={renderFilesInspector}
643
- renderGit={renderGitInspector}
644
- mode={inspectorMode}
645
- resetKeys={[routeThreadIdentity, selectedThreadCwd]}
646
- renderRoute={props.renderInspector ? renderRouteInspector : undefined}
647
- />
648
- );
649
- const showsInspector = !props.inspectorPresentation && inspectorMode !== null;
620
+ const inspectorContent: InspectorContent | null =
621
+ inspectorMode === null
622
+ ? null
623
+ : {
624
+ active: inspectorMode,
625
+ resetKeys: [routeThreadIdentity, selectedThreadCwd],
626
+ panes: [
627
+ ...(inspectorMode === "preview"
628
+ ? [
629
+ {
630
+ key: "preview",
631
+ render: renderPreviewInspector,
632
+ // A thread preview runs its own navigator, whose screens draw its bar.
633
+ nativeStack: previewTarget?.type === "thread",
634
+ },
635
+ ]
636
+ : []),
637
+ { key: "files", render: renderFilesInspector, prewarm: true },
638
+ { key: "git", render: renderGitInspector, prewarm: true },
639
+ ...(props.renderInspector ? [{ key: "route", render: props.renderInspector }] : []),
640
+ ],
641
+ };
642
643
const handleOpenConnectionEditor = () => {
644
void navigation.navigate("Connections");
@@ -1093,7 +1085,7 @@ function ThreadRouteContent(
1085
1086
return (
1087
<>
1096
- {showsInspector ? (
1088
+ {!props.inspectorPresentation && inspectorContent ? (
1089
<Inspector
1090
// A route's own inspector (files) opens once per thread; going back keeps the user's choice.
1091
revealKey={
@@ -1101,9 +1093,8 @@ function ThreadRouteContent(
1093
? (routeThreadIdentity ?? undefined)
1094
: undefined
1095
}
1104
- >
1105
- {renderInspectorStack()}
1106
- </Inspector>
1096
+ content={inspectorContent}
1097
+ />
1098
) : null}
1099
1100
{renderThreadRouteBody()}
@@ -1111,12 +1102,6 @@ function ThreadRouteContent(
1102
);
1103
}
1104
1114
-/** The inspector's top inset where it renders: under an Android column's status bar, not a sheet's. */
1115
-function InspectorHeaderInset(props: { readonly children: (headerInset: number) => ReactNode }) {
1116
- const insets = useSafeAreaInsets();
1117
- return props.children(Platform.OS === "ios" ? 0 : insets.top);
1118
-}
1119
-
1105
export function FullscreenThreadRouteScreen(
1106
props: StaticScreenProps<{
1107
readonly environmentId: string;
apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
+27
-140
@@ -15,27 +15,19 @@ import {
15
useNavigation,
16
type StaticScreenProps,
17
} from "@react-navigation/native";
18
-import { SymbolView } from "../../../components/ui/AppSymbol";
18
import { use, useEffect, useState } from "react";
20
-import { Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";
19
+import { Platform, RefreshControl, View } from "react-native";
20
+import { NativeScrollView } from "../../../native/NativeScrollViewMarker";
21
22
-import { ScreenStack } from "react-native-screens";
22
import { useSafeAreaInsets } from "react-native-safe-area-context";
24
-import { NativeInspectorContent } from "../../../native/NativeInspectorContent";
25
-import { NativeHeader, NativeScreen } from "../../../native/ThemedScreenStack";
26
-import { AndroidHeaderIconButton } from "../../../components/ui/AndroidScreenHeader";
23
import { AppBar } from "../../../components/ui/AppBar";
28
-import { AndroidAnchoredMenu } from "../../../components/ui/AndroidAnchoredMenu";
24
import { ListRow } from "../../../components/ui/ListRow";
25
import { ListSection } from "../../../components/ui/ListSection";
26
import { ScreenContent } from "../../../components/ui/ScreenContent";
27
import { useAdaptiveWorkspaceLayout } from "../../layout/AdaptiveWorkspaceLayout";
28
import { InspectorSheetContext } from "../../layout/workspace-inspector-sheet";
29
import { AppText as Text } from "../../../components/ui/AppText";
35
-import {
36
- NativeStackScreenOptions,
37
- nativeHeaderScrollEdgeEffects,
38
-} from "../../../native/StackHeader";
30
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
31
import { useEnvironmentQuery } from "../../../state/query";
32
import { useThreadSelection } from "../../../state/use-thread-selection";
33
import { useSelectedThreadGitActions } from "../../../state/use-selected-thread-git-actions";
@@ -50,13 +42,10 @@ import {
42
} from "../LinkedPullRequestList";
43
import { useLinkedPullRequestActions } from "../useLinkedPullRequestActions";
44
53
-const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
54
-
45
type GitOverviewSheetProps = StaticScreenProps<{
46
readonly environmentId: string;
47
readonly threadId: string;
48
}> & {
59
- readonly headerInset?: number;
49
readonly presentation?: "sheet" | "inspector";
50
};
51
@@ -242,7 +231,7 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
231
};
232
233
const content = (
245
- <ScrollView
234
+ <NativeScrollView
235
nestedScrollEnabled
236
alwaysBounceVertical
237
className="flex-1 android:bg-sheet-solid ios:bg-screen"
@@ -350,36 +339,20 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
339
</Text>
340
</ListSection>
341
) : null}
353
- </ScrollView>
342
+ </NativeScrollView>
343
);
344
356
- if (isInspector && Platform.OS === "ios") {
345
+ const refresh = {
346
+ accessibilityLabel: "Refresh repository status",
347
+ disabled: busy || isRefreshing,
348
+ onPress: () => void handleRefresh(),
349
+ };
350
+
351
+ if (isInspector) {
352
return (
358
- <View collapsable={false} className="flex-1 border-l border-border bg-sheet">
359
- <ScreenStack style={{ flex: 1 }}>
360
- <NativeScreen
361
- activityState={2}
362
- enabled
363
- isNativeStack
364
- screenId="thread-git-inspector-native"
365
- scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
366
- className="flex-1 bg-sheet"
367
- >
368
- <NativeInspectorContent>{content}</NativeInspectorContent>
369
- <NativeHeader
370
- backgroundColor="rgba(0,0,0,0)"
371
- tintColorClassName="accent-foreground"
372
- hideBackButton
373
- hideShadow={false}
374
- navigationItemStyle="editor"
375
- title={currentBranchLabel}
376
- titleColorClassName="accent-foreground"
377
- titleFontSize={17}
378
- titleFontWeight="700"
379
- translucent
380
- />
381
- </NativeScreen>
382
- </ScreenStack>
353
+ <View collapsable={false} className="flex-1 ios:bg-screen android:bg-header">
354
+ <AppBar title={currentBranchLabel} subtitle={currentStatusSummary} refresh={refresh} />
355
+ <ScreenContent insetHorizontal>{content}</ScreenContent>
356
</View>
357
);
358
}
@@ -398,108 +371,22 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
371
);
372
}
373
401
- const refreshMenu = (
402
- <AndroidAnchoredMenu
403
- title="Repository options"
404
- actions={[
405
- {
406
- id: "refresh",
407
- title: "Refresh repository status",
408
- attributes: { disabled: busy || isRefreshing },
409
- },
410
- ]}
411
- onPressAction={({ nativeEvent }) => {
412
- if (nativeEvent.event === "refresh") void handleRefresh();
413
- }}
414
- >
415
- {(open) => (
416
- <AndroidHeaderIconButton
417
- accessibilityLabel="Repository options"
418
- icon="ellipsis"
419
- onPress={open}
420
- />
421
- )}
422
- </AndroidAnchoredMenu>
423
- );
424
-
374
return (
375
<View
376
collapsable={false}
428
- className={
429
- Platform.OS === "android"
430
- ? "flex-1 bg-header"
431
- : isInspector
432
- ? "flex-1 border-l border-border bg-sheet"
433
- : "flex-1 bg-sheet"
434
- }
377
+ className={Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 bg-sheet"}
378
>
436
- {!isInspector ? (
437
- <NativeStackScreenOptions
438
- options={{ sheetCornerRadius: Platform.OS === "android" ? 28 : undefined }}
439
- />
440
- ) : null}
441
- {isInspector ? (
442
- <View
443
- style={{
444
- minHeight: props.headerInset ?? 0,
445
- paddingTop: props.headerInset ?? 0,
446
- }}
447
- />
448
- ) : null}
449
-
450
- {isInspector ? (
451
- <View className="gap-1 px-4 pb-4 pt-3 android:bg-header ios:border-b ios:border-border">
452
- {Platform.OS === "android" ? (
453
- <View className="absolute right-3 top-4 z-[1]">{refreshMenu}</View>
454
- ) : (
455
- <Pressable
456
- className={
457
- busy
458
- ? "absolute right-3 top-4 z-[1] h-9 w-9 items-center justify-center rounded-full bg-subtle opacity-[0.45]"
459
- : "absolute right-3 top-4 z-[1] h-9 w-9 items-center justify-center rounded-full bg-subtle"
460
- }
461
- disabled={busy}
462
- onPress={() => void gitActions.refreshSelectedThreadGitStatus()}
463
- >
464
- <SymbolView
465
- name="arrow.clockwise"
466
- size={16}
467
- tintColorClassName="accent-icon"
468
- type="monochrome"
469
- weight="medium"
470
- />
471
- </Pressable>
472
- )}
473
- <Text className="text-xs font-t3-bold tracking-[1px] uppercase text-foreground-muted">
474
- Repository
475
- </Text>
476
- <Text className="pr-10 text-xl font-t3-bold">{currentBranchLabel}</Text>
477
- <Text className="text-foreground-secondary text-sm font-medium leading-normal">
478
- {currentStatusSummary}
479
- </Text>
480
- </View>
481
- ) : (
482
- <AppBar
483
- sheet
484
- title={currentBranchLabel}
485
- hideBottomBorder={Platform.OS === "android"}
486
- subtitle={currentStatusSummary}
487
- onBack={() => navigation.goBack()}
488
- trailing={Platform.OS === "android" ? refreshMenu : undefined}
489
- actions={
490
- Platform.OS === "android"
491
- ? undefined
492
- : [
493
- {
494
- accessibilityLabel: "Refresh repository status",
495
- disabled: busy,
496
- icon: "arrow.clockwise",
497
- onPress: () => void gitActions.refreshSelectedThreadGitStatus(),
498
- },
499
- ]
500
- }
501
- />
502
- )}
379
+ <NativeStackScreenOptions
380
+ options={{ sheetCornerRadius: Platform.OS === "android" ? 28 : undefined }}
381
+ />
382
+ <AppBar
383
+ sheet
384
+ title={currentBranchLabel}
385
+ hideBottomBorder={Platform.OS === "android"}
386
+ subtitle={currentStatusSummary}
387
+ onBack={() => navigation.goBack()}
388
+ refresh={refresh}
389
+ />
390
391
<ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
392
</View>
apps/mobile/src/features/threads/thread-inspector-content-stack.tsx
deleted
-127
@@ -1,127 +0,0 @@
1
-import { useEffect, useState, type ReactNode } from "react";
2
-import { View } from "react-native";
3
-
4
-import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
5
-import { NativeInspectorContent } from "../../native/NativeInspectorContent";
6
-
7
-export type ThreadInspectorMode = "route" | "git" | "files" | "preview";
8
-
9
-const INSPECTOR_PREWARM_DELAY_MS = 350;
10
-
11
-function InspectorContentPane(props: {
12
- readonly children: ReactNode;
13
- readonly mounted: boolean;
14
- readonly resetKeys: readonly [string | null, string | null];
15
- readonly visible: boolean;
16
-}) {
17
- if (!props.mounted) {
18
- return null;
19
- }
20
-
21
- return (
22
- <View
23
- accessibilityElementsHidden={!props.visible}
24
- focusable={props.visible}
25
- importantForAccessibility={props.visible ? "auto" : "no-hide-descendants"}
26
- pointerEvents={props.visible ? "auto" : "none"}
27
- style={{
28
- position: "absolute",
29
- inset: 0,
30
- opacity: props.visible ? 1 : 0,
31
- zIndex: props.visible ? 1 : 0,
32
- }}
33
- >
34
- <RenderErrorBoundary
35
- resetKeys={props.resetKeys}
36
- renderFallback={(fallback) => (
37
- <NativeInspectorContent>
38
- <RenderFailureView {...fallback} title="The inspector couldn't be displayed" />
39
- </NativeInspectorContent>
40
- )}
41
- >
42
- {props.children}
43
- </RenderErrorBoundary>
44
- </View>
45
- );
46
-}
47
-
48
-export function ThreadInspectorContentStack(props: {
49
- readonly renderPreview?: () => ReactNode;
50
- readonly renderFiles: () => ReactNode;
51
- readonly renderGit?: () => ReactNode;
52
- readonly mode: ThreadInspectorMode;
53
- readonly resetKeys: readonly [string | null, string | null];
54
- readonly renderRoute?: () => ReactNode;
55
-}) {
56
- const [mountedModes, setMountedModes] = useState<ReadonlySet<ThreadInspectorMode>>(
57
- () => new Set([props.mode]),
58
- );
59
-
60
- // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- keeps opened UIKit inspector views mounted and prewarms the alternate inspector after a timer
61
- useEffect(() => {
62
- // oxlint-disable-next-line react/set-state-in-effect -- Keeps opened inspector views mounted so UIKit keeps their focus and scroll.
63
- setMountedModes((current) => {
64
- if (current.has(props.mode)) {
65
- return current;
66
- }
67
- return new Set([...current, props.mode]);
68
- });
69
-
70
- if (props.mode === "route" || props.mode === "preview") {
71
- return;
72
- }
73
-
74
- // Keep both inspectors alive after opening; detaching the file tree makes UIKit rebuild its expensive focus graph.
75
- const alternateMode = props.mode === "files" ? "git" : "files";
76
- const timeout = setTimeout(() => {
77
- setMountedModes((current) => {
78
- if (current.has(alternateMode)) {
79
- return current;
80
- }
81
- return new Set([...current, alternateMode]);
82
- });
83
- }, INSPECTOR_PREWARM_DELAY_MS);
84
-
85
- return () => clearTimeout(timeout);
86
- }, [props.mode]);
87
-
88
- return (
89
- <View className="flex-1">
90
- {props.mode === "preview" && props.renderPreview ? (
91
- <InspectorContentPane mounted resetKeys={props.resetKeys} visible>
92
- <InspectorRenderer render={props.renderPreview} />
93
- </InspectorContentPane>
94
- ) : null}
95
- <InspectorContentPane
96
- mounted={mountedModes.has("files") || props.mode === "files"}
97
- resetKeys={props.resetKeys}
98
- visible={props.mode === "files"}
99
- >
100
- <InspectorRenderer render={props.renderFiles} />
101
- </InspectorContentPane>
102
- {props.renderGit ? (
103
- <InspectorContentPane
104
- mounted={mountedModes.has("git") || props.mode === "git"}
105
- resetKeys={props.resetKeys}
106
- visible={props.mode === "git"}
107
- >
108
- <InspectorRenderer render={props.renderGit} />
109
- </InspectorContentPane>
110
- ) : null}
111
- {props.renderRoute ? (
112
- <InspectorContentPane
113
- mounted={mountedModes.has("route") || props.mode === "route"}
114
- resetKeys={props.resetKeys}
115
- visible={props.mode === "route"}
116
- >
117
- <InspectorRenderer render={props.renderRoute} />
118
- </InspectorContentPane>
119
- ) : null}
120
- </View>
121
- );
122
-}
123
-
124
-// Render callbacks carry changing route data; they are not component types.
125
-function InspectorRenderer(props: { readonly render: () => ReactNode }) {
126
- return <>{props.render()}</>;
127
-}
apps/mobile/src/features/threads/thread-inspector-navigation.test.tsx
+20
-6
@@ -179,10 +179,12 @@ it("keeps a focused inspector registered across renders and updates its content"
179
const deactivate = vi.fn(() => {
180
activeRender = undefined;
181
});
182
- const registerWorkspaceInspector = vi.fn((render: () => React.ReactNode) => {
183
- activeRender = render;
184
- return deactivate;
185
- });
182
+ const registerWorkspaceInspector = vi.fn(
183
+ (content: { readonly panes: ReadonlyArray<{ readonly render: () => React.ReactNode }> }) => {
184
+ activeRender = content.panes[0]?.render;
185
+ return deactivate;
186
+ },
187
+ );
188
const navigation = {
189
isFocused: () => focused,
190
addListener(event: "focus" | "blur", listener: () => void) {
@@ -221,7 +223,12 @@ it("keeps a focused inspector registered across renders and updates its content"
223
},
224
);
225
const exports: {
224
- Inspector?: (props: { readonly children: React.ReactNode }) => null;
226
+ Inspector?: (props: {
227
+ readonly content: {
228
+ readonly active: string;
229
+ readonly panes: ReadonlyArray<{ readonly key: string; readonly render: () => string }>;
230
+ };
231
+ }) => null;
232
} = {};
233
const load = (name: string) => {
234
if (name === "react" || name.startsWith("react/")) return requireMobile(name);
@@ -238,8 +245,15 @@ it("keeps a focused inspector registered across renders and updates its content"
245
};
246
new Function("require", "exports", compiled.code)(load, exports);
247
const Inspector = exports.Inspector!;
248
+ const contents = new Map<string, Parameters<typeof Inspector>[0]["content"]>();
249
function Screen({ content }: { content: string | undefined }) {
242
- return content === undefined ? null : <Inspector>{content}</Inspector>;
250
+ if (content === undefined) return null;
251
+ let panes = contents.get(content);
252
+ if (!panes) {
253
+ panes = { active: "main", panes: [{ key: "main", render: () => content }] };
254
+ contents.set(content, panes);
255
+ }
256
+ return <Inspector content={panes} />;
257
}
258
const root = createRoot(document.createElement("div"));
259
using _root = { [Symbol.dispose]: () => act(() => root.unmount()) };
apps/mobile/src/features/threads/thread-inspector-navigation.ts
+2
@@ -4,6 +4,8 @@ import { Platform } from "react-native";
4
5
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
6
7
+export type ThreadInspectorMode = "route" | "git" | "files" | "preview";
8
+
9
export type ThreadInspectorTarget = {
10
readonly type: "thread" | "device";
11
readonly environmentId: string;
apps/mobile/src/features/threads/thread-inspector-preview.tsx
+45
-45
@@ -11,7 +11,7 @@ import { View } from "react-native";
11
12
import { IconButton } from "../../components/ui/IconButton";
13
import { SheetHeader } from "../../components/ui/SheetHeader";
14
-import { NativeInspectorContent } from "../../native/NativeInspectorContent";
14
+import { InspectorCloseContext } from "../layout/inspector-bar-store";
15
import { createV5StackNavigator } from "../../native/createV5StackNavigator";
16
import { NativeStackScreenOptions } from "../../native/StackHeader";
17
import { WorkspaceSlotOptionsContext } from "../../native/v5-workspace-context";
@@ -62,11 +62,13 @@ const PreviewStack = createV5StackNavigator<{
62
export function InspectorContentScope({ children }: { readonly children: ReactNode }) {
63
return (
64
<WorkspaceSlotOptionsContext value={null}>
65
- <WorkspaceContentWidthContext value={null}>
66
- <WorkspaceSettledContentWidthContext value={null}>
67
- {children}
68
- </WorkspaceSettledContentWidthContext>
69
- </WorkspaceContentWidthContext>
65
+ <InspectorCloseContext value={null}>
66
+ <WorkspaceContentWidthContext value={null}>
67
+ <WorkspaceSettledContentWidthContext value={null}>
68
+ {children}
69
+ </WorkspaceSettledContentWidthContext>
70
+ </WorkspaceContentWidthContext>
71
+ </InspectorCloseContext>
72
</WorkspaceSlotOptionsContext>
73
);
74
}
@@ -97,45 +99,43 @@ export function ThreadInspectorPreview(props: {
99
return (
100
<ThreadInspectorNavigationContext value={props.onOpen}>
101
<InspectorContentScope>
100
- <NativeInspectorContent>
101
- {target.type === "device" ? (
102
- <DevicePreviewScreen
103
- key={`${target.environmentId}:${target.threadId}`}
104
- environmentId={EnvironmentId.make(target.environmentId)}
105
- threadId={ThreadId.make(target.threadId)}
106
- initialDeviceKey={target.deviceKey}
107
- onClose={props.onClose}
108
- onMaximize={maximizeDevice}
109
- />
110
- ) : (
111
- <View className="flex-1 bg-screen">
112
- <NavigationIndependentTree>
113
- <NavigationContainer theme={theme} onUnhandledAction={navigation.dispatch}>
114
- <PreviewStack.Navigator
115
- key={`${target.environmentId}:${target.threadId}`}
116
- screenOptions={{ headerBackVisible: false }}
117
- >
118
- <PreviewStack.Screen name="Thread" initialParams={target}>
119
- {(screen) =>
120
- props.renderThread({
121
- route: screen.route,
122
- inspectorPresentation: {
123
- onClose: props.onClose,
124
- onMaximize: () =>
125
- navigation.navigate("ThreadInspectorFullscreen", {
126
- environmentId: screen.route.params.environmentId,
127
- threadId: screen.route.params.threadId,
128
- }),
129
- },
130
- })
131
- }
132
- </PreviewStack.Screen>
133
- </PreviewStack.Navigator>
134
- </NavigationContainer>
135
- </NavigationIndependentTree>
136
- </View>
137
- )}
138
- </NativeInspectorContent>
102
+ {target.type === "device" ? (
103
+ <DevicePreviewScreen
104
+ key={`${target.environmentId}:${target.threadId}`}
105
+ environmentId={EnvironmentId.make(target.environmentId)}
106
+ threadId={ThreadId.make(target.threadId)}
107
+ initialDeviceKey={target.deviceKey}
108
+ onClose={props.onClose}
109
+ onMaximize={maximizeDevice}
110
+ />
111
+ ) : (
112
+ <View className="flex-1 bg-screen">
113
+ <NavigationIndependentTree>
114
+ <NavigationContainer theme={theme} onUnhandledAction={navigation.dispatch}>
115
+ <PreviewStack.Navigator
116
+ key={`${target.environmentId}:${target.threadId}`}
117
+ screenOptions={{ headerBackVisible: false }}
118
+ >
119
+ <PreviewStack.Screen name="Thread" initialParams={target}>
120
+ {(screen) =>
121
+ props.renderThread({
122
+ route: screen.route,
123
+ inspectorPresentation: {
124
+ onClose: props.onClose,
125
+ onMaximize: () =>
126
+ navigation.navigate("ThreadInspectorFullscreen", {
127
+ environmentId: screen.route.params.environmentId,
128
+ threadId: screen.route.params.threadId,
129
+ }),
130
+ },
131
+ })
132
+ }
133
+ </PreviewStack.Screen>
134
+ </PreviewStack.Navigator>
135
+ </NavigationContainer>
136
+ </NavigationIndependentTree>
137
+ </View>
138
+ )}
139
</InspectorContentScope>
140
</ThreadInspectorNavigationContext>
141
);
apps/mobile/src/native/NativeInspectorContent.tsx
deleted
-17
@@ -1,17 +0,0 @@
1
-import type { ReactNode } from "react";
2
-import { SafeAreaView } from "react-native-safe-area-context";
3
-
4
-import { useNativeWorkspaceColumnsSupported } from "./NativeWorkspaceColumns";
5
-
6
-// Pads with the inspector column's insets, which the column leaves to its panes so their
7
-// native headers lay out against the vertical bar themselves.
8
-export function NativeInspectorContent(props: { readonly children: ReactNode }) {
9
- const usesNativeWorkspaceColumns = useNativeWorkspaceColumnsSupported();
10
- if (!usesNativeWorkspaceColumns) return <>{props.children}</>;
11
-
12
- return (
13
- <SafeAreaView edges={["left", "right"]} style={{ flex: 1 }}>
14
- {props.children}
15
- </SafeAreaView>
16
- );
17
-}
apps/mobile/src/native/glass-header-options.ts
new
+26
@@ -0,0 +1,26 @@
1
+import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
2
+import { Platform } from "react-native";
3
+
4
+import { NATIVE_LIQUID_GLASS_SUPPORTED } from "./native-glass";
5
+import { nativeHeaderScrollEdgeEffects } from "./scrollEdgeEffects";
6
+
7
+export type AppScreenOptions = NativeStackNavigationOptions & {
8
+ readonly unstable_navigationItemStyle?: "editor";
9
+ readonly unstable_headerMinimizationBehavior?: "onScrollUp" | "never";
10
+};
11
+
12
+/** A transparent bar that content scrolls under, with UIKit's scroll-edge blur where it has one. */
13
+export const GLASS_HEADER_OPTIONS: AppScreenOptions = {
14
+ headerBackButtonDisplayMode: "minimal",
15
+ headerBackTitle: "",
16
+ headerLargeTitle: false,
17
+ headerShadowVisible: false,
18
+ headerShown: true,
19
+ headerStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? { backgroundColor: "transparent" } : undefined,
20
+ headerTitleStyle: { fontSize: 18, fontWeight: "800" },
21
+ headerTransparent: NATIVE_LIQUID_GLASS_SUPPORTED,
22
+ scrollEdgeEffects: NATIVE_LIQUID_GLASS_SUPPORTED
23
+ ? nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version)
24
+ : undefined,
25
+ unstable_navigationItemStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? "editor" : undefined,
26
+};
apps/mobile/src/native/v5-workspace-context.tsx
+5
-3
@@ -1,4 +1,6 @@
1
-import { createContext, type ReactNode } from "react";
1
+import { createContext } from "react";
2
+
3
+import type { InspectorContent } from "../features/layout/inspector-panes";
4
5
export const NativeWorkspaceModeContext = createContext(false);
6
/**
@@ -33,6 +35,6 @@ export const NativePrimaryColumnContext = createContext<{
35
readonly selectedPullRequestKey: string | null;
36
} | null>(null);
37
export const NativeWorkspaceInspectorContext = createContext<{
36
- readonly render: (() => ReactNode) | undefined;
38
+ readonly content: InspectorContent | undefined;
39
readonly visible: boolean;
38
-}>({ render: undefined, visible: false });
40
+}>({ content: undefined, visible: false });
docs/internals/mobile-layout.md
+5
-2
@@ -20,8 +20,8 @@ screen never asks which platform or window width it is on.
20
- _Medium_ (600–720pt wide): the sidebar sits beside a list and floats over a page.
21
- _Compact_ (under 600pt either way): the sidebar is the root, and pages push.
22
- Where the inspector column does not fit, the inspector is a sheet.
23
-3. **Feature screens.** A screen places content by role. It renders its page and declares side
24
- content with `<Inspector>`, and asks for it with `showInspector()`. The shell decides
23
+3. **Feature screens.** A screen places content by role. It renders its page and declares its
24
+ inspector panes with `<Inspector>`, and asks for them with `showInspector()`. The shell decides
25
between column and sheet. Choosing a route or a component by width or platform here is the bug
26
this structure exists to prevent.
27
4. **Design system.** Every pane has an `AppBar` with the same contract as a full screen.
@@ -43,5 +43,8 @@ Platform splits live in layers 1, 2 and 4, as `.ios` and `.android` files.
43
must also accept `usePaneRole() === "sidebar"`.
44
- Modals and full-screen pages are presented over the columns and render with no pane role, so
45
they get no column chrome.
46
+- On iOS each inspector pane is a native screen of its own, and only the active one is attached.
47
+ A pane hidden with opacity still has its native bar, toolbar and scroll view in the window,
48
+ and UIKit shows them over the visible pane.
49
- A route opened from the inspector sheet must wait for the sheet to close, through
50
`InspectorSheetContext`. Presenting over a closing sheet races its dismissal on iOS.