Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

Stack.tsx

585 lines21.9 KB

1import {
2 createPathConfigForStaticNavigation,
3 getPathFromState,
4 NavigationState,
5 StackActions,
6 useNavigation,
7} from "@react-navigation/native";
8import {
9 createNativeStackNavigator,
10 createNativeStackScreen,
11 type NativeStackNavigationOptions,
12} from "@react-navigation/native-stack";
13import { useEffect, useRef } from "react";
14import { DynamicColorIOS, Platform, Pressable, ScrollView, StyleSheet } from "react-native";
15import { useResolveClassNames } from "uniwind";
16​
17import { AppText as Text } from "./components/AppText";
18import { getCompactBrandHeaderOptions } from "./components/CompactBrandTitle";
19import { ArchivedThreadsRouteScreen } from "./features/archive/ArchivedThreadsRouteScreen";
20import { useAgentNotificationNavigation } from "./features/agent-awareness/notificationNavigation";
21import { ClerkSettingsSheetDetentProvider } from "./features/cloud/ClerkSettingsSheetDetent";
22import { ConnectOnboardingRouteScreen } from "./features/cloud/ConnectOnboardingRouteScreen";
23import { useConnectOnboardingNavigation } from "./features/cloud/connectOnboardingNavigation";
24import { ThreadFilesTreeScreen, ThreadFileScreen } from "./features/files/ThreadFilesRouteScreen";
25import { AdaptiveWorkspaceLayout } from "./features/layout/AdaptiveWorkspaceLayout";
26import { HardwareKeyboardCommandProvider } from "./features/keyboard/HardwareKeyboardCommandProvider";
27import { ReviewCommentComposerSheet } from "./features/review/ReviewCommentComposerSheet";
28import { ReviewSheet } from "./features/review/ReviewSheet";
29import { ThreadTerminalRouteScreen } from "./features/terminal/ThreadTerminalRouteScreen";
30import { GitBranchesSheet } from "./features/threads/git/GitBranchesSheet";
31import { GitCommitSheet } from "./features/threads/git/GitCommitSheet";
32import { GitConfirmSheet } from "./features/threads/git/GitConfirmSheet";
33import { GitOverviewSheet } from "./features/threads/git/GitOverviewSheet";
34import { ThreadRouteScreen } from "./features/threads/ThreadRouteScreen";
35import { ConnectionsRouteScreen } from "./features/connection/ConnectionsRouteScreen";
36import { ConnectionsNewRouteScreen } from "./features/connection/ConnectionsNewRouteScreen";
37import { HomeRouteScreen } from "./features/home/HomeRouteScreen";
38import { AddProjectDestinationRoute } from "./features/projects/AddProjectDestinationRoute";
39import { AddProjectLocalRoute } from "./features/projects/AddProjectLocalRoute";
40import { AddProjectRepositoryRoute } from "./features/projects/AddProjectRepositoryRoute";
41import { AddProjectSourceRoute } from "./features/projects/AddProjectSourceRoute";
42import { NewTaskDraftRouteScreen } from "./features/threads/NewTaskDraftRouteScreen";
43import { NewTaskFlowProvider } from "./features/threads/new-task-flow-provider";
44import { NewTaskRouteScreen } from "./features/threads/NewTaskRouteScreen";
45import { SettingsAppearanceRouteScreen } from "./features/settings/SettingsAppearanceRouteScreen";
46import { SettingsClientStorageRouteScreen } from "./features/settings/SettingsClientStorageRouteScreen";
47import { SettingsAuthRouteScreen } from "./features/settings/SettingsAuthRouteScreen";
48import { SettingsEnvironmentsRouteScreen } from "./features/settings/SettingsEnvironmentsRouteScreen";
49import { SettingsLegalRouteScreen } from "./features/settings/SettingsLegalRouteScreen";
50import { SettingsProjectGroupingRouteScreen } from "./features/settings/SettingsProjectGroupingRouteScreen";
51import { SettingsRouteScreen } from "./features/settings/SettingsRouteScreen";
52import { ShowcaseCaptureCoordinator } from "./features/showcase/ShowcaseCaptureCoordinator";
53import {
54 SettingsLegalDocumentCloseHeaderButton,
55 SettingsLegalDocumentExternalHeaderButton,
56} from "./features/settings/components/SettingsLegalDocumentRouteScreen";
57import { useAppShortcuts } from "./features/shortcuts/useAppShortcuts";
58import { useIncomingShare } from "./features/sharing/IncomingShareProvider";
59import {
60 EMPTY_INCOMING_SHARE_PRESENTATION_STATE,
61 transitionIncomingSharePresentation,
62} from "./features/sharing/incoming-share-presentation";
63import { NATIVE_LIQUID_GLASS_SUPPORTED } from "./native/native-glass";
64import { nativeHeaderScrollEdgeEffects } from "./native/StackHeader";
65import { useThreadOutboxDrain } from "./state/use-thread-outbox-drain";
66​
67const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
68​
69// Matches --color-sheet in global.css (light/dark). DynamicColorIOS lets the header
70// background stay STATIC config while still adapting to appearance changes.
71const SHEET_BACKGROUND_COLOR =
72 Platform.OS === "ios"
73 ? DynamicColorIOS({ light: "rgba(242, 242, 247, 0.98)", dark: "rgba(14, 14, 14, 0.98)" })
74 : undefined;
75​
76type AppScreenOptions = NativeStackNavigationOptions & {
77 readonly unstable_navigationItemStyle?: "editor";
78};
79​
80// Shared header presets. Screens only override genuinely dynamic values (titles,
81// subtitles, toolbar items, search callbacks) via NativeStackScreenOptions.
82//
83// GLASS: transparent header over the screen's primary scroll view on supported
84// iOS versions. Pre-glass iOS gets the same solid material as internal-scroll
85// surfaces so content is laid out below the bar instead of underlapping it.
86const GLASS_HEADER_OPTIONS: AppScreenOptions = {
87 headerBackButtonDisplayMode: "minimal",
88 headerBackTitle: "",
89 headerLargeTitle: false,
90 headerShadowVisible: false,
91 headerShown: true,
92 headerStyle: NATIVE_LIQUID_GLASS_SUPPORTED
93 ? { backgroundColor: "transparent" }
94 : SHEET_BACKGROUND_COLOR !== undefined
95 ? { backgroundColor: SHEET_BACKGROUND_COLOR as unknown as string }
96 : undefined,
97 headerTitleStyle: { fontSize: 18, fontWeight: "800" },
98 headerTransparent: NATIVE_LIQUID_GLASS_SUPPORTED,
99 scrollEdgeEffects: NATIVE_LIQUID_GLASS_SUPPORTED ? HEADER_SCROLL_EDGE_EFFECTS : undefined,
100 unstable_navigationItemStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? "editor" : undefined,
101};
102​
103// SOLID: opaque sheet-colored header for surfaces whose content scrolls internally
104// (file viewer, terminal, review) — there is nothing for glass to sample there.
105const SOLID_HEADER_OPTIONS: AppScreenOptions = {
106 headerBackButtonDisplayMode: "minimal",
107 headerBackTitle: "",
108 headerLargeTitle: false,
109 headerShadowVisible: false,
110 headerShown: true,
111 headerStyle:
112 SHEET_BACKGROUND_COLOR !== undefined
113 ? // native-stack types this as `string`, but the native side accepts any
114 // ColorValue including DynamicColorIOS.
115 { backgroundColor: SHEET_BACKGROUND_COLOR as unknown as string }
116 : undefined,
117 headerTitleStyle: { fontSize: 18, fontWeight: "800" },
118 headerTransparent: false,
119 unstable_navigationItemStyle: Platform.OS === "ios" ? "editor" : undefined,
120};
121​
122// Solid header variant for screens inside sheets (centered title, no editor style).
123const SHEET_SOLID_HEADER_OPTIONS: AppScreenOptions = {
124 ...SOLID_HEADER_OPTIONS,
125 unstable_navigationItemStyle: undefined,
126};
127​
128const LEGAL_DOCUMENT_HEADER_OPTIONS: AppScreenOptions = {
129 ...SHEET_SOLID_HEADER_OPTIONS,
130 headerBackVisible: false,
131 headerLeft: SettingsLegalDocumentCloseHeaderButton,
132 headerRight: () => <SettingsLegalDocumentExternalHeaderButton />,
133 presentation: "fullScreenModal",
134};
135​
136const SettingsSheetStack = createNativeStackNavigator({
137 initialRouteName: "Settings",
138 screenOptions: {
139 ...GLASS_HEADER_OPTIONS,
140 // Sheets read better with the iOS-default centered title (no editor style).
141 unstable_navigationItemStyle: undefined,
142 },
143 screens: {
144 Settings: createNativeStackScreen({
145 screen: SettingsRouteScreen,
146 linking: "",
147 options: {
148 title: "Settings",
149 },
150 }),
151 SettingsEnvironments: createNativeStackScreen({
152 screen: SettingsEnvironmentsRouteScreen,
153 linking: "environments",
154 options: {
155 title: "Environments",
156 },
157 }),
158 SettingsEnvironmentNew: createNativeStackScreen({
159 screen: ConnectionsNewRouteScreen,
160 linking: "environment-new",
161 options: {
162 title: "Add Environment",
163 },
164 }),
165 SettingsArchive: createNativeStackScreen({
166 screen: ArchivedThreadsRouteScreen,
167 linking: "archive",
168 options: {
169 title: "Archived Threads",
170 },
171 }),
172 SettingsAppearance: createNativeStackScreen({
173 screen: SettingsAppearanceRouteScreen,
174 linking: "appearance",
175 options: {
176 title: "Appearance",
177 },
178 }),
179 SettingsProjectGrouping: createNativeStackScreen({
180 screen: SettingsProjectGroupingRouteScreen,
181 linking: "project-grouping",
182 options: {
183 title: "Project Grouping",
184 },
185 }),
186 SettingsClientStorage: createNativeStackScreen({
187 screen: SettingsClientStorageRouteScreen,
188 linking: "client-storage",
189 options: {
190 title: "Client Storage",
191 },
192 }),
193 SettingsAuth: createNativeStackScreen({
194 screen: SettingsAuthRouteScreen,
195 linking: "auth",
196 options: {
197 title: "Sign in",
198 },
199 }),
200 SettingsWaitlist: createNativeStackScreen({
201 // Keep the old deep link working after the Connect GA launch.
202 screen: SettingsAuthRouteScreen,
203 linking: "waitlist",
204 options: {
205 title: "Sign in",
206 },
207 }),
208 },
209});
210​
211// Thread routes live FLAT in the root stack (not in a nested navigator). A nested
212// stack means a second UINavigationController with its own UINavigationBar, which
213// breaks iOS 26's shared-header morphing between Home and Thread (each pair inside
214// one bar morphs; across two bars the whole screen slides). Flat linking paths keep
215// the same deep-link URLs the nested config produced.
216const THREAD_LINKING_PREFIX = "threads/:environmentId/:threadId";
217​
218// New-task / add-project flow: nested navigator inside the formSheet (Settings-sheet
219// pattern — a plain formSheet screen cannot render a stack header; the header and
220// in-sheet pushes come from this nested stack).
221const NewTaskSheetStack = createNativeStackNavigator({
222 initialRouteName: "NewTask",
223 screenOptions: {
224 ...GLASS_HEADER_OPTIONS,
225 // Sheets read better with the iOS-default centered title (no editor style).
226 unstable_navigationItemStyle: undefined,
227 },
228 screens: {
229 NewTask: createNativeStackScreen({
230 screen: NewTaskRouteScreen,
231 linking: "",
232 options: {
233 title: "Choose project",
234 },
235 }),
236 NewTaskDraft: createNativeStackScreen({
237 screen: NewTaskDraftRouteScreen,
238 linking: "draft",
239 // The draft composer has no scroll view for glass to sample; a solid
240 // header also lays the content out below the bar (no manual inset).
241 options: SHEET_SOLID_HEADER_OPTIONS,
242 }),
243 AddProject: createNativeStackScreen({
244 screen: AddProjectSourceRoute,
245 linking: "add-project",
246 options: {
247 title: "Add Project",
248 },
249 }),
250 AddProjectRepository: createNativeStackScreen({
251 screen: AddProjectRepositoryRoute,
252 linking: "add-project/repository",
253 }),
254 AddProjectDestination: createNativeStackScreen({
255 screen: AddProjectDestinationRoute,
256 linking: "add-project/destination",
257 }),
258 AddProjectLocal: createNativeStackScreen({
259 screen: AddProjectLocalRoute,
260 linking: "add-project/local",
261 }),
262 },
263});
264​
265// Routes presented as sheets/overlays ON TOP of the workspace. They must not
266// influence the adaptive workspace layout: opening Settings over Home should
267// not flip the sidebar in or change the active thread.
268const WORKSPACE_OVERLAY_ROUTES = new Set([
269 "ConnectOnboarding",
270 "Connections",
271 "ConnectionsNew",
272 "GitBranches",
273 "GitCommit",
274 "GitConfirm",
275 "GitOverview",
276 "NewTaskSheet",
277 "SettingsLegal",
278 "SettingsSheet",
279 "ThreadReviewComment",
280]);
281​
282/**
283 * Pathname of the topmost NON-overlay route — the screen the workspace is
284 * actually "on", regardless of any sheets floating above it.
285 */
286function workspacePathFromState(state: NavigationState): string {
287 const routes = state.routes.filter((route) => !WORKSPACE_OVERLAY_ROUTES.has(route.name));
288 const effectiveState =
289 routes.length > 0 && routes.length !== state.routes.length
290 ? ({ ...state, routes, index: routes.length - 1 } as NavigationState)
291 : state;
292 const path = getPathFromState(effectiveState, navigationPathConfig);
293 return path.startsWith("/") ? path : `/${path}`;
295​
296// The drain hook subscribes to the outbox, all thread shells, projects, and
297// connection statuses. Hosting it in a null-rendering leaf keeps those
298// updates from re-rendering RootStackLayout (and with it every screen) on
299// each enqueue, shell change, or reconnect.
300function ThreadOutboxDrainWorker() {
301 useThreadOutboxDrain();
302 return null;
304​
305function RootStackLayout(props: {
306 readonly children: React.ReactNode;
307 readonly state: NavigationState;
308}) {
309 const navigation = useNavigation();
310 const { pendingShare } = useIncomingShare();
311 const sharePresentationRef = useRef(EMPTY_INCOMING_SHARE_PRESENTATION_STATE);
312 useAgentNotificationNavigation();
313 // Presents the T3 Connect onboarding sheet after an in-session sign-in.
314 useConnectOnboardingNavigation();
315 // Launcher app shortcuts: routes shortcut taps and tracks opened threads.
316 useAppShortcuts(props.state);
317 useEffect(() => {
318 const topRouteName = props.state.routes[props.state.index]?.name;
319 const transition = transitionIncomingSharePresentation(sharePresentationRef.current, {
320 isShareSheetPresented: topRouteName === "NewTaskSheet",
321 pendingShareId: pendingShare?.id ?? null,
322 });
323 sharePresentationRef.current = transition.state;
324 if (!transition.shareIdToPresent) {
325 return;
326 }
327 navigation.navigate("NewTaskSheet", {
328 screen: "NewTask",
329 params: { incomingShareId: transition.shareIdToPresent },
330 });
331 }, [navigation, pendingShare, props.state]);
332 // Full pathname (sheets included) for keyboard-command scoping; the
333 // workspace layout only reacts to the underlying non-overlay route.
334 const path = getPathFromState(props.state, navigationPathConfig);
335 const pathname = path.startsWith("/") ? path : `/${path}`;
336 const workspacePathname = workspacePathFromState(props.state);
337​
338 return (
339 <HardwareKeyboardCommandProvider pathname={pathname}>
340 <ThreadOutboxDrainWorker />
341 <ShowcaseCaptureCoordinator pathname={pathname} />
342 <ClerkSettingsSheetDetentProvider initiallyExpanded={false}>
343 <AdaptiveWorkspaceLayout pathname={workspacePathname}>
344 {props.children}
345 </AdaptiveWorkspaceLayout>
346 </ClerkSettingsSheetDetentProvider>
347 </HardwareKeyboardCommandProvider>
348 );
350​
351function NotFoundScreen() {
352 const navigation = useNavigation();
353 const screenBgStyle = StyleSheet.flatten(useResolveClassNames("bg-screen"));
354 const primaryBgStyle = StyleSheet.flatten(useResolveClassNames("bg-primary"));
355 const returnHomeButtonStyle = StyleSheet.flatten([
356 {
357 borderRadius: 999,
358 paddingHorizontal: 20,
359 paddingVertical: 14,
360 },
361 primaryBgStyle,
362 ]);
363​
364 return (
365 <ScrollView
366 contentInsetAdjustmentBehavior="automatic"
367 contentContainerStyle={{
368 flexGrow: 1,
369 alignItems: "center",
370 justifyContent: "center",
371 gap: 16,
372 paddingHorizontal: 24,
373 paddingVertical: 32,
374 }}
375 style={[{ flex: 1 }, screenBgStyle]}
376 >
377 <Text className="text-3xl font-t3-bold text-foreground" selectable>
378 Route not found
379 </Text>
380 <Pressable
381 style={returnHomeButtonStyle}
382 onPress={() => navigation.dispatch(StackActions.replace("Home"))}
383 >
384 <Text className="text-base font-t3-bold text-primary-foreground">Return home</Text>
385 </Pressable>
386 </ScrollView>
387 );
389​
390export const RootStack = createNativeStackNavigator({
391 initialRouteName: "Home",
392 layout: RootStackLayout,
393 screenOptions: {
394 headerShown: false,
395 },
396 screens: {
397 Home: createNativeStackScreen({
398 screen: HomeRouteScreen,
399 linking: "",
400 options: {
401 ...GLASS_HEADER_OPTIONS,
402 contentStyle: { backgroundColor: "transparent" },
403 headerBackVisible: false,
404 ...getCompactBrandHeaderOptions(),
405 },
406 }),
407 Thread: createNativeStackScreen({
408 screen: ThreadRouteScreen,
409 linking: THREAD_LINKING_PREFIX,
410 options: GLASS_HEADER_OPTIONS,
411 }),
412 ThreadTerminal: createNativeStackScreen({
413 screen: ThreadTerminalRouteScreen,
414 linking: `${THREAD_LINKING_PREFIX}/terminal`,
415 options: SOLID_HEADER_OPTIONS,
416 }),
417 ThreadReview: createNativeStackScreen({
418 screen: ReviewSheet,
419 linking: `${THREAD_LINKING_PREFIX}/review`,
420 options: SOLID_HEADER_OPTIONS,
421 }),
422 ThreadReviewComment: createNativeStackScreen({
423 screen: ReviewCommentComposerSheet,
424 linking: `${THREAD_LINKING_PREFIX}/review-comment`,
425 options: {
426 // Android cannot host the keyboard-driven comment composer inside a
427 // formSheet; use a full-screen modal there instead.
428 presentation: Platform.OS === "android" ? "fullScreenModal" : "formSheet",
429 sheetAllowedDetents: Platform.OS === "android" ? undefined : [0.55, 0.92],
430 sheetGrabberVisible: Platform.OS !== "android",
431 },
432 }),
433 ThreadFiles: createNativeStackScreen({
434 screen: ThreadFilesTreeScreen,
435 linking: `${THREAD_LINKING_PREFIX}/files`,
436 options: {
437 ...GLASS_HEADER_OPTIONS,
438 contentStyle:
439 SHEET_BACKGROUND_COLOR !== undefined
440 ? { backgroundColor: SHEET_BACKGROUND_COLOR }
441 : undefined,
442 title: "Files",
443 },
444 }),
445 ThreadFile: createNativeStackScreen({
446 screen: ThreadFileScreen,
447 linking: `${THREAD_LINKING_PREFIX}/files/:path*`,
448 options: SOLID_HEADER_OPTIONS,
449 }),
450 GitOverview: createNativeStackScreen({
451 screen: GitOverviewSheet,
452 linking: `${THREAD_LINKING_PREFIX}/git`,
453 options: {
454 presentation: "formSheet",
455 sheetAllowedDetents: [0.55, 0.92],
456 sheetGrabberVisible: true,
457 },
458 }),
459 GitCommit: createNativeStackScreen({
460 screen: GitCommitSheet,
461 linking: `${THREAD_LINKING_PREFIX}/git/commit`,
462 options: {
463 presentation: "formSheet",
464 sheetAllowedDetents: [0.55, 0.92],
465 sheetGrabberVisible: true,
466 },
467 }),
468 GitBranches: createNativeStackScreen({
469 screen: GitBranchesSheet,
470 linking: `${THREAD_LINKING_PREFIX}/git/branches`,
471 options: {
472 presentation: "formSheet",
473 sheetAllowedDetents: [0.55, 0.92],
474 sheetGrabberVisible: true,
475 },
476 }),
477 GitConfirm: createNativeStackScreen({
478 screen: GitConfirmSheet,
479 linking: `${THREAD_LINKING_PREFIX}/git-confirm`,
480 options: {
481 presentation: "formSheet",
482 sheetAllowedDetents: [0.45, 0.7],
483 sheetGrabberVisible: true,
484 },
485 }),
486 SettingsSheet: createNativeStackScreen({
487 screen: SettingsSheetStack,
488 linking: "settings",
489 options: {
490 gestureEnabled: true,
491 headerShown: false,
492 // Android pushes settings as a regular full page with an in-screen
493 // back header; iOS keeps the detented form sheet.
494 ...(Platform.OS === "android"
495 ? { presentation: "card" as const }
496 : {
497 presentation: "formSheet" as const,
498 sheetAllowedDetents: [0.7, 0.92],
499 sheetGrabberVisible: true,
500 }),
501 },
502 }),
503 SettingsLegal: createNativeStackScreen({
504 screen: SettingsLegalRouteScreen,
505 linking: "settings/legal",
506 options: {
507 ...LEGAL_DOCUMENT_HEADER_OPTIONS,
508 title: "Legal",
509 },
510 }),
511 ConnectOnboarding: createNativeStackScreen({
512 screen: ConnectOnboardingRouteScreen,
513 linking: "connect-onboarding",
514 options: {
515 // A root-level Android formSheet does not host the native stack bar;
516 // the route renders an embedded AndroidSheetHeader instead.
517 ...(Platform.OS === "android" ? { headerShown: false } : SHEET_SOLID_HEADER_OPTIONS),
518 title: "Set up T3 Connect",
519 gestureEnabled: true,
520 presentation: "formSheet",
521 sheetAllowedDetents: [0.6, 0.95],
522 sheetGrabberVisible: true,
523 },
524 }),
525 Connections: createNativeStackScreen({
526 screen: ConnectionsRouteScreen,
527 linking: "connections",
528 options: {
529 title: "Environments",
530 // Android: full page; the screen renders its own AndroidScreenHeader,
531 // so the native bar stays hidden. iOS keeps the sheet.
532 ...(Platform.OS === "android"
533 ? { presentation: "card" as const, headerShown: false }
534 : {
535 presentation: "formSheet" as const,
536 sheetAllowedDetents: [0.55, 0.7],
537 sheetGrabberVisible: true,
538 }),
539 },
540 }),
541 ConnectionsNew: createNativeStackScreen({
542 screen: ConnectionsNewRouteScreen,
543 linking: "connections/new",
544 options: {
545 presentation: "formSheet",
546 sheetAllowedDetents: [0.55, 0.7],
547 sheetGrabberVisible: true,
548 },
549 }),
550 NewTaskSheet: createNativeStackScreen({
551 screen: NewTaskSheetStack,
552 linking: "new",
553 // The whole new-task flow (choose project → draft → add project) shares
554 // draft state via NewTaskFlowProvider. The expo-router era mounted it in
555 // app/new/_layout.tsx; this layout wrapper is the native-stack equivalent.
556 layout: ({ children }) => <NewTaskFlowProvider>{children}</NewTaskFlowProvider>,
557 options: {
558 gestureEnabled: true,
559 headerShown: false,
560 // Android pushes the flow as a regular full page — the draft should
561 // read like a thread that just doesn't exist yet; iOS keeps the sheet.
562 ...(Platform.OS === "android"
563 ? { presentation: "card" as const }
564 : {
565 presentation: "formSheet" as const,
566 sheetAllowedDetents: [0.92],
567 sheetGrabberVisible: true,
568 }),
569 },
570 }),
571 NotFound: createNativeStackScreen({
572 screen: NotFoundScreen,
573 linking: "*",
574 }),
575 },
576});
577type RootStackType = typeof RootStack;
578​
579const navigationPathConfig = {
580 screens: createPathConfigForStaticNavigation(RootStack) ?? {},
581};
582​
583declare module "@react-navigation/native" {
584 interface RootNavigator extends RootStackType {}