Skip to content

Commit 3dedf74

Browse files
juliusmarmingePixPMusicclaude
committed
fix(mobile): iPhone Duo sheets use their full width and native headers
On a folded iPhone Duo, Git overview and Linked pull requests stopped two-thirds of the way across, thread settings was inset twice with Done on the model list, Branches & worktrees had no header, and the shared Sheet ran its first row under the close button in the rail. Plain sheets now opt into horizontal bars through Screens' prefersHorizontalBars and sheetPrefersHorizontalBars, and open at the full native detent when expanded. Git overview, Linked pull requests and Branches use the route's native header through SheetHeader. Thread settings keep automatic placement, so cancel and confirm sit at the top of the Duo rail with filter and search at its foot, and sheet confirm buttons ask for high visibility priority. Ports #20435 and #22551. This stack already keeps a modal's bottom toolbar out of its trailing group, so #22551's nativeKeepsBottomToolbar option is not needed. Co-authored-by: Pixel Perfect <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent e5cb117 commit 3dedf74

13 files changed

Lines changed: 184 additions & 141 deletions

‎apps/mobile/src/Stack.tsx‎

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ import { NATIVE_LIQUID_GLASS_SUPPORTED } from "./native/native-glass";
149149
import { deriveLayout } from "./lib/layout";
150150
import { useNativeLayoutMetrics } from "./native/native-layout-metrics";
151151
import { nativeHeaderScrollEdgeEffects } from "./native/StackHeader";
152-
import { FORM_SHEET_PRESENTATION_OPTIONS } from "./native/sheet-surface";
152+
import { HORIZONTAL_FORM_SHEET_OPTIONS, formSheetDetents } from "./native/sheet-surface";
153153
import { useThreadOutboxDrain } from "./state/use-thread-outbox-drain";
154154
import { useComposerAttachmentUploadWorker } from "./state/composer-attachment-uploads";
155155

