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