134
registerPresentedRoutes,
135
} from "./features/layout/workspace-overlay-routes";
136
import { ShowcaseReadyMarker } from "./features/showcase/ShowcaseCaptureCoordinator";
137
-import {
138
- SettingsLegalDocumentCloseHeaderButton,
139
- SettingsLegalDocumentExternalHeaderButton,
140
-} from "./features/settings/components/SettingsLegalDocumentRouteScreen";
141
-import { GLASS_HEADER_OPTIONS, type AppScreenOptions } from "./native/glass-header-options";
137
+import { immersiveRoute, modalRoute, pageRoute, sheetRoute } from "./features/layout/route-options";
138
import { deriveLayout } from "./lib/layout";
139
import { useNativeLayoutMetrics } from "./native/native-layout-metrics";
144
-import { HORIZONTAL_FORM_SHEET_OPTIONS, formSheetDetents } from "./native/sheet-surface";
140
+import { isPresentedRoute } from "./native/workspace-stack-projection";
141
import { workspaceDetailRouter } from "./features/workspace/workspace-detail-selection";
142
147
-// Hiding Android's native header after mount can leave detail panes measured short.
148
-// These screens render their own Material toolbar, so hide it from the first layout.
149
-const DETAIL_HEADER_OPTIONS: AppScreenOptions = {
150
- ...GLASS_HEADER_OPTIONS,
151
- headerShown: Platform.OS !== "android",
152
-};
153
-
154
-// Like Messages on the Duo: reading back through history (scrolling up) minimizes the
155
-// header, and reversing toward the latest message restores it. Other devices ignore it.
156
-const THREAD_HEADER_OPTIONS: AppScreenOptions = {
157
- ...DETAIL_HEADER_OPTIONS,
158
- unstable_headerMinimizationBehavior: "onScrollUp",
159
-};
160
-
161
-// The Duo minimizes headers on scroll down by default. Home and the pull request lists
162
-// stutter against it on hardware (not reproducible in the simulator), so they keep theirs.
163
-const FIXED_DUO_HEADER: AppScreenOptions = { unstable_headerMinimizationBehavior: "never" };
164
-
165
-const SOLID_HEADER_OPTIONS: AppScreenOptions = {
166
- headerBackButtonDisplayMode: "minimal",
167
- headerBackTitle: "",
168
- headerLargeTitle: false,
169
- headerShadowVisible: false,
170
- headerShown: true,
171
- headerTitleStyle: { fontSize: 18, fontWeight: "800" },
172
- headerTransparent: false,
173
- unstable_navigationItemStyle: Platform.OS === "ios" ? "editor" : undefined,
174
-};
175
-
176
-const SHEET_SOLID_HEADER_OPTIONS: AppScreenOptions = {
177
- ...SOLID_HEADER_OPTIONS,
178
- unstable_navigationItemStyle: undefined,
179
-};
180
-
181
-const SHEET_GLASS_HEADER_OPTIONS: AppScreenOptions = {
182
- ...GLASS_HEADER_OPTIONS,
183
- unstable_navigationItemStyle: undefined,
184
-};
185
-
186
-const LEGAL_DOCUMENT_HEADER_OPTIONS: AppScreenOptions = {
187
- ...SHEET_SOLID_HEADER_OPTIONS,
188
- headerBackVisible: false,
189
- headerLeft: SettingsLegalDocumentCloseHeaderButton,
190
- headerRight: () => <SettingsLegalDocumentExternalHeaderButton />,
191
- presentation: "fullScreenModal",
192
-};
143
+const settingsPage = (title: string) => pageRoute({ title, itemStyle: "standard" });
144
145
// Thread settings keep the Duo's vertical bar so cancel, search, filter and confirm sit in the
146
// rail. The picker stack spans the sheet so its header reaches the rail, and insets its content.
196
-const THREAD_SETTINGS_SHEET_OPTIONS = {
197
- presentation: "formSheet" as const,
198
- sheetAllowedDetents: [1],
199
- sheetGrabberVisible: true,
200
- nativeContentInsetHorizontally: false,
201
-};
147
+const THREAD_SETTINGS_ROUTE = sheetRoute({
148
+ detent: "full",
149
+ header: "none",
150
+ android: "card",
151
+ spansRail: true,
152
+});
153
203
-// Settings pages are root routes so they share the workspace's columns and header. The
204
-// `Settings` route marks the Settings tab as open (see settings-navigation.ts).
205
-const SETTINGS_PAGE_OPTIONS = SHEET_GLASS_HEADER_OPTIONS;
154
+// Search sheets push on Android like the branch picker; a formSheet there leaves the list's
155
+// header peeking above it once the keyboard opens.
156
+const SEARCH_SHEET_ROUTE = sheetRoute({ detent: 0.75, android: "card", itemStyle: "editor" });
157
158
const SETTINGS_SCREENS = {
159
Settings: createNativeStackScreen({
160
screen: SettingsRouteScreen,
161
linking: "settings",
162
options: {
212
- ...SETTINGS_PAGE_OPTIONS,
213
- title: "Settings",
163
+ ...pageRoute({ title: "Settings", itemStyle: "standard", root: true }),
164
...(Platform.OS === "android" ? { animation: "none" as const } : {}),
215
- // Android draws its own app bar here. Hidden only from inside the screen, the native one
216
- // showed for the first frame of the Settings tab and pushed the page down.
217
- headerShown: Platform.OS !== "android",
218
- headerBackVisible: false,
165
},
166
}),
167
SettingsEnvironments: createNativeStackScreen({
168
screen: SettingsEnvironmentsRouteScreen,
169
linking: "settings/environments",
224
- options: {
225
- ...SETTINGS_PAGE_OPTIONS,
226
- title: "Environments",
227
- },
170
+ options: settingsPage("Environments"),
171
}),
172
SettingsEnvironmentDetail: createNativeStackScreen({
173
screen: SettingsEnvironmentDetailRouteScreen,
174
linking: "settings/environments/:environmentId",
232
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Environment" },
175
+ options: settingsPage("Environment"),
176
}),
177
// Old links to New threads and Agent behavior open Threads, which absorbed them.
178
SettingsEnvironmentNewThreads: createNativeStackScreen({
179
screen: SettingsThreadsRouteScreen,
180
linking: "settings/new-threads",
238
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Threads" },
181
+ options: settingsPage("Threads"),
182
}),
183
SettingsEnvironmentSourceControl: createNativeStackScreen({
184
screen: SettingsEnvironmentSourceControlRouteScreen,
185
linking: "settings/source-control",
243
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Source control" },
186
+ options: settingsPage("Source control"),
187
}),
188
SettingsEnvironmentAgentBehavior: createNativeStackScreen({
189
screen: SettingsThreadsRouteScreen,
190
linking: "settings/agent-behavior",
248
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Threads" },
191
+ options: settingsPage("Threads"),
192
}),
193
SettingsWorktrees: createNativeStackScreen({
194
screen: SettingsWorktreesRouteScreen,
195
linking: "settings/worktrees",
253
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Worktrees" },
196
+ options: settingsPage("Worktrees"),
197
}),
198
SettingsLabs: createNativeStackScreen({
199
screen: SettingsLabsRouteScreen,
200
linking: "settings/labs",
258
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Labs" },
201
+ options: settingsPage("Labs"),
202
}),
203
SettingsProviderAccounts: createNativeStackScreen({
204
screen: SettingsProviderAccountsRouteScreen,
205
linking: "settings/provider-accounts",
263
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Providers" },
206
+ options: settingsPage("Providers"),
207
}),
208
SettingsEnvironmentMaintenance: createNativeStackScreen({
209
screen: SettingsEnvironmentMaintenanceRouteScreen,
210
linking: "settings/maintenance",
268
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Maintenance" },
211
+ options: settingsPage("Maintenance"),
212
}),
213
SettingsNotifications: createNativeStackScreen({
214
screen: SettingsNotificationsRouteScreen,
215
linking: "settings/notifications",
273
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Notifications" },
216
+ options: settingsPage("Notifications"),
217
}),
218
SettingsThreads: createNativeStackScreen({
219
screen: SettingsThreadsRouteScreen,
220
linking: "settings/thread-preferences",
278
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Threads" },
221
+ options: settingsPage("Threads"),
222
}),
223
SettingsAbout: createNativeStackScreen({
224
screen: SettingsAboutRouteScreen,
225
linking: "settings/about",
283
- options: { ...SETTINGS_PAGE_OPTIONS, title: "About" },
226
+ options: settingsPage("About"),
227
}),
228
SettingsEnvironmentNew: createNativeStackScreen({
229
screen: ConnectionsNewRouteScreen,
230
linking: "settings/environment-new",
288
- options: {
289
- ...SETTINGS_PAGE_OPTIONS,
290
- title: "Add Environment",
291
- },
231
+ options: settingsPage("Add Environment"),
232
}),
233
SettingsArchive: createNativeStackScreen({
234
screen: ArchivedThreadsRouteScreen,
235
linking: "settings/archive",
296
- options: {
297
- ...SETTINGS_PAGE_OPTIONS,
298
- title: "Archive",
299
- },
236
+ options: settingsPage("Archive"),
237
}),
238
SettingsNavigation: createNativeStackScreen({
239
screen: SettingsNavigationRouteScreen,
240
linking: "settings/navigation-tabs",
304
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Navigation tabs" },
241
+ options: settingsPage("Navigation tabs"),
242
}),
243
SettingsAppearance: createNativeStackScreen({
244
screen: SettingsAppearanceRouteScreen,
245
linking: "settings/appearance",
309
- options: {
310
- ...SETTINGS_PAGE_OPTIONS,
311
- title: "Appearance",
312
- },
246
+ options: settingsPage("Appearance"),
247
}),
248
SettingsProjectGrouping: createNativeStackScreen({
249
screen: SettingsProjectGroupingRouteScreen,
250
linking: "settings/project-grouping",
317
- options: {
318
- ...SETTINGS_PAGE_OPTIONS,
319
- title: "General",
320
- },
251
+ options: settingsPage("General"),
252
}),
253
SettingsOrganization: createNativeStackScreen({
254
screen: SettingsProjectGroupingRouteScreen,
255
linking: "settings/organization",
325
- options: {
326
- ...SETTINGS_PAGE_OPTIONS,
327
- title: "General",
328
- },
256
+ options: settingsPage("General"),
257
}),
258
SettingsProjectOverview: createNativeStackScreen({
259
screen: SettingsProjectOverviewRouteScreen,
260
linking: "settings/project",
333
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Projects" },
261
+ options: settingsPage("Projects"),
262
}),
263
SettingsKeyboard: createNativeStackScreen({
264
screen: SettingsKeyboardRouteScreen,
265
linking: "settings/keyboard",
338
- options: {
339
- ...SETTINGS_PAGE_OPTIONS,
340
- title: "Keyboard",
341
- },
266
+ options: settingsPage("Keyboard"),
267
}),
268
SettingsMicrophone: createNativeStackScreen({
269
screen: SettingsMicrophoneRouteScreen,
270
linking: "settings/microphone",
346
- options: {
347
- ...SETTINGS_PAGE_OPTIONS,
348
- title: "Microphone",
349
- },
271
+ options: settingsPage("Microphone"),
272
}),
273
SettingsFollowUp: createNativeStackScreen({
274
screen: SettingsFollowUpRouteScreen,
275
linking: "settings/follow-ups",
354
- options: {
355
- ...SETTINGS_PAGE_OPTIONS,
356
- title: "Chat",
357
- },
276
+ options: settingsPage("Chat"),
277
}),
278
SettingsScheduledTasks: createNativeStackScreen({
279
screen: SettingsScheduledTasksRouteScreen,
280
linking: "settings/scheduled-tasks",
281
options: {
363
- ...SETTINGS_PAGE_OPTIONS,
364
- title: "Scheduled tasks",
282
+ ...settingsPage("Scheduled tasks"),
283
headerTitleStyle: { fontSize: 16, fontWeight: "800" },
284
},
285
}),
286
SettingsScheduledTaskNew: createNativeStackScreen({
287
screen: SettingsScheduledTaskNewRouteScreen,
288
linking: "settings/scheduled-tasks/new",
371
- options: { ...SETTINGS_PAGE_OPTIONS, title: "New scheduled task" },
289
+ options: settingsPage("New scheduled task"),
290
}),
291
SettingsScheduledTaskEdit: createNativeStackScreen({
292
screen: SettingsScheduledTaskEditRouteScreen,
375
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Edit scheduled task" },
293
+ options: settingsPage("Edit scheduled task"),
294
}),
295
SettingsScheduledTaskBranch: createNativeStackScreen({
296
screen: ScheduledTaskBranchPickerRouteScreen,
379
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Base branch" },
297
+ options: settingsPage("Base branch"),
298
}),
299
SettingsScheduledTaskModel: createNativeStackScreen({
300
screen: ScheduledTaskModelPickerRouteScreen,
383
- options: {
384
- ...SETTINGS_PAGE_OPTIONS,
385
- headerShown: false,
386
- ...(Platform.OS === "android"
387
- ? { presentation: "card" as const }
388
- : {
389
- ...THREAD_SETTINGS_SHEET_OPTIONS,
390
- }),
391
- },
301
+ options: THREAD_SETTINGS_ROUTE,
302
}),
303
SettingsClientStorage: createNativeStackScreen({
304
screen: SettingsClientStorageRouteScreen,
305
linking: "settings/client-storage",
396
- options: {
397
- ...SETTINGS_PAGE_OPTIONS,
398
- title: "Client Storage",
399
- },
306
+ options: settingsPage("Client Storage"),
307
}),
308
SettingsDiagnostics: createNativeStackScreen({
309
screen: SettingsDiagnosticsRouteScreen,
310
linking: "settings/diagnostics",
404
- options: {
405
- ...SETTINGS_PAGE_OPTIONS,
406
- title: "Diagnostics",
407
- },
311
+ options: settingsPage("Diagnostics"),
312
}),
313
// These params snapshot the tap time, local filters, and freshly aggregated pools.
314
// A linking path would round-trip them as URL query strings and preserve stale values.
315
SettingsUsageAccount: createNativeStackScreen({
316
screen: UsageLimitAccountScreen,
413
- options: { ...SETTINGS_PAGE_OPTIONS, title: "Account" },
317
+ options: settingsPage("Account"),
318
}),
319
SettingsOpenSourceLicenses: createNativeStackScreen({
320
screen: SettingsOpenSourceLicensesRouteScreen,
321
linking: "settings/open-source-licenses",
418
- options: {
419
- ...SETTINGS_PAGE_OPTIONS,
420
- title: "Open source licenses",
421
- },
322
+ options: settingsPage("Open source licenses"),
323
}),
324
SettingsOpenSourceLicense: createNativeStackScreen({
325
screen: SettingsOpenSourceLicenseRouteScreen,
326
linking: "settings/open-source-licenses/:entryKey",
426
- options: {
427
- ...SETTINGS_PAGE_OPTIONS,
428
- title: "License notice",
429
- },
327
+ options: settingsPage("License notice"),
328
}),
329
SettingsUsage: createNativeStackScreen({
330
screen: UsageRouteScreen,
331
linking: "settings/usage",
434
- options: {
435
- ...SETTINGS_PAGE_OPTIONS,
436
- title: "Usage",
437
- },
332
+ options: settingsPage("Usage"),
333
}),
334
SettingsAuth: createNativeStackScreen({
335
screen: SettingsAuthRouteScreen,
483
focus: recordHomeFocus,
484
},
485
options: {
591
- ...GLASS_HEADER_OPTIONS,
592
- ...FIXED_DUO_HEADER,
486
+ ...pageRoute({ duoMinimize: "never", root: true }),
487
contentStyle: { backgroundColor: "transparent" },
594
- headerBackVisible: false,
488
...getCompactBrandHeaderOptions(),
596
- // Android draws Home's bars itself. Set here, not by the screen: Home also renders in the
597
- // sidebar column, and that copy clears the route's set options when it unmounts.
598
- headerShown: Platform.OS !== "android",
489
},
490
}),
491
PullRequest: createNativeStackScreen({
494
path: "pull-requests/:environmentId/:projectId/:repository/:number",
495
parse: { number: Number },
496
},
607
- options: { ...DETAIL_HEADER_OPTIONS, ...FIXED_DUO_HEADER },
497
+ options: pageRoute({ duoMinimize: "never" }),
498
}),
499
PullRequestGuideStop: createNativeStackScreen({
500
screen: PullRequestGuideStopScreen,
611
- options: DETAIL_HEADER_OPTIONS,
501
+ options: pageRoute(),
502
}),
503
PullRequestFile: createNativeStackScreen({
504
screen: PullRequestFileRouteScreen,
615
- options: DETAIL_HEADER_OPTIONS,
505
+ options: pageRoute(),
506
}),
507
PullRequestFiles: createNativeStackScreen({
508
screen: PullRequestFilesSheet,
619
- options: {
620
- ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
621
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
622
- sheetAllowedDetents: formSheetDetents(0.6),
623
- sheetGrabberVisible: true,
624
- sheetCornerRadius: Platform.OS === "android" ? 28 : undefined,
625
- },
509
+ options: sheetRoute({ detent: 0.6 }),
510
}),
511
PullRequestReviewers: createNativeStackScreen({
512
screen: PullRequestReviewersScreen,
629
- options: {
630
- ...DETAIL_HEADER_OPTIONS,
631
- ...FIXED_DUO_HEADER,
632
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
633
- sheetAllowedDetents: formSheetDetents(0.75),
634
- sheetGrabberVisible: true,
635
- headerBackVisible: false,
636
- },
513
+ options: sheetRoute({ detent: 0.75, itemStyle: "editor", duoMinimize: "never" }),
514
}),
515
PullRequestLabels: createNativeStackScreen({
516
screen: PullRequestLabelsScreen,
640
- // Presented like PullRequestFilterSearch, whose search sheet it shares.
641
- options:
642
- Platform.OS === "android"
643
- ? { presentation: "card", headerShown: false }
644
- : {
645
- ...DETAIL_HEADER_OPTIONS,
646
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
647
- sheetAllowedDetents: formSheetDetents(0.75),
648
- sheetGrabberVisible: true,
649
- headerBackVisible: false,
650
- },
517
+ options: SEARCH_SHEET_ROUTE,
518
}),
519
PullRequestFilterSearch: createNativeStackScreen({
520
screen: PullRequestFilterSearchScreen,
654
- // Android pushes it like the branch picker; a formSheet there leaves the list's header
655
- // peeking above it once the keyboard opens.
656
- options:
657
- Platform.OS === "android"
658
- ? { presentation: "card", headerShown: false }
659
- : {
660
- ...DETAIL_HEADER_OPTIONS,
661
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
662
- sheetAllowedDetents: formSheetDetents(0.75),
663
- sheetGrabberVisible: true,
664
- headerBackVisible: false,
665
- },
521
+ options: SEARCH_SHEET_ROUTE,
522
}),
523
PullRequestDiscussion: createNativeStackScreen({
524
screen: PullRequestDiscussionScreen,
669
- options: DETAIL_HEADER_OPTIONS,
525
+ options: pageRoute(),
526
}),
527
PullRequestInlineComment: createNativeStackScreen({
528
screen: PullRequestInlineCommentScreen,
673
- options: {
674
- ...(Platform.OS === "android"
675
- ? { presentation: "fullScreenModal" as const }
676
- : { ...SHEET_GLASS_HEADER_OPTIONS, ...HORIZONTAL_FORM_SHEET_OPTIONS }),
677
- sheetAllowedDetents: Platform.OS === "android" ? undefined : formSheetDetents(0.75),
678
- sheetGrabberVisible: Platform.OS !== "android",
679
- },
529
+ options: sheetRoute({ detent: 0.75, android: "fullScreen" }),
530
}),
531
PullRequestReview: createNativeStackScreen({
532
screen: PullRequestReviewSheet,
683
- options: {
684
- ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
685
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
686
- sheetAllowedDetents: formSheetDetents(0.75),
687
- sheetGrabberVisible: true,
688
- },
533
+ options: sheetRoute({ detent: 0.75, androidFit: true }),
534
}),
535
PullRequestEdit: createNativeStackScreen({
536
screen: PullRequestEditScreen,
692
- options: {
693
- ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
694
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
695
- sheetAllowedDetents: formSheetDetents(0.75),
696
- sheetGrabberVisible: true,
697
- },
537
+ options: sheetRoute({ detent: 0.75, androidFit: true }),
538
}),
539
Thread: createNativeStackScreen({
540
screen: ThreadRouteScreen,
541
linking: { path: "threads/:environmentId?/:threadId?", alias: ["new/draft"] },
702
- options: THREAD_HEADER_OPTIONS,
542
+ options: pageRoute({ duoMinimize: "onScrollUp" }),
543
}),
544
NewTaskProject: createNativeStackScreen({
545
screen: NewTaskRouteScreen,
546
linking: { path: "new", alias: ["new/project"] },
707
- options: { ...GLASS_HEADER_OPTIONS, title: "Choose project" },
547
+ options: pageRoute({ title: "Choose project" }),
548
}),
549
NewTaskEnvironment: createNativeStackScreen({
550
linking: "new/draft/environment",
551
screen: NewTaskEnvironmentPickerRouteScreen,
712
- options: { ...GLASS_HEADER_OPTIONS, title: "Environment" },
552
+ options: pageRoute({ title: "Environment" }),
553
}),
554
NewTaskBranch: createNativeStackScreen({
555
linking: "new/draft/branch",
556
screen: NewTaskBranchPickerRouteScreen,
717
- options: { ...GLASS_HEADER_OPTIONS, title: "Branch" },
557
+ options: pageRoute({ title: "Branch" }),
558
}),
559
AddProject: createNativeStackScreen({
560
linking: "new/add-project",
561
screen: AddProjectSourceRoute,
562
723
- options: {
724
- ...GLASS_HEADER_OPTIONS,
725
- title: "Add project",
726
- },
563
+ options: pageRoute({ title: "Add project" }),
564
}),
565
AddProjectRepository: createNativeStackScreen({
566
linking: "new/add-project/repository",
567
screen: AddProjectRepositoryRoute,
731
- options: GLASS_HEADER_OPTIONS,
568
+ options: pageRoute(),
569
}),
570
AddProjectDestination: createNativeStackScreen({
571
linking: "new/add-project/destination",
572
screen: AddProjectDestinationRoute,
736
- options: GLASS_HEADER_OPTIONS,
573
+ options: pageRoute(),
574
}),
575
AddProjectLocal: createNativeStackScreen({
576
linking: "new/add-project/local",
577
screen: AddProjectLocalRoute,
741
- options: GLASS_HEADER_OPTIONS,
578
+ options: pageRoute(),
579
}),
580
AddProjectNew: createNativeStackScreen({
581
linking: "new/add-project/new",
582
screen: AddProjectNewRoute,
746
- options: GLASS_HEADER_OPTIONS,
583
+ options: pageRoute(),
584
}),
585
NewTaskFiles: createNativeStackScreen({
586
linking: "new/draft/files",
587
screen: ThreadFilesTreeScreen,
751
- options: SOLID_HEADER_OPTIONS,
588
+ options: pageRoute({ header: "solid" }),
589
}),
590
NewTaskFile: createNativeStackScreen({
591
linking: "new/draft/files/:path*",
592
screen: ThreadFileScreen,
756
- options: SOLID_HEADER_OPTIONS,
593
+ options: pageRoute({ header: "solid" }),
594
}),
595
NewTaskAttachment: createNativeStackScreen({
596
screen: AttachmentFileScreen,
597
linking: "new/draft/attachments/:attachmentId",
761
- options: SOLID_HEADER_OPTIONS,
598
+ options: pageRoute({ header: "solid" }),
599
}),
600
NewTaskThreadSettings: createNativeStackScreen({
601
screen: NewTaskThreadSettingsRouteScreen,
602
linking: "new/draft/settings",
766
- options: {
767
- gestureEnabled: true,
768
- headerShown: false,
769
- ...(Platform.OS === "android"
770
- ? { presentation: "card" as const }
771
- : THREAD_SETTINGS_SHEET_OPTIONS),
772
- },
603
+ options: THREAD_SETTINGS_ROUTE,
604
}),
605
ThreadTerminal: createNativeStackScreen({
606
screen: ThreadTerminalRouteScreen,
607
linking: `${THREAD_LINKING_PREFIX}/terminal`,
777
- options: SOLID_HEADER_OPTIONS,
608
+ options: pageRoute({ header: "solid" }),
609
}),
610
ThreadInspectorFullscreen: createNativeStackScreen({
611
screen: FullscreenThreadRouteScreen,
781
- options: {
782
- ...THREAD_HEADER_OPTIONS,
783
- presentation: "fullScreenModal",
784
- },
612
+ options: modalRoute({ header: "glass", itemStyle: "editor", duoMinimize: "onScrollUp" }),
613
}),
614
ThreadDevicePreview: createNativeStackScreen({
615
screen: DevicePreviewRouteScreen,
616
linking: `${THREAD_LINKING_PREFIX}/devices`,
789
- options: {
790
- presentation: "fullScreenModal",
791
- headerShown: false,
792
- gestureEnabled: false,
793
- autoHideHomeIndicator: true,
794
- navigationBarHidden: true,
795
- },
617
+ options: immersiveRoute({ hideSystemBars: true }),
618
}),
619
ThreadBrowserPreview: createNativeStackScreen({
620
screen: BrowserPreviewRouteScreen,
621
linking: `${THREAD_LINKING_PREFIX}/browser`,
800
- options: {
801
- presentation: "fullScreenModal",
802
- headerShown: false,
803
- gestureEnabled: false,
804
- },
622
+ options: immersiveRoute(),
623
}),
624
ThreadReview: createNativeStackScreen({
625
screen: ReviewSheet,
626
linking: `${THREAD_LINKING_PREFIX}/review`,
809
- options: GLASS_HEADER_OPTIONS,
627
+ options: pageRoute(),
628
}),
629
ThreadReviewComment: createNativeStackScreen({
630
screen: ReviewCommentComposerSheet,
631
linking: `${THREAD_LINKING_PREFIX}/review-comment`,
814
- options: {
815
- // Android formSheets cannot host the keyboard-driven comment composer.
816
- ...(Platform.OS === "android"
817
- ? { presentation: "fullScreenModal" as const }
818
- : HORIZONTAL_FORM_SHEET_OPTIONS),
819
- sheetAllowedDetents: Platform.OS === "android" ? undefined : formSheetDetents(0.55),
820
- sheetGrabberVisible: Platform.OS !== "android",
821
- },
632
+ options: sheetRoute({ detent: 0.55, header: "none", android: "fullScreen" }),
633
}),
634
ThreadFiles: createNativeStackScreen({
635
screen: ThreadFilesTreeScreen,
636
linking: `${THREAD_LINKING_PREFIX}/files`,
826
- options: {
827
- ...GLASS_HEADER_OPTIONS,
828
- title: "Files",
829
- },
637
+ options: pageRoute({ title: "Files" }),
638
}),
639
ThreadFile: createNativeStackScreen({
640
screen: ThreadFileScreen,
641
linking: `${THREAD_LINKING_PREFIX}/files/:path*`,
834
- options: GLASS_HEADER_OPTIONS,
642
+ options: pageRoute(),
643
}),
644
ThreadMcpApp: createNativeStackScreen({
645
screen: McpAppFullscreenScreen,
646
linking: `${THREAD_LINKING_PREFIX}/apps/:itemId`,
839
- options: {
840
- presentation: "fullScreenModal",
841
- headerShown: false,
842
- gestureEnabled: false,
843
- },
647
+ options: immersiveRoute(),
648
}),
649
ThreadAttachment: createNativeStackScreen({
650
screen: AttachmentFileScreen,
651
linking: `${THREAD_LINKING_PREFIX}/attachments/:attachmentId`,
848
- options: SOLID_HEADER_OPTIONS,
652
+ options: pageRoute({ header: "solid" }),
653
}),
654
ThreadSettingsSheet: createNativeStackScreen({
655
screen: ExistingThreadSettingsRouteScreen,
852
- options: {
853
- gestureEnabled: true,
854
- headerShown: false,
855
- ...(Platform.OS === "android"
856
- ? { presentation: "card" as const }
857
- : {
858
- ...THREAD_SETTINGS_SHEET_OPTIONS,
859
- }),
860
- },
656
+ options: THREAD_SETTINGS_ROUTE,
657
}),
658
ThreadQueue: createNativeStackScreen({
659
screen: ThreadQueueSheet,
864
- options: {
865
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
866
- headerShown: false,
867
- sheetAllowedDetents: formSheetDetents(0.65, 0.95),
868
- sheetGrabberVisible: true,
869
- },
660
+ options: sheetRoute({ detent: 0.65, androidMaxDetent: 0.95, header: "none" }),
661
}),
662
ThreadBackgroundWork: createNativeStackScreen({
663
screen: ThreadBackgroundWorkSheet,
873
- options: {
874
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
875
- headerShown: false,
876
- sheetAllowedDetents: formSheetDetents(0.5, 0.9),
877
- sheetGrabberVisible: true,
878
- },
664
+ options: sheetRoute({ detent: 0.5, androidMaxDetent: 0.9, header: "none" }),
665
}),
666
ThreadAgents: createNativeStackScreen({
667
screen: ThreadAgentsSheet,
882
- options: {
883
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
884
- headerShown: false,
885
- sheetAllowedDetents: formSheetDetents(0.5, 0.9),
886
- sheetGrabberVisible: true,
887
- },
668
+ options: sheetRoute({ detent: 0.5, androidMaxDetent: 0.9, header: "none" }),
669
}),
670
GitOverview: createNativeStackScreen({
671
screen: GitOverviewSheet,
672
linking: `${THREAD_LINKING_PREFIX}/git`,
892
- options: {
893
- ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
894
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
895
- sheetAllowedDetents: formSheetDetents(0.55),
896
- sheetGrabberVisible: true,
897
- },
673
+ options: sheetRoute({ detent: 0.55 }),
674
}),
675
ThreadPullRequests: createNativeStackScreen({
676
screen: ThreadPullRequestsSheet,
677
linking: `${THREAD_LINKING_PREFIX}/pull-requests`,
902
- options: {
903
- ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
904
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
905
- sheetAllowedDetents: formSheetDetents(0.55),
906
- sheetGrabberVisible: true,
907
- },
678
+ options: sheetRoute({ detent: 0.55 }),
679
}),
680
GitCommit: createNativeStackScreen({
681
screen: GitCommitSheet,
682
linking: `${THREAD_LINKING_PREFIX}/git/commit`,
912
- options: {
913
- ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
914
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
915
- sheetAllowedDetents: formSheetDetents(0.8),
916
- sheetGrabberVisible: true,
917
- },
683
+ options: sheetRoute({ detent: 0.8, androidFit: true }),
684
}),
685
GitBranches: createNativeStackScreen({
686
screen: GitBranchesSheet,
687
linking: `${THREAD_LINKING_PREFIX}/git/branches`,
922
- options: {
923
- ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
924
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
925
- sheetAllowedDetents: formSheetDetents(0.55),
926
- sheetGrabberVisible: true,
927
- },
688
+ options: sheetRoute({ detent: 0.55, androidFit: true }),
689
}),
690
GitConfirm: createNativeStackScreen({
691
screen: GitConfirmSheet,
692
linking: `${THREAD_LINKING_PREFIX}/git-confirm`,
932
- options: {
933
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
934
- sheetAllowedDetents: [0.55, 0.7],
935
- sheetGrabberVisible: true,
936
- },
693
+ options: sheetRoute({ detent: 0.55, maxDetent: 0.7, header: "none", androidFit: true }),
694
}),
695
...SETTINGS_SCREENS,
696
SettingsLegal: createNativeStackScreen({
697
screen: SettingsLegalRouteScreen,
698
linking: "settings/legal",
942
- options: {
943
- ...LEGAL_DOCUMENT_HEADER_OPTIONS,
944
- title: "Legal",
945
- },
699
+ options: modalRoute({ header: "solid", title: "Legal" }),
700
}),
701
ConnectOnboarding: createNativeStackScreen({
702
screen: ConnectOnboardingRouteScreen,
703
linking: "connect-onboarding",
950
- options: {
951
- // Android root formSheets lack a native stack bar; the route provides its own sheet AppBar.
952
- ...(Platform.OS === "android" ? { headerShown: false } : SHEET_SOLID_HEADER_OPTIONS),
704
+ options: sheetRoute({
705
title: "Set up T3 Connect",
954
- gestureEnabled: true,
955
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
956
- sheetAllowedDetents: formSheetDetents(0.6, 0.95),
957
- sheetGrabberVisible: true,
958
- },
706
+ header: "solid",
707
+ detent: 0.6,
708
+ androidMaxDetent: 0.95,
709
+ }),
710
}),
711
Connections: createNativeStackScreen({
712
screen: ConnectionsRouteScreen,
713
linking: "connections",
963
- options: {
964
- title: "Environments",
965
- ...(Platform.OS === "android"
966
- ? { presentation: "card" as const, headerShown: false }
967
- : {
968
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
969
- sheetAllowedDetents: [0.55, 0.7],
970
- sheetGrabberVisible: true,
971
- }),
972
- },
714
+ options: sheetRoute({ title: "Environments", detent: 0.55, maxDetent: 0.7, android: "card" }),
715
}),
716
ConnectionsNew: createNativeStackScreen({
717
screen: ConnectionsNewRouteScreen,
718
linking: "connections/new",
977
- options: {
978
- // Mount the iOS header immediately to avoid remounting the pairing form.
979
- ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
980
- title: "Add Environment",
981
- ...HORIZONTAL_FORM_SHEET_OPTIONS,
982
- sheetAllowedDetents: [0.55, 0.7],
983
- sheetGrabberVisible: true,
984
- sheetCornerRadius: Platform.OS === "android" ? 28 : undefined,
985
- },
719
+ options: sheetRoute({ title: "Add Environment", detent: 0.55, maxDetent: 0.7 }),
720
}),
721
NotFound: createNativeStackScreen({
722
screen: NotFoundScreen,
759
registerPresentedRoutes(
760
Object.entries(RootStackConfig.config.screens ?? {}).flatMap(([name, screen]) => {
761
const options = (screen as { readonly options?: unknown }).options;
1028
- const presentation =
1029
- options && typeof options === "object"
1030
- ? (options as { readonly presentation?: string }).presentation
1031
- : undefined;
1032
- return presentation !== undefined && presentation !== "card" ? [name] : [];
762
+ return options && typeof options === "object" && isPresentedRoute(options) ? [name] : [];
763
}),
764
);
765