@@ -210,6 +210,15 @@ const LEGAL_DOCUMENT_HEADER_OPTIONS: AppScreenOptions = {
210210

211211
const NESTED_NAVIGATOR_OPTIONS = { nativeContentInsetHorizontally: false, headerShown: false };
212212

213+
// Thread settings keep the Duo's vertical bar so cancel, search, filter and confirm sit in the
214+
// rail. The picker stack spans the sheet so its header reaches the rail, and insets its content.
215+
const THREAD_SETTINGS_SHEET_OPTIONS = {
216+
presentation: "formSheet" as const,
217+
sheetAllowedDetents: [1],
218+
sheetGrabberVisible: true,
219+
nativeContentInsetHorizontally: false,
220+
};
221+
213222
const SettingsContentStack = createV5SheetStackNavigator({
214223
initialRouteName: "Settings",
215224
screenOptions: {
@@ -368,9 +377,7 @@ const SettingsContentStack = createV5SheetStackNavigator({
368377
...(Platform.OS === "android"
369378
? { presentation: "card" as const }
370379
: {
371-
...FORM_SHEET_PRESENTATION_OPTIONS,
372-
sheetAllowedDetents: [1],
373-
sheetGrabberVisible: true,
380+
...THREAD_SETTINGS_SHEET_OPTIONS,
374381
}),
375382
},
376383
}),
@@ -513,9 +520,7 @@ const NewTaskSheetStack = createNativeStackNavigator({
513520
...(Platform.OS === "android"
514521
? { presentation: "card" as const }
515522
: {
516-
...FORM_SHEET_PRESENTATION_OPTIONS,
517-
sheetAllowedDetents: [1],
518-
sheetGrabberVisible: true,
523+
...THREAD_SETTINGS_SHEET_OPTIONS,
519524
}),
520525
},
521526
}),
@@ -734,8 +739,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
734739
screen: PullRequestFilesSheet,
735740
options: {
736741
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
737-
...FORM_SHEET_PRESENTATION_OPTIONS,
738-
sheetAllowedDetents: [0.6, 0.92],
742+
...HORIZONTAL_FORM_SHEET_OPTIONS,
743+
sheetAllowedDetents: formSheetDetents(0.6),
739744
sheetGrabberVisible: true,
740745
sheetCornerRadius: Platform.OS === "android" ? 28 : undefined,
741746
},
@@ -744,8 +749,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
744749
screen: PullRequestReviewersScreen,
745750
options: {
746751
...DETAIL_HEADER_OPTIONS,
747-
...FORM_SHEET_PRESENTATION_OPTIONS,
748-
sheetAllowedDetents: [0.75, 0.92],
752+
...HORIZONTAL_FORM_SHEET_OPTIONS,
753+
sheetAllowedDetents: formSheetDetents(0.75),
749754
sheetGrabberVisible: true,
750755
headerBackVisible: false,
751756
},
@@ -759,17 +764,17 @@ const RootStackConfig = createWorkspaceStackNavigator({
759764
options: {
760765
...(Platform.OS === "android"
761766
? { presentation: "fullScreenModal" as const }
762-
: { ...SHEET_GLASS_HEADER_OPTIONS, ...FORM_SHEET_PRESENTATION_OPTIONS }),
763-
sheetAllowedDetents: Platform.OS === "android" ? undefined : [0.75, 0.92],
767+
: { ...SHEET_GLASS_HEADER_OPTIONS, ...HORIZONTAL_FORM_SHEET_OPTIONS }),
768+
sheetAllowedDetents: Platform.OS === "android" ? undefined : formSheetDetents(0.75),
764769
sheetGrabberVisible: Platform.OS !== "android",
765770
},
766771
}),
767772
PullRequestReview: createNativeStackScreen({
768773
screen: PullRequestReviewSheet,
769774
options: {
770775
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
771-
...FORM_SHEET_PRESENTATION_OPTIONS,
772-
sheetAllowedDetents: [0.75, 0.92],
776+
...HORIZONTAL_FORM_SHEET_OPTIONS,
777+
sheetAllowedDetents: formSheetDetents(0.75),
773778
sheetGrabberVisible: true,
774779
},
775780
}),
@@ -816,8 +821,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
816821
// formSheet; use a full-screen modal there instead.
817822
...(Platform.OS === "android"
818823
? { presentation: "fullScreenModal" as const }
819-
: FORM_SHEET_PRESENTATION_OPTIONS),
820-
sheetAllowedDetents: Platform.OS === "android" ? undefined : [0.55, 0.92],
824+
: HORIZONTAL_FORM_SHEET_OPTIONS),
825+
sheetAllowedDetents: Platform.OS === "android" ? undefined : formSheetDetents(0.55),
821826
sheetGrabberVisible: Platform.OS !== "android",
822827
},
823828
}),
@@ -856,54 +861,54 @@ const RootStackConfig = createWorkspaceStackNavigator({
856861
...(Platform.OS === "android"
857862
? { presentation: "card" as const }
858863
: {
859-
...FORM_SHEET_PRESENTATION_OPTIONS,
860-
sheetAllowedDetents: [1],
861-
sheetGrabberVisible: true,
864+
...THREAD_SETTINGS_SHEET_OPTIONS,
862865
}),
863866
},
864867
}),
865868
ThreadQueue: createNativeStackScreen({
866869
screen: ThreadQueueSheet,
867870
options: {
868-
...FORM_SHEET_PRESENTATION_OPTIONS,
871+
...HORIZONTAL_FORM_SHEET_OPTIONS,
869872
headerShown: false,
870-
sheetAllowedDetents: [0.65, 0.95],
873+
sheetAllowedDetents: formSheetDetents(0.65, 0.95),
871874
sheetGrabberVisible: true,
872875
},
873876
}),
874877
ThreadBackgroundWork: createNativeStackScreen({
875878
screen: ThreadBackgroundWorkSheet,
876879
options: {
877-
...FORM_SHEET_PRESENTATION_OPTIONS,
880+
...HORIZONTAL_FORM_SHEET_OPTIONS,
878881
headerShown: false,
879-
sheetAllowedDetents: [0.5, 0.9],
882+
sheetAllowedDetents: formSheetDetents(0.5, 0.9),
880883
sheetGrabberVisible: true,
881884
},
882885
}),
883886
ThreadAgents: createNativeStackScreen({
884887
screen: ThreadAgentsSheet,
885888
options: {
886-
...FORM_SHEET_PRESENTATION_OPTIONS,
889+
...HORIZONTAL_FORM_SHEET_OPTIONS,
887890
headerShown: false,
888-
sheetAllowedDetents: [0.5, 0.9],
891+
sheetAllowedDetents: formSheetDetents(0.5, 0.9),
889892
sheetGrabberVisible: true,
890893
},
891894
}),
892895
GitOverview: createNativeStackScreen({
893896
screen: GitOverviewSheet,
894897
linking: `${THREAD_LINKING_PREFIX}/git`,
895898
options: {
896-
...FORM_SHEET_PRESENTATION_OPTIONS,
897-
sheetAllowedDetents: [0.55, 0.92],
899+
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
900+
...HORIZONTAL_FORM_SHEET_OPTIONS,
901+
sheetAllowedDetents: formSheetDetents(0.55),
898902
sheetGrabberVisible: true,
899903
},
900904
}),
901905
ThreadPullRequests: createNativeStackScreen({
902906
screen: ThreadPullRequestsSheet,
903907
linking: `${THREAD_LINKING_PREFIX}/pull-requests`,
904908
options: {
905-
...FORM_SHEET_PRESENTATION_OPTIONS,
906-
sheetAllowedDetents: [0.55, 0.92],
909+
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
910+
...HORIZONTAL_FORM_SHEET_OPTIONS,
911+
sheetAllowedDetents: formSheetDetents(0.55),
907912
sheetGrabberVisible: true,
908913
},
909914
}),
@@ -912,26 +917,27 @@ const RootStackConfig = createWorkspaceStackNavigator({
912917
linking: `${THREAD_LINKING_PREFIX}/git/commit`,
913918
options: {
914919
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
915-
...FORM_SHEET_PRESENTATION_OPTIONS,
916-
sheetAllowedDetents: [0.8, 0.92],
920+
...HORIZONTAL_FORM_SHEET_OPTIONS,
921+
sheetAllowedDetents: formSheetDetents(0.8),
917922
sheetGrabberVisible: true,
918923
},
919924
}),
920925
GitBranches: createNativeStackScreen({
921926
screen: GitBranchesSheet,
922927
linking: `${THREAD_LINKING_PREFIX}/git/branches`,
923928
options: {
924-
...FORM_SHEET_PRESENTATION_OPTIONS,
925-
sheetAllowedDetents: [0.55, 0.92],
929+
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
930+
...HORIZONTAL_FORM_SHEET_OPTIONS,
931+
sheetAllowedDetents: formSheetDetents(0.55),
926932
sheetGrabberVisible: true,
927933
},
928934
}),
929935
GitConfirm: createNativeStackScreen({
930936
screen: GitConfirmSheet,
931937
linking: `${THREAD_LINKING_PREFIX}/git-confirm`,
932938
options: {
933-
...FORM_SHEET_PRESENTATION_OPTIONS,
934-
sheetAllowedDetents: [0.45, 0.7],
939+
...HORIZONTAL_FORM_SHEET_OPTIONS,
940+
sheetAllowedDetents: [0.55, 0.7],
935941
sheetGrabberVisible: true,
936942
},
937943
}),
@@ -964,8 +970,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
964970
...(Platform.OS === "android" ? { headerShown: false } : SHEET_SOLID_HEADER_OPTIONS),
965971
title: "Set up T3 Connect",
966972
gestureEnabled: true,
967-
...FORM_SHEET_PRESENTATION_OPTIONS,
968-
sheetAllowedDetents: [0.6, 0.95],
973+
...HORIZONTAL_FORM_SHEET_OPTIONS,
974+
sheetAllowedDetents: formSheetDetents(0.6, 0.95),
969975
sheetGrabberVisible: true,
970976
},
971977
}),
@@ -977,7 +983,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
977983
...(Platform.OS === "android"
978984
? { presentation: "card" as const, headerShown: false }
979985
: {
980-
...FORM_SHEET_PRESENTATION_OPTIONS,
986+
...HORIZONTAL_FORM_SHEET_OPTIONS,
981987
sheetAllowedDetents: [0.55, 0.7],
982988
sheetGrabberVisible: true,
983989
}),
@@ -991,7 +997,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
991997
// native header stack mounts without remounting the pairing form.
992998
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
993999
title: "Add Environment",
994-
...FORM_SHEET_PRESENTATION_OPTIONS,
1000+
...HORIZONTAL_FORM_SHEET_OPTIONS,
9951001
sheetAllowedDetents: [0.55, 0.7],
9961002
sheetGrabberVisible: true,
9971003
},
@@ -1009,6 +1015,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
10091015
),
10101016
options: {
10111017
...NESTED_NAVIGATOR_OPTIONS,
1018+
sheetPrefersHorizontalBars: true,
10121019
gestureEnabled: true,
10131020
headerShown: false,
10141021
},
@@ -1066,8 +1073,8 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
10661073
return usesWorkspaceFlowScreens
10671074
? { presentation: "card" }
10681075
: {
1069-
...FORM_SHEET_PRESENTATION_OPTIONS,
1070-
sheetAllowedDetents: [0.92],
1076+
presentation: "formSheet",
1077+
sheetAllowedDetents: [1],
10711078
sheetGrabberVisible: true,
10721079
};
10731080
}}

