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

Stack.tsx

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