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