‎apps/mobile/src/components/ui/Sheet.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { FormSheet, ScreenStack } from "react-native-screens";
44
import { useResolveClassNames } from "uniwind";
55

66
import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
7+
import { formSheetDetents } from "../../native/sheet-surface";
78
import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";
89

910
const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
@@ -21,8 +22,10 @@ export function Sheet(props: SheetProps) {
2122
return (
2223
<FormSheet
2324
isOpen={isOpen}
24-
detents={[0.5, 0.9]}
25+
detents={formSheetDetents(0.5, 0.9)}
2526
prefersGrabberVisible
27+
// The header holds the close button, so the Duo needs no rail inside this sheet.
28+
prefersHorizontalBars
2629
nativeContainerStyle={containerStyle}
2730
onDismiss={props.onClose}
2831
onNativeDismiss={props.onClose}

‎apps/mobile/src/components/ui/SheetHeader.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function NativeSheetHeader(props: SheetHeaderProps) {
7575
<Toolbar.Button
7676
icon="checkmark"
7777
variant="prominent"
78+
visibilityPriority="high"
7879
tintColor={colors["--color-prominent-action"]}
7980
accessibilityLabel={confirmation.label}
8081
disabled={confirmation.disabled}

‎apps/mobile/src/features/threads/ThreadPullRequestsSheet.tsx‎

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ import { useNavigation, type StaticScreenProps } from "@react-navigation/native"
22
import { LegendList } from "@legendapp/list/react-native";
33
import { useMemo } from "react";
44
import { Platform, View } from "react-native";
5-
import { ScreenStack } from "react-native-screens";
65
import { useSafeAreaInsets } from "react-native-safe-area-context";
76

87
import { AndroidSheetHeader } from "../../components/ui/AndroidScreenHeader";
98
import { AppText as Text } from "../../components/ui/AppText";
109
import { ScreenContent } from "../../components/ui/ScreenContent";
11-
import { NativeSheetContent } from "../../native/NativeSheetContent";
12-
import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
13-
import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";
10+
import { SheetHeader } from "../../components/ui/SheetHeader";
11+
import { Toolbar } from "../../components/ui/Toolbar";
12+
import { NativeStackScreenOptions } from "../../native/StackHeader";
1413
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
1514
import { useThreadSelection } from "../../state/use-thread-selection";
1615
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
@@ -21,7 +20,6 @@ import {
2120
} from "./LinkedPullRequestList";
2221
import { useLinkedPullRequestActions } from "./useLinkedPullRequestActions";
2322

24-
const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
2523
const TITLE = "Linked pull requests";
2624

2725
export function ThreadPullRequestsSheet(
@@ -92,47 +90,19 @@ export function ThreadPullRequestsSheet(
9290
);
9391

9492
if (Platform.OS === "ios") {
95-
// A plain formSheet screen never renders a stack header, so it comes from
96-
// a nested native stack inside the sheet (same shape as the git sheet).
9793
return (
9894
<View collapsable={false} className="flex-1 bg-sheet">
99-
<ScreenStack style={{ flex: 1 }}>
100-
<NativeScreen
101-
activityState={2}
102-
enabled
103-
isNativeStack
104-
screenId="thread-pull-requests-sheet-native"
105-
scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
106-
className="flex-1 bg-sheet"
107-
>
108-
<NativeSheetContent>{content}</NativeSheetContent>
109-
<NativeHeader
110-
backgroundColor="rgba(0,0,0,0)"
111-
tintColorClassName="accent-foreground"
112-
hideBackButton
113-
hideShadow={false}
114-
navigationItemStyle="editor"
115-
title={TITLE}
116-
titleColorClassName="accent-foreground"
117-
titleFontSize={18}
118-
titleFontWeight="800"
119-
translucent
120-
headerRightBarButtonItems={
121-
actions.canLink
122-
? [
123-
{
124-
type: "button",
125-
accessibilityLabel: "Link pull request",
126-
icon: { name: "plus", type: "sfSymbol" },
127-
identifier: "thread-pull-requests-link",
128-
onPress: actions.promptLink,
129-
},
130-
]
131-
: undefined
132-
}
95+
<SheetHeader presentation="native" title={TITLE} onClose={() => navigation.goBack()} />
96+
{actions.canLink ? (
97+
<Toolbar placement="right">
98+
<Toolbar.Button
99+
icon="plus"
100+
accessibilityLabel="Link pull request"
101+
onPress={actions.promptLink}
133102
/>
134-
</NativeScreen>
135-
</ScreenStack>
103+
</Toolbar>
104+
) : null}
105+
{content}
136106
</View>
137107
);
138108
}

0 commit comments

Comments
 (0)