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

main
tsx 59 lines 2.38 KB
Raw
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 }