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

Stack.tsx

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