@devries-cameron20 / t3code Mirror · read-only / commits / da38f86397
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 03:15 UTC

refactor(mobile): routes declare page, sheet or modal and presets own the platform options

Stack.tsx built every route from hand-merged constants with 29 Platform.OS checks, and sheets patched their own corner radius, Android fit-to-content and swipe guard from inside the screen. Detents had drifted between routes. - pageRoute, sheetRoute, modalRoute and immersiveRoute own header appearance, detents, the Android card/full-screen fallback, corner radius and fit-to-content. - The Android navigator hides the native header for every route from the first frame; screens always draw their bar in-tree. - One isPresentedRoute replaces six copies of the presentation check. - SheetHeader takes typed actions and owns the swipe guard for dismissDisabled. - The legal document and Environments sheets use SheetHeader/AppBar instead of raw header options; Environments' add button was invisible on iOS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 4, 2026 at 19:23 UTC da38f863972b92c6089beb5601d2312d2df6f13f
21 files changed +416 -552
apps/mobile/src/Stack.tsx
+99 -369
@@ -134,307 +134,202 @@ import {
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,
@@ -588,14 +483,9 @@ const RootStackConfig = createWorkspaceStackNavigator({
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({
@@ -604,385 +494,229 @@ const RootStackConfig = createWorkspaceStackNavigator({
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,
@@ -1025,11 +759,7 @@ function ScreenRenderFallback(props: RenderFailureProps & { readonly routeName:
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
apps/mobile/src/components/ui/SheetHeader.android.tsx
+23 -15
@@ -1,6 +1,7 @@
1 import { View } from "react-native";
2
3 import { AppBar } from "./AppBar";
4 +import { NativeStackScreenOptions } from "../../native/StackHeader";
5 import { Button } from "./Button";
6 import { IconButton } from "./IconButton";
7 import type { SheetCloseButtonProps, SheetHeaderProps } from "./SheetHeader.types";
@@ -36,20 +37,27 @@ export function SheetHeader(props: SheetHeaderProps) {
37 ) : undefined;
38
39 return (
39 - <AppBar
40 - embedded
41 - sheet={props.presentation === "inline"}
42 - title={props.title}
43 - subtitle={props.subtitle}
44 - leading={
45 - <SheetCloseButton
46 - {...(props.onCancel ? { onCancel: props.onCancel } : { onClose: props.onClose })}
47 - accessibilityLabel={props.accessibilityLabel}
48 - disabled={props.dismissDisabled}
49 - />
50 - }
51 - trailing={trailing}
52 - hideBottomBorder
53 - />
40 + <>
41 + {props.dismissDisabled === undefined ? null : (
42 + // A sheet that can't be closed with its button can't be swiped away either.
43 + <NativeStackScreenOptions options={{ gestureEnabled: !props.dismissDisabled }} />
44 + )}
45 + <AppBar
46 + embedded
47 + sheet={props.presentation === "inline"}
48 + title={props.title}
49 + subtitle={props.subtitle}
50 + actions={props.actions}
51 + leading={
52 + <SheetCloseButton
53 + {...(props.onCancel ? { onCancel: props.onCancel } : { onClose: props.onClose })}
54 + accessibilityLabel={props.accessibilityLabel}
55 + disabled={props.dismissDisabled}
56 + />
57 + }
58 + trailing={trailing}
59 + hideBottomBorder
60 + />
61 + </>
62 );
63 }
apps/mobile/src/components/ui/SheetHeader.tsx
+37 -6
@@ -21,10 +21,22 @@ export function SheetCloseButton(props: SheetCloseButtonProps) {
21 }
22
23 export function SheetHeader(props: SheetHeaderProps) {
24 - return props.presentation !== "inline" ? (
25 - <NativeSheetHeader {...props} />
26 - ) : (
27 - <InlineSheetHeader {...props} />
24 + return (
25 + <>
26 + <SheetDismissGuard dismissDisabled={props.dismissDisabled} />
27 + {props.presentation !== "inline" ? (
28 + <NativeSheetHeader {...props} />
29 + ) : (
30 + <InlineSheetHeader {...props} />
31 + )}
32 + </>
33 + );
34 +}
35 +
36 +/** A sheet that can't be closed with its button can't be swiped away either. */
37 +function SheetDismissGuard(props: { readonly dismissDisabled: boolean | undefined }) {
38 + return props.dismissDisabled === undefined ? null : (
39 + <NativeStackScreenOptions options={{ gestureEnabled: !props.dismissDisabled }} />
40 );
41 }
42
@@ -53,8 +65,18 @@ function NativeSheetHeader(props: SheetHeaderProps) {
65 disabled={props.dismissDisabled}
66 />
67 </Toolbar>
56 - {confirmation || props.trailing ? (
68 + {confirmation || props.trailing || props.actions?.length ? (
69 <Toolbar placement="right">
70 + {props.actions?.map((action) => (
71 + <Toolbar.Button
72 + key={action.accessibilityLabel}
73 + icon={typeof action.icon === "string" ? action.icon : action.icon.ios}
74 + accessibilityLabel={action.accessibilityLabel}
75 + disabled={action.disabled || action.loading}
76 + tintColor={action.tintColor}
77 + onPress={action.onPress}
78 + />
79 + ))}
80 {props.trailing ? (
81 <Toolbar.Custom>
82 <View>{props.trailing}</View>
@@ -135,8 +157,17 @@ function InlineSheetHeader(props: SheetHeaderProps) {
157 );
158 const confirm = props.confirm ? <InlineConfirmation confirmation={props.confirm} /> : null;
159 const trailing =
138 - props.trailing || confirm ? (
160 + props.trailing || confirm || props.actions?.length ? (
161 <View className="flex-row items-center gap-2">
162 + {props.actions?.map((action) => (
163 + <IconButton
164 + key={action.accessibilityLabel}
165 + icon={action.icon}
166 + accessibilityLabel={action.accessibilityLabel}
167 + disabled={action.disabled || action.loading}
168 + onPress={action.onPress}
169 + />
170 + ))}
171 {props.trailing}
172 {confirm}
173 </View>
apps/mobile/src/components/ui/SheetHeader.types.ts
+3
@@ -1,5 +1,7 @@
1 import type { ReactNode } from "react";
2
3 +import type { AppBarAction } from "./AppBar.types";
4 +
5 type SheetDismissAction =
6 | { readonly onCancel: () => void; readonly onClose?: never }
7 | { readonly onClose: () => void; readonly onCancel?: never };
@@ -18,6 +20,7 @@ export type SheetHeaderProps = SheetDismissAction & {
20 readonly dismissDisabled?: boolean;
21 readonly confirm?: SheetConfirmation;
22 readonly presentation?: "native" | "inline";
23 + readonly actions?: ReadonlyArray<AppBarAction>;
24 readonly trailing?: ReactNode;
25 };
26
apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx
+13 -24
@@ -1,10 +1,9 @@
1 -import { Toolbar } from "../../components/ui/Toolbar";
1 import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
2
3 import { useNavigation } from "@react-navigation/native";
4 import type { EnvironmentId } from "@t3tools/contracts";
5 import { useState } from "react";
7 -import { Platform, View } from "react-native";
6 +import { View } from "react-native";
7 import { useSafeAreaInsets } from "react-native-safe-area-context";
8
9 import { AppBar } from "../../components/ui/AppBar";
@@ -30,28 +29,18 @@ export function ConnectionsRouteScreen() {
29
30 return (
31 <View collapsable={false} className="flex-1 bg-sheet">
33 - {Platform.OS === "android" ? (
34 - <AppBar
35 - embedded
36 - title="Environments"
37 - onBack={() => navigation.goBack()}
38 - actions={[
39 - {
40 - accessibilityLabel: "Add environment",
41 - icon: "plus",
42 - onPress: () => navigation.navigate("ConnectionsNew"),
43 - },
44 - ]}
45 - />
46 - ) : (
47 - <Toolbar placement="right">
48 - <Toolbar.Button
49 - icon="plus"
50 - onPress={() => navigation.navigate("ConnectionsNew")}
51 - separateBackground
52 - />
53 - </Toolbar>
54 - )}
32 + <AppBar
33 + title="Environments"
34 + onClose={() => navigation.goBack()}
35 + closeAccessibilityLabel="Close environments"
36 + actions={[
37 + {
38 + accessibilityLabel: "Add environment",
39 + icon: "plus",
40 + onPress: () => navigation.navigate("ConnectionsNew"),
41 + },
42 + ]}
43 + />
44 <ScrollView
45 contentInsetAdjustmentBehavior="automatic"
46 showsVerticalScrollIndicator={false}
apps/mobile/src/features/layout/createWorkspaceStackNavigator.android.tsx
+18 -11
@@ -21,7 +21,10 @@ import { use, type ComponentProps } from "react";
21
22 import { RoutedFormSheetContext } from "../../components/ui/RoutedFormSheetContext";
23
24 -import { projectStackPresentation } from "../../native/workspace-stack-projection";
24 +import {
25 + isPresentedRoute,
26 + projectStackPresentation,
27 +} from "../../native/workspace-stack-projection";
28 import {
29 WorkspaceColumnsRendererContext,
30 WorkspacePresentationHostContext,
@@ -37,8 +40,7 @@ function WorkspaceStackView(props: ViewProps) {
40
41 const isOverlay = (route: Route) => {
42 const descriptor = props.descriptors[route.key] ?? props.describe(route, true);
40 - const presentation = descriptor.options.presentation;
41 - return presentation !== undefined && presentation !== "card";
43 + return isPresentedRoute(descriptor.options);
44 };
45 const projection = projectStackPresentation(props.state, isOverlay);
46 const workspaceRoutes = projection.workspace;
@@ -121,14 +123,19 @@ function WorkspaceStackNavigator({
123 descriptors={Object.fromEntries(
124 Object.entries(descriptors).map(([key, descriptor]) => [
125 key,
124 - descriptor.options.presentation === "formSheet"
125 - ? {
126 - ...descriptor,
127 - render: () => (
128 - <RoutedFormSheetContext value>{descriptor.render()}</RoutedFormSheetContext>
129 - ),
130 - }
131 - : descriptor,
126 + {
127 + ...descriptor,
128 + // Screens draw their bar in-tree; hiding the native one only after mount
129 + // shows it for the first frame and leaves the page measured short.
130 + options: { ...descriptor.options, headerShown: false },
131 + ...(descriptor.options.presentation === "formSheet"
132 + ? {
133 + render: () => (
134 + <RoutedFormSheetContext value>{descriptor.render()}</RoutedFormSheetContext>
135 + ),
136 + }
137 + : undefined),
138 + },
139 ]),
140 )}
141 navigation={navigation}
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx
+4 -6
@@ -71,6 +71,7 @@ import {
71 partitionStackPresentations,
72 reconcileStackScreens,
73 type CollapsedSplitColumn,
74 + isPresentedRoute,
75 } from "../../native/workspace-stack-projection";
76 import {
77 NativePrimaryColumnContext,
@@ -505,8 +506,7 @@ function WorkspaceStackView(props: ViewProps & { readonly nativeColumns: boolean
506 const [primaryVisible, setPrimaryVisible] = useState(false);
507 const metrics = useNativeLayoutMetrics();
508 const projection = projectWorkspaceStack(props.state, (route) => {
508 - const presentation = props.descriptors[route.key]?.options.presentation;
509 - return presentation !== undefined && presentation !== "card";
509 + return isPresentedRoute(props.descriptors[route.key]?.options);
510 });
511 // The root's willDisappear reaches JS frames into the push, so hide the dock in the commit that
512 // pushes; the native events still own every later change, including back gestures.
@@ -566,8 +566,7 @@ function WorkspaceStackView(props: ViewProps & { readonly nativeColumns: boolean
566 ),
567 };
568 const overlays = partitionStackPresentations(projection.overlays, (route) => {
569 - const presentation = props.descriptors[route.key]?.options.presentation;
570 - return presentation !== undefined && presentation !== "card";
569 + return isPresentedRoute(props.descriptors[route.key]?.options);
570 });
571 const routes = [baseRoute, ...overlays.map((group) => group[0]!)];
572 return (
@@ -646,8 +645,7 @@ function WorkspaceStackNavigator({
645 if (!nativeWorkspaceColumnsReady) return null;
646 const settingsOpen = settingsOpenIn(
647 state.routes.slice(0, state.index + 1).filter((route) => {
649 - const presentation = descriptors[route.key]?.options.presentation;
650 - return presentation === undefined || presentation === "card";
648 + return !isPresentedRoute(descriptors[route.key]?.options);
649 }),
650 );
651 return (
apps/mobile/src/features/layout/route-options.ts new
+158
@@ -0,0 +1,158 @@
1 +import { Platform } from "react-native";
2 +
3 +import { GLASS_HEADER_OPTIONS, type AppScreenOptions } from "../../native/glass-header-options";
4 +import { formSheetDetents } from "../../native/sheet-surface";
5 +
6 +/**
7 + * Route presets for the root stack. A route says what it is (a page, a sheet, a modal); the
8 + * preset owns how each platform presents it, so screens never set presentation options.
9 + *
10 + * Android never shows the native stack header: every screen draws its bar in-tree with AppBar or
11 + * SheetHeader, and the Android navigators hide the native one from the first frame.
12 + */
13 +
14 +type HeaderStyle = "glass" | "solid" | "none";
15 +
16 +const SOLID_HEADER_OPTIONS: AppScreenOptions = {
17 + headerBackButtonDisplayMode: "minimal",
18 + headerBackTitle: "",
19 + headerLargeTitle: false,
20 + headerShadowVisible: false,
21 + headerShown: true,
22 + headerTitleStyle: { fontSize: 18, fontWeight: "800" },
23 + headerTransparent: false,
24 +};
25 +
26 +function headerOptions(header: HeaderStyle, itemStyle: "editor" | "standard"): AppScreenOptions {
27 + if (header === "none") return { headerShown: false };
28 + if (header === "glass") {
29 + // The editor style needs liquid glass, which GLASS_HEADER_OPTIONS already gates it on.
30 + return itemStyle === "editor"
31 + ? GLASS_HEADER_OPTIONS
32 + : { ...GLASS_HEADER_OPTIONS, unstable_navigationItemStyle: undefined };
33 + }
34 + return {
35 + ...SOLID_HEADER_OPTIONS,
36 + unstable_navigationItemStyle:
37 + itemStyle === "editor" && Platform.OS === "ios" ? "editor" : undefined,
38 + };
39 +}
40 +
41 +export interface PageRouteOptions {
42 + readonly title?: string;
43 + /** Glass bars let content scroll under them. Defaults to glass. */
44 + readonly header?: HeaderStyle;
45 + /** iOS 26 groups a page's bar items like an editor; settings pages use the standard look. */
46 + readonly itemStyle?: "editor" | "standard";
47 + /**
48 + * How the Duo minimizes the bar while scrolling. "never" for lists that stutter against the
49 + * default on hardware; "onScrollUp" for conversations read backwards, like Messages.
50 + */
51 + readonly duoMinimize?: "never" | "onScrollUp";
52 + /** The page is the root of its column, so it never shows Back. */
53 + readonly root?: boolean;
54 +}
55 +
56 +/** A page in the workspace: pushed on compact windows, a column page on wide ones. */
57 +export function pageRoute(options: PageRouteOptions = {}): AppScreenOptions {
58 + return {
59 + ...headerOptions(options.header ?? "glass", options.itemStyle ?? "editor"),
60 + ...(options.title === undefined ? undefined : { title: options.title }),
61 + ...(options.duoMinimize
62 + ? { unstable_headerMinimizationBehavior: options.duoMinimize }
63 + : undefined),
64 + ...(options.root ? { headerBackVisible: false } : undefined),
65 + };
66 +}
67 +
68 +export interface SheetRouteOptions {
69 + readonly title?: string;
70 + /** Defaults to glass. "none" when the sheet draws no bar at all. */
71 + readonly header?: HeaderStyle;
72 + /** The initial detent, or "full" for a sheet that always covers the window. */
73 + readonly detent: number | "full";
74 + /** The largest detent. Defaults to the full window on iOS, where the Duo needs it. */
75 + readonly maxDetent?: number;
76 + /** Android's expanded detent when `maxDetent` is unset. */
77 + readonly androidMaxDetent?: number;
78 + /** Android sizes the sheet to its content instead of using detents. */
79 + readonly androidFit?: boolean;
80 + /**
81 + * Where an Android formSheet can't host the screen: "card" pushes it, "fullScreen" presents it
82 + * full screen (Android formSheets can't host a keyboard-driven composer).
83 + */
84 + readonly android?: "sheet" | "card" | "fullScreen";
85 + /** The sheet spans the Duo's rail, and its content insets itself. */
86 + readonly spansRail?: boolean;
87 + readonly itemStyle?: "editor" | "standard";
88 + readonly duoMinimize?: "never" | "onScrollUp";
89 +}
90 +
91 +function sheetDetents(options: SheetRouteOptions): number[] {
92 + if (options.detent === "full") return [1];
93 + if (options.maxDetent !== undefined) return [options.detent, options.maxDetent];
94 + return formSheetDetents(options.detent, options.androidMaxDetent);
95 +}
96 +
97 +/** A sheet over the workspace: a formSheet with a grabber that closes, never goes back. */
98 +export function sheetRoute(options: SheetRouteOptions): AppScreenOptions {
99 + const header = headerOptions(options.header ?? "glass", options.itemStyle ?? "standard");
100 + const shared = {
101 + ...header,
102 + ...(options.title === undefined ? undefined : { title: options.title }),
103 + ...(options.duoMinimize
104 + ? { unstable_headerMinimizationBehavior: options.duoMinimize }
105 + : undefined),
106 + headerBackVisible: false,
107 + gestureEnabled: true,
108 + } satisfies AppScreenOptions;
109 + if (Platform.OS === "android" && options.android === "card") {
110 + return { ...shared, presentation: "card" };
111 + }
112 + if (Platform.OS === "android" && options.android === "fullScreen") {
113 + return { ...shared, presentation: "fullScreenModal" };
114 + }
115 + return {
116 + ...shared,
117 + presentation: "formSheet",
118 + sheetPrefersHorizontalBars: true,
119 + sheetGrabberVisible: true,
120 + sheetAllowedDetents:
121 + Platform.OS === "android" && options.androidFit ? "fitToContents" : sheetDetents(options),
122 + ...(Platform.OS === "android" ? { sheetCornerRadius: 28 } : undefined),
123 + ...(options.spansRail ? { nativeContentInsetHorizontally: false } : undefined),
124 + } as AppScreenOptions;
125 +}
126 +
127 +export interface ModalRouteOptions {
128 + readonly title?: string;
129 + /** Defaults to "none": the screen draws its own SheetHeader or has no bar. */
130 + readonly header?: HeaderStyle;
131 + readonly itemStyle?: "editor" | "standard";
132 + readonly duoMinimize?: "never" | "onScrollUp";
133 +}
134 +
135 +/** A full-screen modal over the workspace with a close button, not a back button. */
136 +export function modalRoute(options: ModalRouteOptions = {}): AppScreenOptions {
137 + return {
138 + ...headerOptions(options.header ?? "none", options.itemStyle ?? "standard"),
139 + ...(options.title === undefined ? undefined : { title: options.title }),
140 + ...(options.duoMinimize
141 + ? { unstable_headerMinimizationBehavior: options.duoMinimize }
142 + : undefined),
143 + headerBackVisible: false,
144 + presentation: "fullScreenModal",
145 + };
146 +}
147 +
148 +/** Full-screen media (a device stream, a browser, an app) with no bar and no dismiss gesture. */
149 +export function immersiveRoute(options: { readonly hideSystemBars?: boolean } = {}) {
150 + return {
151 + presentation: "fullScreenModal",
152 + headerShown: false,
153 + gestureEnabled: false,
154 + ...(options.hideSystemBars
155 + ? { autoHideHomeIndicator: true, navigationBarHidden: true }
156 + : undefined),
157 + } satisfies AppScreenOptions;
158 +}
apps/mobile/src/features/pull-requests/PullRequestSheetContent.tsx
-7
@@ -5,7 +5,6 @@ import { Platform, ScrollView, useWindowDimensions, View } from "react-native";
5 import { KeyboardAvoidingView } from "react-native-keyboard-controller";
6 import { useSafeAreaInsets } from "react-native-safe-area-context";
7 import { ScreenContent } from "../../components/ui/ScreenContent";
8 -import { NativeStackScreenOptions } from "../../native/StackHeader";
8
9 export function PullRequestSheetContent(props: {
10 readonly title: string;
@@ -34,12 +33,6 @@ export function PullRequestSheetContent(props: {
33 className="bg-sheet ios:flex-1"
34 style={android ? { maxHeight: windowHeight * 0.92 } : undefined}
35 >
37 - <NativeStackScreenOptions
38 - options={{
39 - gestureEnabled: !props.busy,
40 - ...(android ? { sheetCornerRadius: 28, sheetAllowedDetents: "fitToContents" } : {}),
41 - }}
42 - />
36 <SheetHeader
37 presentation={android ? "inline" : "native"}
38 title={props.title}
apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx
+50 -71
@@ -1,49 +1,16 @@
1 -import { SheetCloseButton } from "../../../components/ui/SheetHeader";
1 +import { SheetHeader } from "../../../components/ui/SheetHeader";
2 import { useNavigation } from "@react-navigation/native";
3 import { useState } from "react";
4 import { Linking, Pressable, View } from "react-native";
5 import { WebView } from "react-native-webview";
6
7 import { Button } from "../../../components/ui/Button";
8 -import { IconButton } from "../../../components/ui/IconButton";
8 import { AppActivityIndicator } from "../../../components/ui/AppActivityIndicator";
9 import { AppText as Text } from "../../../components/ui/AppText";
10 import { LoadingStrip } from "../../../components/ui/LoadingStrip";
11 import { SymbolView } from "../../../components/ui/AppSymbol";
13 -import { NativeStackScreenOptions } from "../../../native/StackHeader";
12 import { isLegalDocumentUrl, LEGAL_URL } from "../lib/legal-document-url";
13
16 -export function SettingsLegalDocumentCloseHeaderButton() {
17 - const navigation = useNavigation();
18 -
19 - return (
20 - <SheetCloseButton
21 - accessibilityLabel="Close legal document"
22 - onClose={() => navigation.goBack()}
23 - />
24 - );
25 -}
26 -
27 -export function SettingsLegalDocumentExternalHeaderButton({
28 - externalUrl = LEGAL_URL,
29 -}: {
30 - readonly externalUrl?: string;
31 -}) {
32 - const safeExternalUrl = isLegalDocumentUrl(externalUrl) ? externalUrl : LEGAL_URL;
33 -
34 - return (
35 - <IconButton
36 - accessibilityLabel="Open legal documents in external browser"
37 - icon="safari"
38 - onPress={() => void Linking.openURL(safeExternalUrl).catch(() => undefined)}
39 - />
40 - );
41 -}
42 -
43 -function externalHeaderButton(externalUrl: string) {
44 - return () => <SettingsLegalDocumentExternalHeaderButton externalUrl={externalUrl} />;
45 -}
46 -
14 interface SettingsLegalDocumentRouteScreenProps {
15 readonly documentName: string;
16 readonly documentUrl: string;
@@ -57,12 +24,20 @@ export function SettingsLegalDocumentRouteScreen({
24 const [loadProgress, setLoadProgress] = useState(0);
25 const [loadError, setLoadError] = useState<string | null>(null);
26 const [externalUrl, setExternalUrl] = useState(documentUrl);
27 + const navigation = useNavigation();
28 + const safeExternalUrl = isLegalDocumentUrl(externalUrl) ? externalUrl : LEGAL_URL;
29 const headerOptions = (
61 - <NativeStackScreenOptions
62 - options={{
63 - headerRight: externalHeaderButton(externalUrl),
64 - }}
65 - optionsVersion={externalUrl}
30 + <SheetHeader
31 + title={documentName}
32 + accessibilityLabel="Close legal document"
33 + onClose={() => navigation.goBack()}
34 + actions={[
35 + {
36 + accessibilityLabel: "Open legal documents in external browser",
37 + icon: "safari",
38 + onPress: () => void Linking.openURL(safeExternalUrl).catch(() => undefined),
39 + },
40 + ]}
41 />
42 );
43
@@ -71,40 +46,44 @@ export function SettingsLegalDocumentRouteScreen({
46 };
47 if (loadError) {
48 return (
74 - <View className="flex-1 items-center justify-center gap-4 bg-sheet px-8">
49 + <View className="flex-1 bg-sheet">
50 {headerOptions}
76 - <SymbolView
77 - name="exclamationmark.triangle"
78 - size={32}
79 - tintColorClassName={"accent-icon"}
80 - type="monochrome"
81 - weight="regular"
82 - />
83 - <View className="items-center gap-2">
84 - <Text className="text-center font-t3-bold text-lg text-foreground">
85 - Couldn&apos;t load the {documentName.toLowerCase()}
86 - </Text>
87 - <Text selectable className="text-center text-sm leading-normal text-foreground-muted">
88 - {loadError}
89 - </Text>
90 - </View>
91 - <View className="w-full max-w-[320px] gap-2">
92 - <Button
93 - label="Try Again"
94 - tone="contrast"
95 - fullWidth
96 - onPress={() => {
97 - setLoadError(null);
98 - setReloadKey((value) => value + 1);
99 - }}
51 + <View className="flex-1 items-center justify-center gap-4 px-8">
52 + <SymbolView
53 + name="exclamationmark.triangle"
54 + size={32}
55 + tintColorClassName={"accent-icon"}
56 + type="monochrome"
57 + weight="regular"
58 />
101 - <Pressable
102 - accessibilityRole="link"
103 - onPress={() => openExternalUrl(documentUrl)}
104 - className="items-center rounded-xl px-4 py-3 active:bg-foreground/5"
105 - >
106 - <Text className="font-t3-medium text-base text-foreground-muted">Open in Browser</Text>
107 - </Pressable>
59 + <View className="items-center gap-2">
60 + <Text className="text-center font-t3-bold text-lg text-foreground">
61 + Couldn&apos;t load the {documentName.toLowerCase()}
62 + </Text>
63 + <Text selectable className="text-center text-sm leading-normal text-foreground-muted">
64 + {loadError}
65 + </Text>
66 + </View>
67 + <View className="w-full max-w-[320px] gap-2">
68 + <Button
69 + label="Try Again"
70 + tone="contrast"
71 + fullWidth
72 + onPress={() => {
73 + setLoadError(null);
74 + setReloadKey((value) => value + 1);
75 + }}
76 + />
77 + <Pressable
78 + accessibilityRole="link"
79 + onPress={() => openExternalUrl(documentUrl)}
80 + className="items-center rounded-xl px-4 py-3 active:bg-foreground/5"
81 + >
82 + <Text className="font-t3-medium text-base text-foreground-muted">
83 + Open in Browser
84 + </Text>
85 + </Pressable>
86 + </View>
87 </View>
88 </View>
89 );
apps/mobile/src/features/threads/ThreadAgentsSheet.tsx
+1 -2
@@ -23,7 +23,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
23 import { AppBar } from "../../components/ui/AppBar";
24 import { AppText as Text } from "../../components/ui/AppText";
25 import { environmentThreadDetails } from "../../state/threads";
26 -import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
26 +import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
27 import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";
28 import { useEnvironments } from "../../state/environments";
29 import { SubagentRow } from "./SubagentRow";
@@ -165,7 +165,6 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {
165
166 return (
167 <View collapsable={false} className="flex-1 bg-sheet">
168 - <NativeStackScreenOptions options={{ sheetCornerRadius: 28 }} />
168 <AppBar sheet title="Agents" onBack={() => navigation.goBack()} />
169 <ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
170 </View>
apps/mobile/src/features/threads/ThreadBackgroundWorkSheet.tsx
+1 -2
@@ -15,7 +15,7 @@ import { AppBar } from "../../components/ui/AppBar";
15 import { SymbolView } from "../../components/ui/AppSymbol";
16 import { AppText as Text } from "../../components/ui/AppText";
17 import { ScreenContent } from "../../components/ui/ScreenContent";
18 -import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
18 +import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
19 import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";
20 import { environmentThreadShells } from "../../state/threads";
21 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
@@ -96,7 +96,6 @@ export function ThreadBackgroundWorkSheet({ route }: StaticScreenProps<Backgroun
96 }
97 return (
98 <View collapsable={false} className="flex-1 bg-sheet">
99 - <NativeStackScreenOptions options={{ sheetCornerRadius: 28 }} />
99 <AppBar sheet title="Background work" onBack={() => navigation.goBack()} />
100 <ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
101 </View>
apps/mobile/src/features/threads/ThreadPullRequestsSheet.tsx
-2
@@ -9,7 +9,6 @@ import { AppText as Text } from "../../components/ui/AppText";
9 import { ScreenContent } from "../../components/ui/ScreenContent";
10 import { SheetHeader } from "../../components/ui/SheetHeader";
11 import { Toolbar } from "../../components/ui/Toolbar";
12 -import { NativeStackScreenOptions } from "../../native/StackHeader";
12 import { useOpenPullRequest } from "../../native/useOpenPullRequest";
13 import { useThreadSelection } from "../../state/use-thread-selection";
14 import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
@@ -110,7 +109,6 @@ export function ThreadPullRequestsSheet(
109
110 return (
111 <View collapsable={false} className="flex-1 bg-header">
113 - <NativeStackScreenOptions options={{ sheetCornerRadius: 28 }} />
112 <AppBar
113 sheet
114 title={title}
apps/mobile/src/features/threads/ThreadQueueControl.tsx
+1 -2
@@ -27,7 +27,7 @@ import { Menu } from "../../components/ui/Menu";
27 import { ScreenContent } from "../../components/ui/ScreenContent";
28 import { scopedThreadKey } from "../../lib/scopedEntities";
29 import { useUniwindTheme } from "../../lib/useUniwindTheme";
30 -import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
30 +import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
31 import { useAssetUrl } from "../../state/assets";
32 import { useQuietThreadShell } from "../../state/entities";
33 import { useEnvironmentQuery } from "../../state/query";
@@ -397,7 +397,6 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
397 return (
398 <GestureHandlerRootView style={{ flex: 1 }}>
399 <View collapsable={false} className="flex-1 bg-sheet">
400 - <NativeStackScreenOptions options={{ sheetCornerRadius: 28 }} />
400 <AppBar sheet title="Queued" onBack={() => navigation.goBack()} />
401 <ScreenContent insetHorizontal={layout.usesSplitView}>{content}</ScreenContent>
402 </View>
apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
-9
@@ -7,7 +7,6 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
7 import { AppBar } from "../../../components/ui/AppBar";
8 import { SheetHeader } from "../../../components/ui/SheetHeader";
9 import { ScreenContent } from "../../../components/ui/ScreenContent";
10 -import { NativeStackScreenOptions } from "../../../native/StackHeader";
10 import { AppText as Text, AppTextInput as TextInput } from "../../../components/ui/AppText";
11 import { cn } from "../../../lib/cn";
12 import { useEnvironmentQuery } from "../../../state/query";
@@ -69,14 +68,6 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
68 className="bg-sheet ios:flex-1"
69 style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}
70 >
72 - {Platform.OS === "android" ? (
73 - <NativeStackScreenOptions
74 - options={{
75 - sheetCornerRadius: 28,
76 - sheetAllowedDetents: "fitToContents",
77 - }}
78 - />
79 - ) : null}
71 {Platform.OS === "android" ? (
72 <AppBar
73 sheet
apps/mobile/src/features/threads/git/GitCommitSheet.tsx
-6
@@ -8,7 +8,6 @@ import { formatDiffCount } from "@t3tools/client-runtime/diff-count";
8 import { useSafeAreaInsets } from "react-native-safe-area-context";
9
10 import { SymbolView } from "../../../components/ui/AppSymbol";
11 -import { NativeStackScreenOptions } from "../../../native/StackHeader";
11 import { AppText as Text, AppTextInput as TextInput } from "../../../components/ui/AppText";
12 import { cn } from "../../../lib/cn";
13 import { useEnvironmentQuery } from "../../../state/query";
@@ -86,11 +85,6 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
85 className="bg-sheet ios:flex-1 android:flex-col-reverse"
86 style={android ? { maxHeight: windowHeight * 0.92 } : undefined}
87 >
89 - {android ? (
90 - <NativeStackScreenOptions
91 - options={{ sheetCornerRadius: 28, sheetAllowedDetents: "fitToContents" }}
92 - />
93 - ) : null}
88 {android ? null : header}
89 <ScreenContent fitToContents>
90 <ScrollView
apps/mobile/src/features/threads/git/GitConfirmSheet.tsx
-9
@@ -11,7 +11,6 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
11
12 import { AppBar } from "../../../components/ui/AppBar";
13 import { ScreenContent } from "../../../components/ui/ScreenContent";
14 -import { NativeStackScreenOptions } from "../../../native/StackHeader";
14 import { AppText as Text } from "../../../components/ui/AppText";
15 import { useSelectedThreadGitActions } from "../../../state/use-selected-thread-git-actions";
16 import { useSelectedThreadGitState } from "../../../state/use-selected-thread-git-state";
@@ -121,14 +120,6 @@ export function GitConfirmSheet(props: GitConfirmSheetProps) {
120 className="bg-sheet ios:flex-1"
121 style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}
122 >
124 - {Platform.OS === "android" ? (
125 - <NativeStackScreenOptions
126 - options={{
127 - sheetCornerRadius: 28,
128 - sheetAllowedDetents: "fitToContents",
129 - }}
130 - />
131 - ) : null}
123 {Platform.OS === "android" ? (
124 <AppBar sheet title="Confirm action" onBack={() => navigation.goBack()} hideBottomBorder />
125 ) : (
apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
-4
@@ -27,7 +27,6 @@ import { ScreenContent } from "../../../components/ui/ScreenContent";
27 import { useAdaptiveWorkspaceLayout } from "../../layout/AdaptiveWorkspaceLayout";
28 import { InspectorSheetContext } from "../../layout/workspace-inspector-sheet";
29 import { AppText as Text } from "../../../components/ui/AppText";
30 -import { NativeStackScreenOptions } from "../../../native/StackHeader";
30 import { useEnvironmentQuery } from "../../../state/query";
31 import { useThreadSelection } from "../../../state/use-thread-selection";
32 import { useSelectedThreadGitActions } from "../../../state/use-selected-thread-git-actions";
@@ -376,9 +375,6 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
375 collapsable={false}
376 className={Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 bg-sheet"}
377 >
379 - <NativeStackScreenOptions
380 - options={{ sheetCornerRadius: Platform.OS === "android" ? 28 : undefined }}
381 - />
378 <AppBar
379 sheet
380 title={currentBranchLabel}
apps/mobile/src/native/createV5StackNavigator.ios.tsx
+2 -2
@@ -29,6 +29,7 @@ import { V5StackHeader } from "./V5StackHeader.ios";
29 import type { AppNativeStackNavigationOptions } from "./StackHeader";
30 import { NativeColumnContent } from "./NativeColumnContent.ios";
31 import {
32 + isPresentedRoute,
33 nativeStackPopAction,
34 partitionStackPresentations,
35 reconcileStackScreens,
@@ -264,8 +265,7 @@ export function V5CardStackView(
265
266 export function V5StackView(props: V5StackViewProps) {
267 const groups = partitionStackPresentations(props.state.routes, (route) => {
267 - const presentation = props.descriptors[route.key]?.options.presentation;
268 - return presentation !== undefined && presentation !== "card";
268 + return isPresentedRoute(props.descriptors[route.key]?.options);
269 });
270 const routes = groups.map((group) => group[0]!);
271 const descriptors = Object.fromEntries(
apps/mobile/src/native/sheet-surface.ts
-5
@@ -1,10 +1,5 @@
1 import { Platform } from "react-native";
2
3 -export const HORIZONTAL_FORM_SHEET_OPTIONS = {
4 - presentation: "formSheet" as const,
5 - sheetPrefersHorizontalBars: true,
6 -};
7 -
3 export function formSheetDetents(initialDetent: number, androidExpandedDetent = 0.92) {
4 // Duo moves the status bar above the sheet only at the maximum native detent.
5 return [initialDetent, Platform.OS === "ios" ? 1 : androidExpandedDetent];
apps/mobile/src/native/workspace-stack-projection.ts
+6
@@ -161,3 +161,9 @@ export function reconcileStackScreens<T extends { readonly key: string }>(
161 });
162 return screens;
163 }
164 +
165 +/** Whether a route is presented over the stack (a sheet or modal) rather than pushed. */
166 +export function isPresentedRoute(options: { readonly presentation?: string } | undefined) {
167 + const presentation = options?.presentation;
168 + return presentation !== undefined && presentation !== "card";
169 +}