Open History to see the last commit
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 { Platform, Pressable, ScrollView, StyleSheet, View } 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 { ConnectOnboardingRouteScreen } from "./features/cloud/ConnectOnboardingRouteScreen";
22import { useConnectOnboardingNavigation } from "./features/cloud/connectOnboardingNavigation";
23import { AttachmentFileScreen } from "./features/files/AttachmentFileScreen";
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 {
44 NewTaskBranchPickerRouteScreen,
45 NewTaskEnvironmentPickerRouteScreen,
46} from "./features/threads/NewTaskContextPickerScreens";
47import {
48 ExistingThreadSettingsRouteProvider,
49 ExistingThreadSettingsRouteScreen,
50 NewTaskThreadSettingsRouteScreen,
51} from "./features/threads/ThreadSettingsSheet";
52import { NewTaskFlowProvider } from "./features/threads/new-task-flow-provider";
53import { NewTaskRouteScreen } from "./features/threads/NewTaskRouteScreen";
54import { SettingsAppearanceRouteScreen } from "./features/settings/SettingsAppearanceRouteScreen";
55import { SettingsClientStorageRouteScreen } from "./features/settings/SettingsClientStorageRouteScreen";
56import { SettingsAuthRouteScreen } from "./features/settings/SettingsAuthRouteScreen";
57import { SettingsEnvironmentsRouteScreen } from "./features/settings/SettingsEnvironmentsRouteScreen";
58import { SettingsLegalRouteScreen } from "./features/settings/SettingsLegalRouteScreen";
59import {
60 SettingsOpenSourceLicenseRouteScreen,
61 SettingsOpenSourceLicensesRouteScreen,
62} from "./features/settings/SettingsOpenSourceLicensesRouteScreen";
63import { SettingsProjectGroupingRouteScreen } from "./features/settings/SettingsProjectGroupingRouteScreen";
64import { UsageLimitAccountScreen } from "./features/usage/UsageLimitsPooled";
65import { UsageRouteScreen } from "./features/usage/UsageRouteScreen";
66import { SettingsRouteScreen } from "./features/settings/SettingsRouteScreen";
67import { ShowcaseCaptureCoordinator } from "./features/showcase/ShowcaseCaptureCoordinator";
68import {
69 SettingsLegalDocumentCloseHeaderButton,
70 SettingsLegalDocumentExternalHeaderButton,
71} from "./features/settings/components/SettingsLegalDocumentRouteScreen";
72import { useAppShortcuts } from "./features/shortcuts/useAppShortcuts";
73import { useIncomingShare } from "./features/sharing/IncomingShareProvider";
74import {
75 EMPTY_INCOMING_SHARE_PRESENTATION_STATE,
76 transitionIncomingSharePresentation,
77} from "./features/sharing/incoming-share-presentation";
78import { NATIVE_LIQUID_GLASS_SUPPORTED } from "./native/native-glass";
79import { nativeHeaderScrollEdgeEffects } from "./native/StackHeader";
80import { FORM_SHEET_PRESENTATION_OPTIONS } from "./native/sheet-surface";
81import { useThreadOutboxDrain } from "./state/use-thread-outbox-drain";
82import { useComposerAttachmentUploadWorker } from "./state/composer-attachment-uploads";
83
84const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
85
86type AppScreenOptions = NativeStackNavigationOptions & {
87 readonly unstable_navigationItemStyle?: "editor";
88};
89
90// Shared header presets. Screens only override genuinely dynamic values (titles,
91// subtitles, toolbar items, search callbacks) via NativeStackScreenOptions.
92//
93// GLASS: transparent header over the screen's primary scroll view on supported
94// iOS versions. Pre-glass iOS gets the same solid material as internal-scroll
95// surfaces so content is laid out below the bar instead of underlapping it.
96const GLASS_HEADER_OPTIONS: AppScreenOptions = {
97 headerBackButtonDisplayMode: "minimal",
98 headerBackTitle: "",
99 headerLargeTitle: false,
100 headerShadowVisible: false,
101 headerShown: true,
102 headerStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? { backgroundColor: "transparent" } : undefined,
103 headerTitleStyle: { fontSize: 18, fontWeight: "800" },
104 headerTransparent: NATIVE_LIQUID_GLASS_SUPPORTED,
105 scrollEdgeEffects: NATIVE_LIQUID_GLASS_SUPPORTED ? HEADER_SCROLL_EDGE_EFFECTS : undefined,
106 unstable_navigationItemStyle: NATIVE_LIQUID_GLASS_SUPPORTED ? "editor" : undefined,
107};
108
109// SOLID: opaque sheet-colored header for surfaces whose content scrolls internally
110// (file viewer, terminal, review) — there is nothing for glass to sample there.
111const SOLID_HEADER_OPTIONS: AppScreenOptions = {
112 headerBackButtonDisplayMode: "minimal",
113 headerBackTitle: "",
114 headerLargeTitle: false,
115 headerShadowVisible: false,
116 headerShown: true,
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
128// A native glass header for a sheet screen whose primary child is a scroll
129// view. The centered sheet title stays stable while UIKit supplies scroll-edge
130// fading from that child.
131const SHEET_GLASS_HEADER_OPTIONS: AppScreenOptions = {
132 ...GLASS_HEADER_OPTIONS,
133 unstable_navigationItemStyle: undefined,
134};
135
136const LEGAL_DOCUMENT_HEADER_OPTIONS: AppScreenOptions = {
137 ...SHEET_SOLID_HEADER_OPTIONS,
138 headerBackVisible: false,
139 headerLeft: SettingsLegalDocumentCloseHeaderButton,
140 headerRight: () => <SettingsLegalDocumentExternalHeaderButton />,
141 presentation: "fullScreenModal",
142};
143
144const SettingsContentStack = createNativeStackNavigator({
145 initialRouteName: "Settings",
146 screenOptions: {
147 ...GLASS_HEADER_OPTIONS,
148 // Sheets read better with the iOS-default centered title (no editor style).
149 unstable_navigationItemStyle: undefined,
150 },
151 screens: {
152 Settings: createNativeStackScreen({
153 screen: SettingsRouteScreen,
154 linking: "",
155 options: {
156 title: "Settings",
157 },
158 }),
159 SettingsEnvironments: createNativeStackScreen({
160 screen: SettingsEnvironmentsRouteScreen,
161 linking: "environments",
162 options: {
163 title: "Environments",
164 },
165 }),
166 SettingsEnvironmentNew: createNativeStackScreen({
167 screen: ConnectionsNewRouteScreen,
168 linking: "environment-new",
169 options: {
170 title: "Add Environment",
171 },
172 }),
173 SettingsArchive: createNativeStackScreen({
174 screen: ArchivedThreadsRouteScreen,
175 linking: "archive",
176 options: {
177 title: "Archived Threads",
178 },
179 }),
180 SettingsAppearance: createNativeStackScreen({
181 screen: SettingsAppearanceRouteScreen,
182 linking: "appearance",
183 options: {
184 title: "Appearance",
185 },
186 }),
187 SettingsProjectGrouping: createNativeStackScreen({
188 screen: SettingsProjectGroupingRouteScreen,
189 linking: "project-grouping",
190 options: {
191 title: "Project Grouping",
192 },
193 }),
194 SettingsClientStorage: createNativeStackScreen({
195 screen: SettingsClientStorageRouteScreen,
196 linking: "client-storage",
197 options: {
198 title: "Client Storage",
199 },
200 }),
201 SettingsUsageAccount: createNativeStackScreen({
202 screen: UsageLimitAccountScreen,
203 options: { title: "Account" },
204 }),
205 SettingsOpenSourceLicenses: createNativeStackScreen({
206 screen: SettingsOpenSourceLicensesRouteScreen,
207 linking: "open-source-licenses",
208 options: {
209 title: "Open source licenses",
210 },
211 }),
212 SettingsOpenSourceLicense: createNativeStackScreen({
213 screen: SettingsOpenSourceLicenseRouteScreen,
214 linking: "open-source-licenses/:entryKey",
215 options: {
216 title: "License notice",
217 },
218 }),
219 SettingsUsage: createNativeStackScreen({
220 screen: UsageRouteScreen,
221 linking: "usage",
222 options: {
223 title: "Usage",
224 },
225 }),
226 },
227});
228
229// The outer stack never owns visible chrome. Settings routes render inside a
230// nested stack whose native header remains mounted, while Clerk owns auth chrome.
231// Keeping bar visibility invariant avoids iOS 26's headerless-to-headered jump.
232const SettingsSheetStack = createNativeStackNavigator({
233 initialRouteName: "SettingsContent",
234 screenOptions: {
235 headerShown: false,
236 },
237 screens: {
238 SettingsContent: createNativeStackScreen({
239 screen: SettingsContentStack,
240 linking: "",
241 }),
242 SettingsAuth: createNativeStackScreen({
243 screen: SettingsAuthRouteScreen,
244 linking: "auth",
245 }),
246 SettingsWaitlist: createNativeStackScreen({
247 // Keep the old deep link working after the Connect GA launch.
248 screen: SettingsAuthRouteScreen,
249 linking: "waitlist",
250 }),
251 },
252});
253
254// Thread routes live FLAT in the root stack (not in a nested navigator). A nested
255// stack means a second UINavigationController with its own UINavigationBar, which
256// breaks iOS 26's shared-header morphing between Home and Thread (each pair inside
257// one bar morphs; across two bars the whole screen slides). Flat linking paths keep
258// the same deep-link URLs the nested config produced.
259const THREAD_LINKING_PREFIX = "threads/:environmentId/:threadId";
260
261// New-task / add-project flow: nested navigator inside the formSheet (Settings-sheet
262// pattern — a plain formSheet screen cannot render a stack header; the header and
263// in-sheet pushes come from this nested stack).
264const NewTaskSheetStack = createNativeStackNavigator({
265 initialRouteName: "NewTask",
266 screenOptions: {
267 ...SHEET_GLASS_HEADER_OPTIONS,
268 // The form-sheet host owns the one opaque adaptive surface. Child screens
269 // and the navigation bar stay transparent over it, avoiding visible color
270 // slabs as view controllers move horizontally.
271 contentStyle: Platform.OS === "ios" ? { backgroundColor: "transparent" } : undefined,
272 // UIKit's default push adds a dimming shadow and independently transitions
273 // the navigation bar. Both read as mismatched sheet backgrounds here.
274 // simple_push retains native push/pop gestures without either artifact.
275 animation: Platform.OS === "ios" ? "simple_push" : undefined,
276 animationDuration: Platform.OS === "ios" ? 350 : undefined,
277 },
278 screens: {
279 NewTask: createNativeStackScreen({
280 screen: NewTaskRouteScreen,
281 linking: "",
282 options: {
283 title: "Choose project",
284 },
285 }),
286 NewTaskDraft: createNativeStackScreen({
287 screen: NewTaskDraftRouteScreen,
288 linking: "draft",
289 options: {
290 headerBackVisible: false,
291 title: "",
292 },
293 }),
294 NewTaskEnvironment: createNativeStackScreen({
295 screen: NewTaskEnvironmentPickerRouteScreen,
296 linking: "draft/environment",
297 options: {
298 title: "Environment",
299 },
300 }),
301 NewTaskBranch: createNativeStackScreen({
302 screen: NewTaskBranchPickerRouteScreen,
303 linking: "draft/branch",
304 options: {
305 title: "Branch",
306 },
307 }),
308 // The same file view the thread composer pushes. A draft has no thread, so it names its
309 // own workspace through route params instead of resolving one from a selected thread.
310 NewTaskFile: createNativeStackScreen({
311 screen: ThreadFileScreen,
312 linking: "draft/files/:path*",
313 options: SOLID_HEADER_OPTIONS,
314 }),
315 NewTaskAttachment: createNativeStackScreen({
316 screen: AttachmentFileScreen,
317 linking: "draft/attachments/:attachmentId",
318 options: SOLID_HEADER_OPTIONS,
319 }),
320 ThreadSettings: createNativeStackScreen({
321 screen: NewTaskThreadSettingsRouteScreen,
322 linking: "draft/settings",
323 options: {
324 gestureEnabled: true,
325 headerShown: false,
326 ...(Platform.OS === "android"
327 ? { presentation: "card" as const }
328 : {
329 ...FORM_SHEET_PRESENTATION_OPTIONS,
330 sheetAllowedDetents: [1],
331 sheetGrabberVisible: true,
332 }),
333 },
334 }),
335 AddProject: createNativeStackScreen({
336 screen: AddProjectSourceRoute,
337 linking: "add-project",
338 options: {
339 title: "Add Project",
340 },
341 }),
342 AddProjectRepository: createNativeStackScreen({
343 screen: AddProjectRepositoryRoute,
344 linking: "add-project/repository",
345 }),
346 AddProjectDestination: createNativeStackScreen({
347 screen: AddProjectDestinationRoute,
348 linking: "add-project/destination",
349 }),
350 AddProjectLocal: createNativeStackScreen({
351 screen: AddProjectLocalRoute,
352 linking: "add-project/local",
353 }),
354 },
355});
356
357// Routes presented as sheets/overlays ON TOP of the workspace. They must not
358// influence the adaptive workspace layout: opening Settings over Home should
359// not flip the sidebar in or change the active thread.
360const WORKSPACE_OVERLAY_ROUTES = new Set([
361 "ConnectOnboarding",
362 "Connections",
363 "ConnectionsNew",
364 "GitBranches",
365 "GitCommit",
366 "GitConfirm",
367 "GitOverview",
368 "NewTaskSheet",
369 "SettingsLegal",
370 "SettingsSheet",
371 "ThreadReviewComment",
372 "ThreadSettingsSheet",
373]);
374
375/**
376 * Pathname of the topmost NON-overlay route — the screen the workspace is
377 * actually "on", regardless of any sheets floating above it.
378 */
379function workspacePathFromState(state: NavigationState): string {
380 const routes = state.routes.filter((route) => !WORKSPACE_OVERLAY_ROUTES.has(route.name));
381 const effectiveState =
382 routes.length > 0 && routes.length !== state.routes.length
383 ? ({ ...state, routes, index: routes.length - 1 } as NavigationState)
384 : state;
385 const path = getPathFromState(effectiveState, navigationPathConfig);
386 return path.startsWith("/") ? path : `/${path}`;
387}
388
389// The drain hook subscribes to the outbox, all thread shells, projects, and
390// connection statuses. Hosting it in a null-rendering leaf keeps those
391// updates from re-rendering RootStackLayout (and with it every screen) on
392// each enqueue, shell change, or reconnect.
393function ThreadOutboxDrainWorker() {
394 useThreadOutboxDrain();
395 useComposerAttachmentUploadWorker();
396 return null;
397}
398
399function RootStackLayout(props: {
400 readonly children: React.ReactNode;
401 readonly state: NavigationState;
402}) {
403 const navigation = useNavigation();
404 const { pendingShare } = useIncomingShare();
405 const sharePresentationRef = useRef(EMPTY_INCOMING_SHARE_PRESENTATION_STATE);
406 useAgentNotificationNavigation();
407 // Presents the T3 Connect onboarding sheet after an in-session sign-in.
408 useConnectOnboardingNavigation();
409 // Launcher app shortcuts: routes shortcut taps and tracks opened threads.
410 useAppShortcuts(props.state);
411 useEffect(() => {
412 const topRouteName = props.state.routes[props.state.index]?.name;
413 const transition = transitionIncomingSharePresentation(sharePresentationRef.current, {
414 isShareSheetPresented: topRouteName === "NewTaskSheet",
415 pendingShareId: pendingShare?.id ?? null,
416 });
417 sharePresentationRef.current = transition.state;
418 if (!transition.shareIdToPresent) {
419 return;
420 }
421 navigation.navigate("NewTaskSheet", {
422 screen: "NewTask",
423 params: { incomingShareId: transition.shareIdToPresent },
424 });
425 }, [navigation, pendingShare, props.state]);
426 // Full pathname (sheets included) for keyboard-command scoping; the
427 // workspace layout only reacts to the underlying non-overlay route.
428 const path = getPathFromState(props.state, navigationPathConfig);
429 const pathname = path.startsWith("/") ? path : `/${path}`;
430 const workspacePathname = workspacePathFromState(props.state);
431
432 return (
433 <HardwareKeyboardCommandProvider pathname={pathname}>
434 <ThreadOutboxDrainWorker />
435 <ShowcaseCaptureCoordinator pathname={pathname} />
436 <ExistingThreadSettingsRouteProvider>
437 <AdaptiveWorkspaceLayout pathname={workspacePathname}>
438 {props.children}
439 </AdaptiveWorkspaceLayout>
440 </ExistingThreadSettingsRouteProvider>
441 </HardwareKeyboardCommandProvider>
442 );
443}
444
445function NotFoundScreen() {
446 const navigation = useNavigation();
447 const screenBgStyle = StyleSheet.flatten(useResolveClassNames("bg-screen"));
448 const primaryBgStyle = StyleSheet.flatten(useResolveClassNames("bg-primary"));
449 const returnHomeButtonStyle = StyleSheet.flatten([
450 {
451 borderRadius: 999,
452 paddingHorizontal: 20,
453 paddingVertical: 14,
454 },
455 primaryBgStyle,
456 ]);
457
458 return (
459 <ScrollView
460 contentInsetAdjustmentBehavior="automatic"
461 contentContainerStyle={{
462 flexGrow: 1,
463 alignItems: "center",
464 justifyContent: "center",
465 gap: 16,
466 paddingHorizontal: 24,
467 paddingVertical: 32,
468 }}
469 style={[{ flex: 1 }, screenBgStyle]}
470 >
471 <Text className="text-3xl font-t3-bold text-foreground" selectable>
472 Route not found
473 </Text>
474 <Pressable
475 style={returnHomeButtonStyle}
476 onPress={() => navigation.dispatch(StackActions.replace("Home"))}
477 >
478 <Text className="text-base font-t3-bold text-primary-foreground">Return home</Text>
479 </Pressable>
480 </ScrollView>
481 );
482}
483
484export const RootStack = createNativeStackNavigator({
485 initialRouteName: "Home",
486 layout: RootStackLayout,
487 screenOptions: {
488 headerShown: false,
489 },
490 screens: {
491 Home: createNativeStackScreen({
492 screen: HomeRouteScreen,
493 linking: "",
494 options: {
495 ...GLASS_HEADER_OPTIONS,
496 contentStyle: { backgroundColor: "transparent" },
497 headerBackVisible: false,
498 ...getCompactBrandHeaderOptions(),
499 },
500 }),
501 Thread: createNativeStackScreen({
502 screen: ThreadRouteScreen,
503 linking: THREAD_LINKING_PREFIX,
504 options: GLASS_HEADER_OPTIONS,
505 }),
506 ThreadTerminal: createNativeStackScreen({
507 screen: ThreadTerminalRouteScreen,
508 linking: `${THREAD_LINKING_PREFIX}/terminal`,
509 options: SOLID_HEADER_OPTIONS,
510 }),
511 ThreadReview: createNativeStackScreen({
512 screen: ReviewSheet,
513 linking: `${THREAD_LINKING_PREFIX}/review`,
514 options: SOLID_HEADER_OPTIONS,
515 }),
516 ThreadReviewComment: createNativeStackScreen({
517 screen: ReviewCommentComposerSheet,
518 linking: `${THREAD_LINKING_PREFIX}/review-comment`,
519 options: {
520 // Android cannot host the keyboard-driven comment composer inside a
521 // formSheet; use a full-screen modal there instead.
522 ...(Platform.OS === "android"
523 ? { presentation: "fullScreenModal" as const }
524 : FORM_SHEET_PRESENTATION_OPTIONS),
525 sheetAllowedDetents: Platform.OS === "android" ? undefined : [0.55, 0.92],
526 sheetGrabberVisible: Platform.OS !== "android",
527 },
528 }),
529 ThreadFiles: createNativeStackScreen({
530 screen: ThreadFilesTreeScreen,
531 linking: `${THREAD_LINKING_PREFIX}/files`,
532 options: {
533 ...GLASS_HEADER_OPTIONS,
534 title: "Files",
535 },
536 }),
537 ThreadFile: createNativeStackScreen({
538 screen: ThreadFileScreen,
539 linking: `${THREAD_LINKING_PREFIX}/files/:path*`,
540 options: SOLID_HEADER_OPTIONS,
541 }),
542 ThreadAttachment: createNativeStackScreen({
543 screen: AttachmentFileScreen,
544 linking: `${THREAD_LINKING_PREFIX}/attachments/:attachmentId`,
545 options: SOLID_HEADER_OPTIONS,
546 }),
547 ThreadSettingsSheet: createNativeStackScreen({
548 screen: ExistingThreadSettingsRouteScreen,
549 options: {
550 gestureEnabled: true,
551 headerShown: false,
552 ...(Platform.OS === "android"
553 ? { presentation: "card" as const }
554 : {
555 ...FORM_SHEET_PRESENTATION_OPTIONS,
556 sheetAllowedDetents: [1],
557 sheetGrabberVisible: true,
558 }),
559 },
560 }),
561 GitOverview: createNativeStackScreen({
562 screen: GitOverviewSheet,
563 linking: `${THREAD_LINKING_PREFIX}/git`,
564 options: {
565 ...FORM_SHEET_PRESENTATION_OPTIONS,
566 sheetAllowedDetents: [0.55, 0.92],
567 sheetGrabberVisible: true,
568 },
569 }),
570 GitCommit: createNativeStackScreen({
571 screen: GitCommitSheet,
572 linking: `${THREAD_LINKING_PREFIX}/git/commit`,
573 options: {
574 ...FORM_SHEET_PRESENTATION_OPTIONS,
575 sheetAllowedDetents: [0.55, 0.92],
576 sheetGrabberVisible: true,
577 },
578 }),
579 GitBranches: createNativeStackScreen({
580 screen: GitBranchesSheet,
581 linking: `${THREAD_LINKING_PREFIX}/git/branches`,
582 options: {
583 ...FORM_SHEET_PRESENTATION_OPTIONS,
584 sheetAllowedDetents: [0.55, 0.92],
585 sheetGrabberVisible: true,
586 },
587 }),
588 GitConfirm: createNativeStackScreen({
589 screen: GitConfirmSheet,
590 linking: `${THREAD_LINKING_PREFIX}/git-confirm`,
591 options: {
592 ...FORM_SHEET_PRESENTATION_OPTIONS,
593 sheetAllowedDetents: [0.45, 0.7],
594 sheetGrabberVisible: true,
595 },
596 }),
597 SettingsSheet: createNativeStackScreen({
598 screen: SettingsSheetStack,
599 linking: "settings",
600 options: {
601 gestureEnabled: true,
602 headerShown: false,
603 // Android pushes settings as a regular full page with an in-screen
604 // back header; iOS keeps the detented form sheet.
605 ...(Platform.OS === "android"
606 ? { presentation: "card" as const }
607 : {
608 ...FORM_SHEET_PRESENTATION_OPTIONS,
609 sheetAllowedDetents: [0.7, 0.92],
610 sheetGrabberVisible: true,
611 }),
612 },
613 }),
614 SettingsLegal: createNativeStackScreen({
615 screen: SettingsLegalRouteScreen,
616 linking: "settings/legal",
617 options: {
618 ...LEGAL_DOCUMENT_HEADER_OPTIONS,
619 title: "Legal",
620 },
621 }),
622 ConnectOnboarding: createNativeStackScreen({
623 screen: ConnectOnboardingRouteScreen,
624 linking: "connect-onboarding",
625 options: {
626 // A root-level Android formSheet does not host the native stack bar;
627 // the route renders an embedded AndroidSheetHeader instead.
628 ...(Platform.OS === "android" ? { headerShown: false } : SHEET_SOLID_HEADER_OPTIONS),
629 title: "Set up T3 Connect",
630 gestureEnabled: true,
631 ...FORM_SHEET_PRESENTATION_OPTIONS,
632 sheetAllowedDetents: [0.6, 0.95],
633 sheetGrabberVisible: true,
634 },
635 }),
636 Connections: createNativeStackScreen({
637 screen: ConnectionsRouteScreen,
638 linking: "connections",
639 options: {
640 title: "Environments",
641 // Android: full page; the screen renders its own AndroidScreenHeader,
642 // so the native bar stays hidden. iOS keeps the sheet.
643 ...(Platform.OS === "android"
644 ? { presentation: "card" as const, headerShown: false }
645 : {
646 ...FORM_SHEET_PRESENTATION_OPTIONS,
647 sheetAllowedDetents: [0.55, 0.7],
648 sheetGrabberVisible: true,
649 }),
650 },
651 }),
652 ConnectionsNew: createNativeStackScreen({
653 screen: ConnectionsNewRouteScreen,
654 linking: "connections/new",
655 options: {
656 ...FORM_SHEET_PRESENTATION_OPTIONS,
657 sheetAllowedDetents: [0.55, 0.7],
658 sheetGrabberVisible: true,
659 },
660 }),
661 NewTaskSheet: createNativeStackScreen({
662 screen: NewTaskSheetStack,
663 linking: "new",
664 // The whole new-task flow (choose project → draft → add project) shares
665 // draft state via NewTaskFlowProvider. The expo-router era mounted it in
666 // app/new/_layout.tsx; this layout wrapper is the native-stack equivalent.
667 layout: ({ children }) => (
668 <NewTaskFlowProvider>
669 <View className="flex-1 bg-sheet-solid">{children}</View>
670 </NewTaskFlowProvider>
671 ),
672 options: {
673 gestureEnabled: true,
674 headerShown: false,
675 // Android pushes the flow as a regular full page — the draft should
676 // read like a thread that just doesn't exist yet; iOS keeps the sheet.
677 ...(Platform.OS === "android"
678 ? { presentation: "card" as const }
679 : {
680 ...FORM_SHEET_PRESENTATION_OPTIONS,
681 sheetAllowedDetents: [0.92],
682 sheetGrabberVisible: true,
683 }),
684 },
685 }),
686 NotFound: createNativeStackScreen({
687 screen: NotFoundScreen,
688 linking: "*",
689 }),
690 },
691});
692type RootStackType = typeof RootStack;
693
694const navigationPathConfig = {
695 screens: createPathConfigForStaticNavigation(RootStack) ?? {},
696};
697
698declare module "@react-navigation/native" {
699 interface RootNavigator extends RootStackType {}
700}