@devries-cameron20 / t3code-1 / commits / 8897f1e00a
Fork 0

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

refactor(mobile): features stop building navigators for their bars

Five features built their own native stacks, each with its own header recipe and liquid-glass check, only to get a bar: Thread settings, Custom snooze, the iOS sidebar column, the browser, and the thread preview. Agents, Background work and Queued hand-built a ScreenStack with no close button. - useSheetStackOptions gives a stack nested in a sheet the sheet route's bar. - StandaloneStack hosts a native bar outside the route tree (popover, sidebar column); sidebar-navigation-shell is gone. - The thread preview gets a Thread route of its own (ThreadPreviewRoute, next to the inspector preview) that draws no native UI. - The browser route has its own bar, and draws one SheetHeader instead of two bars. - Agents, Background work and Queued use the route header and SheetHeader, which gives them a close button on iOS. - SheetHeader takes menus, matching AppBar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 4, 2026 at 19:31 UTC 8897f1e00a74f85c59c158563ac19a400158f977
16 files changed +240 -397
apps/mobile/src/Stack.tsx
+4 -4
@@ -619,7 +619,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
619 ThreadBrowserPreview: createNativeStackScreen({
620 screen: BrowserPreviewRouteScreen,
621 linking: `${THREAD_LINKING_PREFIX}/browser`,
622 - options: immersiveRoute(),
622 + options: { ...modalRoute({ header: "solid" }), gestureEnabled: false },
623 }),
624 ThreadReview: createNativeStackScreen({
625 screen: ReviewSheet,
@@ -657,15 +657,15 @@ const RootStackConfig = createWorkspaceStackNavigator({
657 }),
658 ThreadQueue: createNativeStackScreen({
659 screen: ThreadQueueSheet,
660 - options: sheetRoute({ detent: 0.65, androidMaxDetent: 0.95, header: "none" }),
660 + options: sheetRoute({ detent: 0.65, androidMaxDetent: 0.95 }),
661 }),
662 ThreadBackgroundWork: createNativeStackScreen({
663 screen: ThreadBackgroundWorkSheet,
664 - options: sheetRoute({ detent: 0.5, androidMaxDetent: 0.9, header: "none" }),
664 + options: sheetRoute({ detent: 0.5, androidMaxDetent: 0.9 }),
665 }),
666 ThreadAgents: createNativeStackScreen({
667 screen: ThreadAgentsSheet,
668 - options: sheetRoute({ detent: 0.5, androidMaxDetent: 0.9, header: "none" }),
668 + options: sheetRoute({ detent: 0.5, androidMaxDetent: 0.9 }),
669 }),
670 GitOverview: createNativeStackScreen({
671 screen: GitOverviewSheet,
apps/mobile/src/components/ui/SheetHeader.android.tsx
+1
@@ -48,6 +48,7 @@ export function SheetHeader(props: SheetHeaderProps) {
48 title={props.title}
49 subtitle={props.subtitle}
50 actions={props.actions}
51 + menus={props.menus}
52 leading={
53 <SheetCloseButton
54 {...(props.onCancel ? { onCancel: props.onCancel } : { onClose: props.onClose })}
apps/mobile/src/components/ui/SheetHeader.tsx
+3 -1
@@ -6,6 +6,7 @@ import { AppText } from "./AppText";
6 import { SymbolView } from "./AppSymbol";
7 import { IconButton } from "./IconButton";
8 import { Toolbar } from "./Toolbar";
9 +import { createNativeHeaderMenu } from "./nativeHeaderMenu.ios";
10 import { useControlTheme } from "./useControlTheme";
11 import type { SheetCloseButtonProps, SheetHeaderProps } from "./SheetHeader.types";
12
@@ -65,7 +66,7 @@ function NativeSheetHeader(props: SheetHeaderProps) {
66 disabled={props.dismissDisabled}
67 />
68 </Toolbar>
68 - {confirmation || props.trailing || props.actions?.length ? (
69 + {confirmation || props.trailing || props.actions?.length || props.menus?.length ? (
70 <Toolbar placement="right">
71 {props.actions?.map((action) => (
72 <Toolbar.Button
@@ -77,6 +78,7 @@ function NativeSheetHeader(props: SheetHeaderProps) {
78 onPress={action.onPress}
79 />
80 ))}
81 + {props.menus?.map(createNativeHeaderMenu)}
82 {props.trailing ? (
83 <Toolbar.Custom>
84 <View>{props.trailing}</View>
apps/mobile/src/components/ui/SheetHeader.types.ts
+2 -1
@@ -1,6 +1,6 @@
1 import type { ReactNode } from "react";
2
3 -import type { AppBarAction } from "./AppBar.types";
3 +import type { AppBarAction, AppBarMenu } from "./AppBar.types";
4
5 type SheetDismissAction =
6 | { readonly onCancel: () => void; readonly onClose?: never }
@@ -21,6 +21,7 @@ export type SheetHeaderProps = SheetDismissAction & {
21 readonly confirm?: SheetConfirmation;
22 readonly presentation?: "native" | "inline";
23 readonly actions?: ReadonlyArray<AppBarAction>;
24 + readonly menus?: ReadonlyArray<AppBarMenu>;
25 readonly trailing?: ReactNode;
26 };
27
apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
+9 -36
@@ -2,7 +2,6 @@ import { SheetHeader } from "../../components/ui/SheetHeader";
2 import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
3 import * as Dialog from "../../components/ui/Dialog";
4 import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";
5 -import { createNativeStackNavigator } from "@react-navigation/native-stack";
5 import { EnvironmentId, ThreadId, type PreviewSessionSnapshot } from "@t3tools/contracts";
6 import { normalizePreviewUrl, previewPdfAssetUrl } from "@t3tools/shared/preview";
7 import * as Option from "effect/Option";
@@ -12,7 +11,6 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
11
12 import { ControlPill } from "../../components/ui/ControlPill";
13 import { useAppForeground } from "../../lib/appState";
15 -import { AppBar } from "../../components/ui/AppBar";
14
15 import { useThreadServerBrowserTabs } from "../../state/preview";
16 import { usePreparedConnection } from "../../state/session";
@@ -25,8 +23,6 @@ import {
23 type PreviewStreamRef,
24 } from "./PreviewStreamWebView";
25
28 -const BrowserPreviewStack = createNativeStackNavigator<{ BrowserPreview: undefined }>();
29 -
26 const NO_PICTURE_IN_PICTURE: PreviewPictureInPictureState = { supported: false, active: false };
27
28 type BrowserPreviewRouteScreenProps = StaticScreenProps<{
@@ -39,28 +35,12 @@ export function BrowserPreviewRouteScreen({ route }: BrowserPreviewRouteScreenPr
35 const navigation = useNavigation();
36 const onClose = () => navigation.goBack();
37 return (
42 - <View collapsable={false} className="flex-1 bg-sheet">
43 - <BrowserPreviewStack.Navigator
44 - screenOptions={{
45 - headerShown: Platform.OS === "ios",
46 - headerBackVisible: false,
47 - headerShadowVisible: false,
48 - headerTransparent: false,
49 - headerTitleStyle: { fontSize: 17, fontWeight: "600" },
50 - }}
51 - >
52 - <BrowserPreviewStack.Screen name="BrowserPreview">
53 - {() => (
54 - <BrowserPreviewScreen
55 - environmentId={EnvironmentId.make(route.params.environmentId)}
56 - threadId={ThreadId.make(route.params.threadId)}
57 - initialTabId={route.params.tabId ?? null}
58 - onClose={onClose}
59 - />
60 - )}
61 - </BrowserPreviewStack.Screen>
62 - </BrowserPreviewStack.Navigator>
63 - </View>
38 + <BrowserPreviewScreen
39 + environmentId={EnvironmentId.make(route.params.environmentId)}
40 + threadId={ThreadId.make(route.params.threadId)}
41 + initialTabId={route.params.tabId ?? null}
42 + onClose={onClose}
43 + />
44 );
45 }
46
@@ -111,10 +91,10 @@ function BrowserPreviewScreen({
91
92 return (
93 <View className="flex-1 bg-sheet" style={{ paddingBottom: insets.bottom }}>
114 - <AppBar
94 + <SheetHeader
95 title={tab ? browserTabTitle(tab) : "Browser"}
116 - onBack={onClose}
117 - options={{ headerBackVisible: false }}
96 + onClose={onClose}
97 + accessibilityLabel="Close browser"
98 actions={
99 // Android WebView cannot play video in picture in picture.
100 Platform.OS === "ios" &&
@@ -153,13 +133,6 @@ function BrowserPreviewScreen({
133 : []
134 }
135 />
156 - {Platform.OS === "ios" ? (
157 - <SheetHeader
158 - title={tab ? browserTabTitle(tab) : "Browser"}
159 - onClose={onClose}
160 - accessibilityLabel="Close browser"
161 - />
162 - ) : null}
136 {tab ? (
137 <>
138 <BrowserAddressBar
apps/mobile/src/features/layout/nested-stacks.tsx new
+59
@@ -0,0 +1,59 @@
1 +import { NavigationContainer, NavigationIndependentTree } from "@react-navigation/native";
2 +import type { ReactNode } from "react";
3 +import { Platform } from "react-native";
4 +
5 +import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
6 +import { useUniwindTheme } from "../../lib/useUniwindTheme";
7 +import { createV5StackNavigator } from "../../native/createV5StackNavigator";
8 +import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
9 +import type { AppScreenOptions } from "../../native/glass-header-options";
10 +import { pageRoute } from "./route-options";
11 +
12 +/**
13 + * Screen options for a stack nested in a sheet, so its pages push inside the sheet with the
14 + * same bar as a sheet route. Android hides the native header: pages draw AppBar in-tree.
15 + */
16 +export function useSheetStackOptions(): AppScreenOptions {
17 + const theme = useUniwindTheme();
18 + const background = theme["--color-sheet-solid"];
19 + return {
20 + ...pageRoute({ itemStyle: "standard" }),
21 + animation: Platform.OS === "android" ? "default" : "slide_from_right",
22 + contentStyle: { backgroundColor: background },
23 + gestureEnabled: true,
24 + headerShown: Platform.OS !== "android",
25 + headerStyle: { backgroundColor: NATIVE_LIQUID_GLASS_SUPPORTED ? "transparent" : background },
26 + headerTintColor: theme["--color-foreground"],
27 + };
28 +}
29 +
30 +const Standalone = createV5StackNavigator<{ Standalone: undefined }>();
31 +
32 +/**
33 + * One native stack screen outside the app's navigation tree, for content that needs a native bar
34 + * but is not a route: a popover, or a column the workspace hosts. Its bar is set from inside with
35 + * AppBar or SheetHeader like any screen.
36 + */
37 +export function StandaloneStack(props: {
38 + readonly surface?: "screen" | "sidebar";
39 + readonly options?: AppScreenOptions;
40 + readonly children: ReactNode;
41 +}) {
42 + const navigationTheme = useMobileNavigationTheme(props.surface);
43 + return (
44 + <NavigationIndependentTree>
45 + <NavigationContainer theme={navigationTheme}>
46 + <Standalone.Navigator
47 + screenOptions={{
48 + ...pageRoute({ itemStyle: "standard" }),
49 + contentStyle: { backgroundColor: "transparent" },
50 + headerShown: Platform.OS !== "android",
51 + ...props.options,
52 + }}
53 + >
54 + <Standalone.Screen name="Standalone">{() => props.children}</Standalone.Screen>
55 + </Standalone.Navigator>
56 + </NavigationContainer>
57 + </NavigationIndependentTree>
58 + );
59 +}
apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx
+15 -46
@@ -29,16 +29,12 @@ import {
29 type CustomSnoozeInput,
30 } from "@t3tools/client-runtime/state/thread-settled";
31 import { useState, type ReactNode } from "react";
32 -import { NavigationContainer, NavigationIndependentTree } from "@react-navigation/native";
33 -import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
32 +import { StandaloneStack } from "../layout/nested-stacks";
33 import { ScrollView, useWindowDimensions, View } from "react-native";
35 -import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
34
37 -import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
35 import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
36
37 const durationAmounts = Array.from({ length: 99 }, (_, index) => index + 1);
41 -const SnoozeStack = createNativeStackNavigator<{ CustomSnooze: undefined }>();
38 const modes = [
39 { value: "date", label: "Date and time" },
40 { value: "duration", label: "Duration" },
@@ -222,51 +218,24 @@ function SnoozePopoverNavigation(props: {
218 readonly onSubmit: () => void;
219 readonly children: ReactNode;
220 }) {
225 - const navigationTheme = useMobileNavigationTheme();
226 - const { themeVariables: colors } = useAppearancePreferences();
227 -
221 return (
222 <VStack modifiers={[frame({ width: props.width, height: props.height })]}>
223 <RNHostView>
224 <View style={{ width: props.width, height: props.height }}>
232 - <NavigationIndependentTree>
233 - <NavigationContainer theme={navigationTheme}>
234 - <SnoozeStack.Navigator
235 - screenOptions={{
236 - contentStyle: { backgroundColor: "transparent" },
237 - headerShadowVisible: false,
238 - headerStyle: {
239 - backgroundColor: NATIVE_LIQUID_GLASS_SUPPORTED
240 - ? "transparent"
241 - : colors["--color-card"],
242 - },
243 - headerTintColor: colors["--color-foreground"],
244 - headerTitleStyle: { fontSize: 17, fontWeight: "700" },
245 - headerTransparent: NATIVE_LIQUID_GLASS_SUPPORTED,
246 - title: "Custom snooze",
247 - }}
248 - >
249 - <SnoozeStack.Screen name="CustomSnooze">
250 - {() => (
251 - <>
252 - <SheetHeader
253 - title="Custom snooze"
254 - onCancel={props.onClose}
255 - accessibilityLabel="Cancel custom snooze"
256 - confirm={{ label: "Snooze", onPress: props.onSubmit }}
257 - />
258 - <ScrollView
259 - contentInsetAdjustmentBehavior="automatic"
260 - showsVerticalScrollIndicator={false}
261 - >
262 - {props.children}
263 - </ScrollView>
264 - </>
265 - )}
266 - </SnoozeStack.Screen>
267 - </SnoozeStack.Navigator>
268 - </NavigationContainer>
269 - </NavigationIndependentTree>
225 + <StandaloneStack>
226 + <SheetHeader
227 + title="Custom snooze"
228 + onCancel={props.onClose}
229 + accessibilityLabel="Cancel custom snooze"
230 + confirm={{ label: "Snooze", onPress: props.onSubmit }}
231 + />
232 + <ScrollView
233 + contentInsetAdjustmentBehavior="automatic"
234 + showsVerticalScrollIndicator={false}
235 + >
236 + {props.children}
237 + </ScrollView>
238 + </StandaloneStack>
239 </View>
240 </RNHostView>
241 </VStack>
apps/mobile/src/features/threads/ThreadAgentsSheet.tsx
+4 -40
@@ -16,15 +16,12 @@ import * as DateTime from "effect/DateTime";
16 import { Atom } from "effect/reactivity";
17 import * as Haptics from "expo-haptics";
18 import { useMemo } from "react";
19 -import { Platform, Pressable, ScrollView, View } from "react-native";
20 -import { ScreenStack } from "react-native-screens";
19 +import { Pressable, ScrollView, View } from "react-native";
20 import { useSafeAreaInsets } from "react-native-safe-area-context";
21
23 -import { AppBar } from "../../components/ui/AppBar";
22 +import { SheetHeader } from "../../components/ui/SheetHeader";
23 import { AppText as Text } from "../../components/ui/AppText";
24 import { environmentThreadDetails } from "../../state/threads";
26 -import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
27 -import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";
25 import { useEnvironments } from "../../state/environments";
26 import { SubagentRow } from "./SubagentRow";
27 import { useVisibleSecondClock } from "./use-visible-second-clock";
@@ -36,8 +33,6 @@ import { subagentThreadTarget } from "./threadAgentsPresentation";
33
34 import { useOpenThreadInspector } from "./thread-inspector-navigation";
35
39 -const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
40 -
36 type AgentsTarget = { readonly environmentId: EnvironmentId; readonly threadId: ThreadId };
37
38 const EMPTY_TURN_SUBAGENTS_ATOM = Atom.make<ThreadTurnSubagents | null>(null).pipe(
@@ -96,7 +91,7 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {
91 nestedScrollEnabled
92 className="flex-1"
93 // UIKit must inset content beneath the floating translucent iOS header.
99 - contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
94 + contentInsetAdjustmentBehavior="automatic"
95 contentContainerClassName="px-5 pb-6"
96 contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 16) + 8 }}
97 >
@@ -132,40 +127,9 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {
127 </ScrollView>
128 );
129
135 - if (Platform.OS === "ios") {
136 - // Plain formSheets lack stack headers; host one in a nested native stack.
137 - return (
138 - <View collapsable={false} className="flex-1 bg-sheet">
139 - <ScreenStack style={{ flex: 1 }}>
140 - <NativeScreen
141 - activityState={2}
142 - enabled
143 - isNativeStack
144 - screenId="thread-agents-sheet-native"
145 - scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
146 - className="flex-1 bg-sheet"
147 - >
148 - {content}
149 - <NativeHeader
150 - backgroundColor="rgba(0,0,0,0)"
151 - tintColorClassName="accent-foreground"
152 - hideBackButton
153 - hideShadow={false}
154 - title="Agents"
155 - titleColorClassName="accent-foreground"
156 - titleFontSize={18}
157 - titleFontWeight="800"
158 - translucent
159 - />
160 - </NativeScreen>
161 - </ScreenStack>
162 - </View>
163 - );
164 - }
165 -
130 return (
131 <View collapsable={false} className="flex-1 bg-sheet">
168 - <AppBar sheet title="Agents" onBack={() => navigation.goBack()} />
132 + <SheetHeader title="Agents" onClose={() => navigation.goBack()} />
133 <ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
134 </View>
135 );
apps/mobile/src/features/threads/ThreadBackgroundWorkSheet.tsx
+4 -37
@@ -7,20 +7,16 @@ import {
7 } from "@t3tools/client-runtime/state/thread-execution";
8 import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
9 import * as Haptics from "expo-haptics";
10 -import { Platform, Pressable, ScrollView, View } from "react-native";
11 -import { ScreenStack } from "react-native-screens";
10 +import { Pressable, ScrollView, View } from "react-native";
11 import { useSafeAreaInsets } from "react-native-safe-area-context";
12
14 -import { AppBar } from "../../components/ui/AppBar";
13 +import { SheetHeader } from "../../components/ui/SheetHeader";
14 import { SymbolView } from "../../components/ui/AppSymbol";
15 import { AppText as Text } from "../../components/ui/AppText";
16 import { ScreenContent } from "../../components/ui/ScreenContent";
18 -import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
19 -import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";
17 import { environmentThreadShells } from "../../state/threads";
18 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
19
23 -const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
20 const KIND_LABELS = {
21 subagent: "Subagent",
22 command: "Command",
@@ -50,7 +46,7 @@ export function ThreadBackgroundWorkSheet({ route }: StaticScreenProps<Backgroun
46 <ScrollView
47 nestedScrollEnabled
48 className="flex-1"
53 - contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
49 + contentInsetAdjustmentBehavior="automatic"
50 contentContainerClassName="px-5 pb-6"
51 contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 16) + 8 }}
52 >
@@ -65,38 +61,9 @@ export function ThreadBackgroundWorkSheet({ route }: StaticScreenProps<Backgroun
61 )}
62 </ScrollView>
63 );
68 - if (Platform.OS === "ios") {
69 - return (
70 - <View collapsable={false} className="flex-1 bg-sheet">
71 - <ScreenStack style={{ flex: 1 }}>
72 - <NativeScreen
73 - activityState={2}
74 - enabled
75 - isNativeStack
76 - screenId="thread-background-work-sheet-native"
77 - scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
78 - className="flex-1 bg-sheet"
79 - >
80 - {content}
81 - <NativeHeader
82 - backgroundColor="rgba(0,0,0,0)"
83 - tintColorClassName="accent-foreground"
84 - hideBackButton
85 - hideShadow={false}
86 - title="Background work"
87 - titleColorClassName="accent-foreground"
88 - titleFontSize={18}
89 - titleFontWeight="800"
90 - translucent
91 - />
92 - </NativeScreen>
93 - </ScreenStack>
94 - </View>
95 - );
96 - }
64 return (
65 <View collapsable={false} className="flex-1 bg-sheet">
99 - <AppBar sheet title="Background work" onBack={() => navigation.goBack()} />
66 + <SheetHeader title="Background work" onClose={() => navigation.goBack()} />
67 <ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
68 </View>
69 );
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+11 -3
@@ -64,7 +64,9 @@ import { ThreadListToolbar } from "../home/ThreadListToolbar";
64 import { useFabScroll } from "../home/FabScrollContext";
65 import { SidebarFilterButton } from "./sidebar-filter-button";
66 import { createSidebarHeaderItems } from "./sidebar-native-header-items";
67 -import { SidebarNavigationShell } from "./sidebar-navigation-shell";
67 +import { getCompactBrandHeaderOptions } from "../../components/CompactBrandTitle";
68 +import { StandaloneStack } from "../layout/nested-stacks";
69 +import { pageRoute } from "../layout/route-options";
70 import {
71 ThreadListV2PendingRow,
72 ThreadListV2Row,
@@ -116,6 +118,12 @@ interface ThreadNavigationSidebarProps {
118 readonly searchQuery: string;
119 }
120
121 +// The iOS sidebar column hosts its own stack so it gets a native bar with the brand title.
122 +const SIDEBAR_COLUMN_OPTIONS = {
123 + ...pageRoute(),
124 + ...getCompactBrandHeaderOptions({ fontSize: 18, fontWeight: "800" }),
125 +};
126 +
127 export function ThreadNavigationSidebar(props: ThreadNavigationSidebarProps) {
128 return (
129 <ThreadPrDemandProvider visible={props.visible}>
@@ -135,9 +143,9 @@ function NativeSidebarContainer(props: ThreadNavigationSidebarProps) {
143 className="flex-1 border-border bg-drawer"
144 style={{ borderRightWidth: StyleSheet.hairlineWidth, width: props.width }}
145 >
138 - <SidebarNavigationShell>
146 + <StandaloneStack surface="sidebar" options={SIDEBAR_COLUMN_OPTIONS}>
147 <ThreadNavigationSidebarPane {...props} nativeChrome />
140 - </SidebarNavigationShell>
148 + </StandaloneStack>
149 </View>
150 );
151 }
apps/mobile/src/features/threads/ThreadQueueControl.tsx
+5 -41
@@ -16,18 +16,16 @@ import { GestureHandlerRootView } from "react-native-gesture-handler";
16 import ReanimatedSwipeable, {
17 type SwipeableMethods,
18 } from "react-native-gesture-handler/ReanimatedSwipeable";
19 -import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";
19 +import { useUniwindTheme } from "../../lib/useUniwindTheme";
20 import { useSafeAreaInsets } from "react-native-safe-area-context";
21
22 import { Button } from "../../components/ui/Button";
23 -import { AppBar } from "../../components/ui/AppBar";
23 +import { SheetHeader } from "../../components/ui/SheetHeader";
24 import { AppText as Text } from "../../components/ui/AppText";
25 import { SymbolView } from "../../components/ui/AppSymbol";
26 import { Menu } from "../../components/ui/Menu";
27 import { ScreenContent } from "../../components/ui/ScreenContent";
28 import { scopedThreadKey } from "../../lib/scopedEntities";
29 -import { useUniwindTheme } from "../../lib/useUniwindTheme";
30 -import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
29 import { useAssetUrl } from "../../state/assets";
30 import { useQuietThreadShell } from "../../state/entities";
31 import { useEnvironmentQuery } from "../../state/query";
@@ -43,7 +41,6 @@ import {
41 resolveThreadQueueRowControls,
42 } from "./threadQueueControlPresentation";
43
46 -const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
44 const REMOVE_ACTION_WIDTH = 76;
45 const THUMBNAIL_LIMIT = 3;
46 const EMPTY_QUEUED_COUNT_ATOM = Atom.make(0).pipe(
@@ -121,10 +118,10 @@ function QueuedRunSender(props: {
118
119 export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
120 const { layout } = useAdaptiveWorkspaceLayout();
121 + const theme = useUniwindTheme();
122 const target = route.params;
123 const navigation = useNavigation();
124 const insets = useSafeAreaInsets();
127 - const theme = useUniwindTheme();
125 const workflow = useThreadQueueWorkflow(target);
126 const threadKey = scopedThreadKey(target.environmentId, target.threadId);
127 const editing = useQueuedRunEdit(threadKey);
@@ -206,7 +203,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
203 nestedScrollEnabled
204 className="flex-1"
205 // UIKit must inset content beneath the floating translucent iOS header.
209 - contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
206 + contentInsetAdjustmentBehavior="automatic"
207 contentContainerClassName="px-5 pb-6"
208 contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 16) + 8 }}
209 >
@@ -361,43 +358,10 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
358 </ScrollView>
359 );
360
364 - if (Platform.OS === "ios") {
365 - // Plain formSheets lack stack headers; host one in a nested native stack.
366 - return (
367 - <GestureHandlerRootView style={{ flex: 1 }}>
368 - <View collapsable={false} className="flex-1 bg-sheet">
369 - <ScreenStack style={{ flex: 1 }}>
370 - <Screen
371 - activityState={2}
372 - enabled
373 - isNativeStack
374 - screenId="thread-queue-sheet-native"
375 - scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
376 - style={{ backgroundColor: theme["--color-sheet"], flex: 1 }}
377 - >
378 - {content}
379 - <ScreenStackHeaderConfig
380 - backgroundColor="rgba(0,0,0,0)"
381 - color={theme["--color-foreground"]}
382 - hideBackButton
383 - hideShadow={false}
384 - title="Queued"
385 - titleColor={theme["--color-foreground"]}
386 - titleFontSize={18}
387 - titleFontWeight="800"
388 - translucent
389 - />
390 - </Screen>
391 - </ScreenStack>
392 - </View>
393 - </GestureHandlerRootView>
394 - );
395 - }
396 -
361 return (
362 <GestureHandlerRootView style={{ flex: 1 }}>
363 <View collapsable={false} className="flex-1 bg-sheet">
400 - <AppBar sheet title="Queued" onBack={() => navigation.goBack()} />
364 + <SheetHeader title="Queued" onClose={() => navigation.goBack()} />
365 <ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
366 </View>
367 </GestureHandlerRootView>
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+5 -37
@@ -6,6 +6,7 @@ import { SheetHeader } from "../../components/ui/SheetHeader";
6 import { Toolbar } from "../../components/ui/Toolbar";
7 import * as Dialog from "../../components/ui/Dialog";
8 import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
9 +import { useSheetStackOptions } from "../layout/nested-stacks";
10 import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts";
11 import {
12 modelPreferencesMigrationPatch,
@@ -74,13 +75,11 @@ import {
75 } from "../../lib/modelOptions";
76 import { applyProviderOptionSelection } from "../../lib/providerOptions";
77 import { resolveProviderOptionDescriptors } from "../../lib/providerOptions";
77 -import { useUniwindTheme } from "../../lib/useUniwindTheme";
78 import {
79 rememberModelOptions,
80 withRememberedModelOptions,
81 } from "../../state/use-model-option-memory";
82 -import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
83 -import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
82 +import { NativeStackScreenOptions } from "../../native/StackHeader";
83 import { ChatGptSharingStatus } from "./ChatGptSharingStatus";
84 import { environmentCatalog } from "../../connection/catalog";
85 import { useEnvironmentQuery } from "../../state/query";
@@ -146,10 +145,6 @@ const THREAD_SETTINGS_CATALOG_EXIT_TRANSITION = FadeOut.duration(120);
145 const THREAD_SETTINGS_OPTIONS_LAYOUT_TRANSITION = LinearTransition.duration(180);
146 const THREAD_SETTINGS_OPTION_ENTER_TRANSITION = FadeIn.duration(140);
147 const THREAD_SETTINGS_OPTION_EXIT_TRANSITION = FadeOut.duration(100);
149 -const THREAD_SETTINGS_HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(
150 - Platform.OS,
151 - Platform.Version,
152 -);
148 const EMPTY_MODEL_FAVORITES: ReadonlyArray<{
149 readonly provider: ProviderInstanceId;
150 readonly model: string;
@@ -1431,15 +1426,7 @@ function ThreadSettingsChoiceScreen() {
1426
1427 return (
1428 <>
1434 - <NativeStackScreenOptions options={{ headerShown: Platform.OS !== "android" }} />
1435 - {Platform.OS === "android" ? (
1436 - <AppBar
1437 - embedded
1438 - title={route.params.title}
1439 - onBack={() => navigation.goBack()}
1440 - hideBottomBorder
1441 - />
1442 - ) : null}
1429 + <AppBar title={route.params.title} onBack={() => navigation.goBack()} hideBottomBorder />
1430 <ScreenContent>
1431 <ThreadSettingsChoiceContent
1432 submenu={route.params}
@@ -1451,9 +1438,7 @@ function ThreadSettingsChoiceScreen() {
1438 }
1439
1440 function ThreadSettingsPickerNavigator(props: ThreadSettingsPickerPresentation) {
1454 - const theme = useUniwindTheme();
1455 - const solidSheetBackground = theme["--color-sheet-solid"];
1456 - const foreground = theme["--color-foreground"];
1441 + const screenOptions = useSheetStackOptions();
1442 const presentation = {
1443 onClose: props.onClose,
1444 };
@@ -1462,24 +1447,7 @@ function ThreadSettingsPickerNavigator(props: ThreadSettingsPickerPresentation)
1447 <ThreadSettingsPickerPresentationContext.Provider value={presentation}>
1448 <ThreadSettingsPickerStack.Navigator
1449 initialRouteName="ThreadSettingsModels"
1465 - screenOptions={{
1466 - animation: Platform.OS === "android" ? "default" : "slide_from_right",
1467 - contentStyle: { backgroundColor: solidSheetBackground },
1468 - gestureEnabled: true,
1469 - headerBackButtonDisplayMode: "minimal",
1470 - headerBackTitle: "",
1471 - headerShown: Platform.OS !== "android",
1472 - headerShadowVisible: false,
1473 - headerStyle: {
1474 - backgroundColor: NATIVE_LIQUID_GLASS_SUPPORTED ? "transparent" : solidSheetBackground,
1475 - },
1476 - headerTransparent: NATIVE_LIQUID_GLASS_SUPPORTED,
1477 - headerTintColor: foreground,
1478 - headerTitleStyle: { fontSize: 17, fontWeight: "700" },
1479 - scrollEdgeEffects: NATIVE_LIQUID_GLASS_SUPPORTED
1480 - ? THREAD_SETTINGS_HEADER_SCROLL_EDGE_EFFECTS
1481 - : undefined,
1482 - }}
1450 + screenOptions={screenOptions}
1451 >
1452 <ThreadSettingsPickerStack.Screen
1453 name="ThreadSettingsModels"
apps/mobile/src/features/threads/sidebar-navigation-shell.tsx deleted
-48
@@ -1,48 +0,0 @@
1 -import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
2 -import { NavigationContainer, NavigationIndependentTree } from "@react-navigation/native";
3 -import { type NativeStackNavigationOptions } from "@react-navigation/native-stack";
4 -import type { ReactNode } from "react";
5 -import { Platform } from "react-native";
6 -
7 -import { getCompactBrandHeaderOptions } from "../../components/CompactBrandTitle";
8 -import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
9 -import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
10 -import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
11 -
12 -const SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
13 -
14 -type SidebarScreenOptions = NativeStackNavigationOptions & {
15 - // Patched RNS editor style leading-aligns iOS 26 inline titles, matching Stack.tsx presets.
16 - readonly unstable_navigationItemStyle?: "editor";
17 -};
18 -
19 -const SIDEBAR_SCREEN_OPTIONS: SidebarScreenOptions = {
20 - contentStyle: { backgroundColor: "transparent" },
21 - headerLargeTitle: false,
22 - headerShadowVisible: false,
23 - headerShown: true,
24 - headerStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? { backgroundColor: "transparent" } : undefined,
25 - ...getCompactBrandHeaderOptions({ fontSize: 18, fontWeight: "800" }),
26 - headerTransparent: NATIVE_LIQUID_GLASS_SUPPORTED,
27 - scrollEdgeEffects: NATIVE_LIQUID_GLASS_SUPPORTED ? SCROLL_EDGE_EFFECTS : undefined,
28 - unstable_navigationItemStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? "editor" : undefined,
29 -};
30 -
31 -const SidebarStack = createNativeStackNavigator();
32 -
33 -export function SidebarNavigationShell(props: { readonly children: ReactNode }) {
34 - const navigationTheme = useMobileNavigationTheme("sidebar");
35 -
36 - return (
37 - <NavigationIndependentTree>
38 - <NavigationContainer theme={navigationTheme}>
39 - <SidebarStack.Navigator
40 - screenOptions={SIDEBAR_SCREEN_OPTIONS}
41 - initialRouteName="SidebarThreads"
42 - >
43 - <SidebarStack.Screen name="SidebarThreads">{() => props.children}</SidebarStack.Screen>
44 - </SidebarStack.Navigator>
45 - </NavigationContainer>
46 - </NavigationIndependentTree>
47 - );
48 -}
apps/mobile/src/features/threads/thread-inspector-preview.tsx
+17 -102
@@ -1,34 +1,10 @@
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";
1 +import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";
2 import { EnvironmentId, ThreadId } from "@t3tools/contracts";
3 import { type ReactNode } from "react";
4 import { View } from "react-native";
5
6 import { AppBar } from "../../components/ui/AppBar";
7 import { SheetHeader } from "../../components/ui/SheetHeader";
30 -import { NativeStackScreenOptions } from "../../native/StackHeader";
31 -import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
8 import { DevicePreviewScreen } from "../devices/DevicePreviewRouteScreen";
9 import {
10 WorkspaceContentWidthContext,
@@ -38,6 +14,7 @@ import {
14 ThreadInspectorNavigationContext,
15 type ThreadInspectorTarget,
16 } from "./thread-inspector-navigation";
17 +import { ThreadPreviewRoute } from "./thread-preview-route";
18
19 /** A thread shown outside its route: in the inspector pane, or presented full screen with a close. */
20 export type ThreadInspectorPresentation =
@@ -62,65 +39,10 @@ export function ThreadInspectorHeader(
39 );
40 }
41 return (
65 - <>
66 - <NativeStackScreenOptions options={{ headerShown: true, headerTransparent: true }} />
67 - <SheetHeader title={props.title} onClose={props.onClose} accessibilityLabel="Close thread" />
68 - </>
42 + <SheetHeader title={props.title} onClose={props.onClose} accessibilityLabel="Close thread" />
43 );
44 }
45
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 -
46 /** A thread shown beside or over the workspace does not take the workspace's content width. */
47 export function InspectorContentScope({ children }: { readonly children: ReactNode }) {
48 return (
@@ -144,7 +66,6 @@ export function ThreadInspectorPreview(props: {
66 }) {
67 const navigation = useNavigation();
68 const focused = useIsFocused();
147 - const theme = useMobileNavigationTheme();
69 const { target } = props;
70 const maximizeDevice = (deviceKey: string | null) => {
71 props.onOpen({ ...target, deviceKey: deviceKey ?? undefined });
@@ -169,26 +90,20 @@ export function ThreadInspectorPreview(props: {
90 />
91 ) : (
92 <View className="flex-1 bg-screen">
172 - <NavigationIndependentTree>
173 - <NavigationContainer theme={theme} onUnhandledAction={navigation.dispatch}>
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: {
180 - onMaximize: () =>
181 - navigation.navigate("ThreadInspectorFullscreen", {
182 - environmentId: screen.route.params.environmentId,
183 - threadId: screen.route.params.threadId,
184 - }),
185 - },
186 - })
187 - }
188 - </PreviewStack.Screen>
189 - </PreviewStack.Navigator>
190 - </NavigationContainer>
191 - </NavigationIndependentTree>
93 + <ThreadPreviewRoute environmentId={target.environmentId} threadId={target.threadId}>
94 + {(route) =>
95 + props.renderThread({
96 + route,
97 + inspectorPresentation: {
98 + onMaximize: () =>
99 + navigation.navigate("ThreadInspectorFullscreen", {
100 + environmentId: route.params.environmentId,
101 + threadId: route.params.threadId,
102 + }),
103 + },
104 + })
105 + }
106 + </ThreadPreviewRoute>
107 </View>
108 )}
109 </InspectorContentScope>
apps/mobile/src/features/threads/thread-preview-route.tsx new
+100
@@ -0,0 +1,100 @@
1 +import {
2 + createNavigatorFactory,
3 + NavigationContainer,
4 + NavigationIndependentTree,
5 + StackRouter,
6 + useNavigation,
7 + useNavigationBuilder,
8 + type NavigatorTypeBagBase,
9 + type ParamListBase,
10 + type RouteProp,
11 + type StackActionHelpers,
12 + type StackNavigationState,
13 + type StackRouterOptions,
14 + type StaticConfig,
15 + type TypedNavigator,
16 +} from "@react-navigation/native";
17 +import type {
18 + NativeStackNavigationEventMap,
19 + NativeStackNavigationOptions,
20 + NativeStackNavigatorProps,
21 + NativeStackTypeBag,
22 +} from "@react-navigation/native-stack";
23 +import type { ReactNode } from "react";
24 +
25 +import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
26 +
27 +function ThreadPreviewNavigator({
28 + id,
29 + initialRouteName,
30 + UNSTABLE_routeNamesChangeBehavior,
31 + children,
32 + layout,
33 + screenListeners,
34 + screenOptions,
35 + screenLayout,
36 + UNSTABLE_router,
37 +}: NativeStackNavigatorProps) {
38 + const { state, descriptors, NavigationContent } = useNavigationBuilder<
39 + StackNavigationState<ParamListBase>,
40 + StackRouterOptions,
41 + StackActionHelpers<ParamListBase>,
42 + NativeStackNavigationOptions,
43 + NativeStackNavigationEventMap
44 + >(StackRouter, {
45 + id,
46 + initialRouteName,
47 + UNSTABLE_routeNamesChangeBehavior,
48 + children,
49 + layout,
50 + screenListeners,
51 + screenOptions,
52 + screenLayout,
53 + UNSTABLE_router,
54 + });
55 + const route = state.routes[state.index];
56 + return <NavigationContent>{route ? descriptors[route.key]?.render() : null}</NavigationContent>;
57 +}
58 +
59 +type ThreadPreviewTypeBag<ParamList extends ParamListBase> = Omit<
60 + NativeStackTypeBag<ParamList, undefined>,
61 + "Navigator"
62 +> & { Navigator: typeof ThreadPreviewNavigator };
63 +
64 +function createThreadPreviewNavigator<
65 + const ParamList extends ParamListBase,
66 + const TypeBag extends NavigatorTypeBagBase = ThreadPreviewTypeBag<ParamList>,
67 + const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,
68 +>(config?: Config): TypedNavigator<TypeBag, Config> {
69 + return createNavigatorFactory(ThreadPreviewNavigator)(config);
70 +}
71 +
72 +type ThreadPreviewParams = { readonly environmentId: string; readonly threadId: string };
73 +
74 +const Preview = createThreadPreviewNavigator<{ Thread: ThreadPreviewParams }>();
75 +
76 +/**
77 + * A `Thread` route of its own for a thread shown inside another screen. Thread state resolves the
78 + * thread from route params, so the preview needs its own params, and its `replace` must not swap
79 + * the host thread. Draws no native UI; actions it can't handle go to the host.
80 + */
81 +export function ThreadPreviewRoute(
82 + props: ThreadPreviewParams & {
83 + readonly children: (route: RouteProp<{ Thread: ThreadPreviewParams }, "Thread">) => ReactNode;
84 + },
85 +) {
86 + const host = useNavigation();
87 + const theme = useMobileNavigationTheme();
88 + const { environmentId, threadId } = props;
89 + return (
90 + <NavigationIndependentTree>
91 + <NavigationContainer theme={theme} onUnhandledAction={host.dispatch}>
92 + <Preview.Navigator key={`${environmentId}:${threadId}`}>
93 + <Preview.Screen name="Thread" initialParams={{ environmentId, threadId }}>
94 + {(screen) => props.children(screen.route)}
95 + </Preview.Screen>
96 + </Preview.Navigator>
97 + </NavigationContainer>
98 + </NavigationIndependentTree>
99 + );
100 +}
vite.config.ts
+1 -1
@@ -631,6 +631,7 @@ export default defineConfig({
631 "apps/mobile/src/features/files/AttachmentFileScreen.tsx",
632 "apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx",
633 "apps/mobile/src/features/files/thread-file-navigator-pane.tsx",
634 + "apps/mobile/src/features/layout/nested-stacks.tsx",
635 "apps/mobile/src/features/review/ReviewSheet.tsx",
636 "apps/mobile/src/features/review/useNativeReviewDiffBridge.ts",
637 "apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx",
@@ -638,7 +639,6 @@ export default defineConfig({
639 "apps/mobile/src/features/threads/ThreadFeed.tsx",
640 "apps/mobile/src/features/threads/ThreadQueueControl.tsx",
641 "apps/mobile/src/features/review/ReviewCommentCard.tsx",
641 - "apps/mobile/src/features/threads/ThreadSettingsSheet.tsx",
642 "apps/mobile/src/features/threads/thread-list-v2-items.tsx",
643 "apps/mobile/src/lib/useMobileNavigationTheme.ts",
644 "apps/mobile/src/native/T3ComposerEditor.ios.tsx",