Open History to see the last commit
1import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
2import { NavigationContainer, NavigationIndependentTree } from "@react-navigation/native";
3import { type NativeStackNavigationOptions } from "@react-navigation/native-stack";
4import type { ReactNode } from "react";
5import { Platform } from "react-native";
6
7import { getCompactBrandHeaderOptions } from "../../components/CompactBrandTitle";
8import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
9import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
10import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
11
12const SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
13
14type SidebarScreenOptions = NativeStackNavigationOptions & {
15 // Same patched RNS option the GLASS/SOLID presets in Stack.tsx use — the
16 // iOS 26 "editor" navigation-item style leading-aligns the inline title.
17 readonly unstable_navigationItemStyle?: "editor";
18};
19
20const SIDEBAR_SCREEN_OPTIONS: SidebarScreenOptions = {
21 contentStyle: { backgroundColor: "transparent" },
22 headerLargeTitle: false,
23 headerShadowVisible: false,
24 headerShown: true,
25 headerStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? { backgroundColor: "transparent" } : undefined,
26 ...getCompactBrandHeaderOptions({ fontSize: 18, fontWeight: "800" }),
27 headerTransparent: NATIVE_LIQUID_GLASS_SUPPORTED,
28 scrollEdgeEffects: NATIVE_LIQUID_GLASS_SUPPORTED ? SCROLL_EDGE_EFFECTS : undefined,
29 unstable_navigationItemStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? "editor" : undefined,
30};
31
32const SidebarStack = createNativeStackNavigator();
33
34export function SidebarNavigationShell(props: { readonly children: ReactNode }) {
35 const navigationTheme = useMobileNavigationTheme("sidebar");
36
37 return (
38 <NavigationIndependentTree>
39 <NavigationContainer theme={navigationTheme}>
40 <SidebarStack.Navigator
41 screenOptions={SIDEBAR_SCREEN_OPTIONS}
42 initialRouteName="SidebarThreads"
43 >
44 <SidebarStack.Screen name="SidebarThreads">{() => props.children}</SidebarStack.Screen>
45 </SidebarStack.Navigator>
46 </NavigationContainer>
47 </NavigationIndependentTree>
48 );
49}