Skip to content
TypeScript

fix(mobile): use native full-width sheets on iPhone Duo (#22980)

Julius Marminge13eea3f6e19d
diff --git a/apps/mobile/src/Stack.tsx b/apps/mobile/src/Stack.tsx
index 13240c54a97..f74f13acd50 100644
--- a/apps/mobile/src/Stack.tsx
+++ b/apps/mobile/src/Stack.tsx
@@ -149,7 +149,7 @@ import { NATIVE_LIQUID_GLASS_SUPPORTED } from "./native/native-glass";
import { deriveLayout } from "./lib/layout";
import { useNativeLayoutMetrics } from "./native/native-layout-metrics";
import { nativeHeaderScrollEdgeEffects } from "./native/StackHeader";
-import { FORM_SHEET_PRESENTATION_OPTIONS } from "./native/sheet-surface";
+import { HORIZONTAL_FORM_SHEET_OPTIONS, formSheetDetents } from "./native/sheet-surface";
import { useThreadOutboxDrain } from "./state/use-thread-outbox-drain";
import { useComposerAttachmentUploadWorker } from "./state/composer-attachment-uploads";
@@ -210,6 +210,15 @@ const LEGAL_DOCUMENT_HEADER_OPTIONS: AppScreenOptions = {
const NESTED_NAVIGATOR_OPTIONS = { nativeContentInsetHorizontally: false, headerShown: false };
+// Thread settings keep the Duo's vertical bar so cancel, search, filter and confirm sit in the
+// rail. The picker stack spans the sheet so its header reaches the rail, and insets its content.
+const THREAD_SETTINGS_SHEET_OPTIONS = {
+ presentation: "formSheet" as const,
+ sheetAllowedDetents: [1],
+ sheetGrabberVisible: true,
+ nativeContentInsetHorizontally: false,
+};
+
const SettingsContentStack = createV5SheetStackNavigator({
initialRouteName: "Settings",
screenOptions: {
@@ -368,9 +377,7 @@ const SettingsContentStack = createV5SheetStackNavigator({
...(Platform.OS === "android"
? { presentation: "card" as const }
: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [1],
- sheetGrabberVisible: true,
+ ...THREAD_SETTINGS_SHEET_OPTIONS,
}),
},
}),
@@ -513,9 +520,7 @@ const NewTaskSheetStack = createNativeStackNavigator({
...(Platform.OS === "android"
? { presentation: "card" as const }
: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [1],
- sheetGrabberVisible: true,
+ ...THREAD_SETTINGS_SHEET_OPTIONS,
}),
},
}),
@@ -734,8 +739,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
screen: PullRequestFilesSheet,
options: {
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.6, 0.92],
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
+ sheetAllowedDetents: formSheetDetents(0.6),
sheetGrabberVisible: true,
sheetCornerRadius: Platform.OS === "android" ? 28 : undefined,
},
@@ -744,8 +749,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
screen: PullRequestReviewersScreen,
options: {
...DETAIL_HEADER_OPTIONS,
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.75, 0.92],
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
+ sheetAllowedDetents: formSheetDetents(0.75),
sheetGrabberVisible: true,
headerBackVisible: false,
},
@@ -759,8 +764,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
options: {
...(Platform.OS === "android"
? { presentation: "fullScreenModal" as const }
- : { ...SHEET_GLASS_HEADER_OPTIONS, ...FORM_SHEET_PRESENTATION_OPTIONS }),
- sheetAllowedDetents: Platform.OS === "android" ? undefined : [0.75, 0.92],
+ : { ...SHEET_GLASS_HEADER_OPTIONS, ...HORIZONTAL_FORM_SHEET_OPTIONS }),
+ sheetAllowedDetents: Platform.OS === "android" ? undefined : formSheetDetents(0.75),
sheetGrabberVisible: Platform.OS !== "android",
},
}),
@@ -768,8 +773,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
screen: PullRequestReviewSheet,
options: {
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.75, 0.92],
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
+ sheetAllowedDetents: formSheetDetents(0.75),
sheetGrabberVisible: true,
},
}),
@@ -816,8 +821,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
// formSheet; use a full-screen modal there instead.
...(Platform.OS === "android"
? { presentation: "fullScreenModal" as const }
- : FORM_SHEET_PRESENTATION_OPTIONS),
- sheetAllowedDetents: Platform.OS === "android" ? undefined : [0.55, 0.92],
+ : HORIZONTAL_FORM_SHEET_OPTIONS),
+ sheetAllowedDetents: Platform.OS === "android" ? undefined : formSheetDetents(0.55),
sheetGrabberVisible: Platform.OS !== "android",
},
}),
@@ -856,36 +861,34 @@ const RootStackConfig = createWorkspaceStackNavigator({
...(Platform.OS === "android"
? { presentation: "card" as const }
: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [1],
- sheetGrabberVisible: true,
+ ...THREAD_SETTINGS_SHEET_OPTIONS,
}),
},
}),
ThreadQueue: createNativeStackScreen({
screen: ThreadQueueSheet,
options: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
headerShown: false,
- sheetAllowedDetents: [0.65, 0.95],
+ sheetAllowedDetents: formSheetDetents(0.65, 0.95),
sheetGrabberVisible: true,
},
}),
ThreadBackgroundWork: createNativeStackScreen({
screen: ThreadBackgroundWorkSheet,
options: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
headerShown: false,
- sheetAllowedDetents: [0.5, 0.9],
+ sheetAllowedDetents: formSheetDetents(0.5, 0.9),
sheetGrabberVisible: true,
},
}),
ThreadAgents: createNativeStackScreen({
screen: ThreadAgentsSheet,
options: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
headerShown: false,
- sheetAllowedDetents: [0.5, 0.9],
+ sheetAllowedDetents: formSheetDetents(0.5, 0.9),
sheetGrabberVisible: true,
},
}),
@@ -893,8 +896,9 @@ const RootStackConfig = createWorkspaceStackNavigator({
screen: GitOverviewSheet,
linking: `${THREAD_LINKING_PREFIX}/git`,
options: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.55, 0.92],
+ ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
+ sheetAllowedDetents: formSheetDetents(0.55),
sheetGrabberVisible: true,
},
}),
@@ -902,8 +906,9 @@ const RootStackConfig = createWorkspaceStackNavigator({
screen: ThreadPullRequestsSheet,
linking: `${THREAD_LINKING_PREFIX}/pull-requests`,
options: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.55, 0.92],
+ ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
+ sheetAllowedDetents: formSheetDetents(0.55),
sheetGrabberVisible: true,
},
}),
@@ -912,8 +917,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
linking: `${THREAD_LINKING_PREFIX}/git/commit`,
options: {
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.8, 0.92],
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
+ sheetAllowedDetents: formSheetDetents(0.8),
sheetGrabberVisible: true,
},
}),
@@ -921,8 +926,9 @@ const RootStackConfig = createWorkspaceStackNavigator({
screen: GitBranchesSheet,
linking: `${THREAD_LINKING_PREFIX}/git/branches`,
options: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.55, 0.92],
+ ...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
+ sheetAllowedDetents: formSheetDetents(0.55),
sheetGrabberVisible: true,
},
}),
@@ -930,8 +936,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
screen: GitConfirmSheet,
linking: `${THREAD_LINKING_PREFIX}/git-confirm`,
options: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.45, 0.7],
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
+ sheetAllowedDetents: [0.55, 0.7],
sheetGrabberVisible: true,
},
}),
@@ -964,8 +970,8 @@ const RootStackConfig = createWorkspaceStackNavigator({
...(Platform.OS === "android" ? { headerShown: false } : SHEET_SOLID_HEADER_OPTIONS),
title: "Set up T3 Connect",
gestureEnabled: true,
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.6, 0.95],
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
+ sheetAllowedDetents: formSheetDetents(0.6, 0.95),
sheetGrabberVisible: true,
},
}),
@@ -977,7 +983,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
...(Platform.OS === "android"
? { presentation: "card" as const, headerShown: false }
: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
sheetAllowedDetents: [0.55, 0.7],
sheetGrabberVisible: true,
}),
@@ -991,7 +997,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
// native header stack mounts without remounting the pairing form.
...(Platform.OS === "ios" ? SHEET_GLASS_HEADER_OPTIONS : undefined),
title: "Add Environment",
- ...FORM_SHEET_PRESENTATION_OPTIONS,
+ ...HORIZONTAL_FORM_SHEET_OPTIONS,
sheetAllowedDetents: [0.55, 0.7],
sheetGrabberVisible: true,
},
@@ -1009,6 +1015,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
),
options: {
...NESTED_NAVIGATOR_OPTIONS,
+ sheetPrefersHorizontalBars: true,
gestureEnabled: true,
headerShown: false,
},
@@ -1066,8 +1073,8 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
return usesWorkspaceFlowScreens
? { presentation: "card" }
: {
- ...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.92],
+ presentation: "formSheet",
+ sheetAllowedDetents: [1],
sheetGrabberVisible: true,
};
}}
diff --git a/apps/mobile/src/components/ui/Sheet.tsx b/apps/mobile/src/components/ui/Sheet.tsx
index 21ee41a5c55..56994803b4a 100644
--- a/apps/mobile/src/components/ui/Sheet.tsx
+++ b/apps/mobile/src/components/ui/Sheet.tsx
@@ -4,6 +4,7 @@ import { FormSheet, ScreenStack } from "react-native-screens";
import { useResolveClassNames } from "uniwind";
import { nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
+import { formSheetDetents } from "../../native/sheet-surface";
import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";
const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
@@ -21,8 +22,10 @@ export function Sheet(props: SheetProps) {
return (
<FormSheet
isOpen={isOpen}
- detents={[0.5, 0.9]}
+ detents={formSheetDetents(0.5, 0.9)}
prefersGrabberVisible
+ // The header holds the close button, so the Duo needs no rail inside this sheet.
+ prefersHorizontalBars
nativeContainerStyle={containerStyle}
onDismiss={props.onClose}
onNativeDismiss={props.onClose}
diff --git a/apps/mobile/src/components/ui/SheetHeader.tsx b/apps/mobile/src/components/ui/SheetHeader.tsx
index 311020d9fd3..126ecb58c23 100644
--- a/apps/mobile/src/components/ui/SheetHeader.tsx
+++ b/apps/mobile/src/components/ui/SheetHeader.tsx
@@ -75,6 +75,7 @@ function NativeSheetHeader(props: SheetHeaderProps) {
<Toolbar.Button
icon="checkmark"
variant="prominent"
+ visibilityPriority="high"
tintColor={colors["--color-prominent-action"]}
accessibilityLabel={confirmation.label}
disabled={confirmation.disabled}
diff --git a/apps/mobile/src/features/threads/ThreadPullRequestsSheet.tsx b/apps/mobile/src/features/threads/ThreadPullRequestsSheet.tsx
index c9075f851ee..dcf70291e9b 100644
--- a/apps/mobile/src/features/threads/ThreadPullRequestsSheet.tsx
+++ b/apps/mobile/src/features/threads/ThreadPullRequestsSheet.tsx
@@ -2,15 +2,14 @@ import { useNavigation, type StaticScreenProps } from "@react-navigation/native"
import { LegendList } from "@legendapp/list/react-native";
import { useMemo } from "react";
import { Platform, View } from "react-native";
-import { ScreenStack } from "react-native-screens";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AndroidSheetHeader } from "../../components/ui/AndroidScreenHeader";
import { AppText as Text } from "../../components/ui/AppText";
import { ScreenContent } from "../../components/ui/ScreenContent";
-import { NativeSheetContent } from "../../native/NativeSheetContent";
-import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
-import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";
+import { SheetHeader } from "../../components/ui/SheetHeader";
+import { Toolbar } from "../../components/ui/Toolbar";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
import { useThreadSelection } from "../../state/use-thread-selection";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
@@ -21,7 +20,6 @@ import {
} from "./LinkedPullRequestList";
import { useLinkedPullRequestActions } from "./useLinkedPullRequestActions";
-const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version);
const TITLE = "Linked pull requests";
export function ThreadPullRequestsSheet(
@@ -92,47 +90,19 @@ export function ThreadPullRequestsSheet(
);
if (Platform.OS === "ios") {
- // A plain formSheet screen never renders a stack header, so it comes from
- // a nested native stack inside the sheet (same shape as the git sheet).
return (
<View collapsable={false} className="flex-1 bg-sheet">
- <ScreenStack style={{ flex: 1 }}>
- <NativeScreen
- activityState={2}
- enabled
- isNativeStack
- screenId="thread-pull-requests-sheet-native"
- scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
- className="flex-1 bg-sheet"
- >
- <NativeSheetContent>{content}</NativeSheetContent>
- <NativeHeader
- backgroundColor="rgba(0,0,0,0)"
- tintColorClassName="accent-foreground"
- hideBackButton
- hideShadow={false}
- navigationItemStyle="editor"
- title={TITLE}
- titleColorClassName="accent-foreground"
- titleFontSize={18}
- titleFontWeight="800"
- translucent
- headerRightBarButtonItems={
- actions.canLink
- ? [
- {
- type: "button",
- accessibilityLabel: "Link pull request",
- icon: { name: "plus", type: "sfSymbol" },
- identifier: "thread-pull-requests-link",
- onPress: actions.promptLink,
- },
- ]
- : undefined
- }
+ <SheetHeader presentation="native" title={TITLE} onClose={() => navigation.goBack()} />
+ {actions.canLink ? (
+ <Toolbar placement="right">
+ <Toolbar.Button
+ icon="plus"
+ accessibilityLabel="Link pull request"
+ onPress={actions.promptLink}
/>
- </NativeScreen>
- </ScreenStack>
+ </Toolbar>
+ ) : null}
+ {content}
</View>
);
}
diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
index eab14dc38ed..19ed0b1a533 100644
--- a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+++ b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
@@ -85,6 +85,7 @@ import {
createNativeMailSearchToolbarItem,
NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET,
} from "../layout/native-mail-search-toolbar";
+import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
import { useNativeMailSearchToolbar } from "../../native/use-native-mail-search-toolbar";
import { ModelRow, ChoiceRow } from "./ThreadSettingsRows";
import {
@@ -847,10 +848,8 @@ function ThreadSettingsOptionsItem(props: {
.get(session.environmentId)
?.providers.find((provider) => provider.instanceId === session.providerInstanceId) ?? null)
: null;
- const usesNativeMailSearchToolbar = useNativeMailSearchToolbar();
- const bottomToolbarInset = usesNativeMailSearchToolbar
- ? NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET
- : 0;
+ // Both iOS search layouts float a bottom toolbar over the list's last rows.
+ const bottomToolbarInset = Platform.OS === "ios" ? NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET : 0;
return (
<View style={{ paddingBottom: insets.bottom + bottomToolbarInset + 12 }}>
@@ -1211,11 +1210,17 @@ function useThreadSettingsPickerPresentation() {
return value;
}
+// With a Duo vertical bar, filter and search join cancel and confirm in the rail.
+function useThreadSettingsMailSearchToolbar() {
+ const metrics = useNativeLayoutMetrics();
+ return useNativeMailSearchToolbar() && (metrics?.verticalBarEdge ?? "none") === "none";
+}
+
function ThreadSettingsModelsScreen() {
const session = useThreadSettingsSession();
const presentation = useThreadSettingsPickerPresentation();
const navigation = useNavigation<NativeStackNavigationProp<ThreadSettingsPickerStackParams>>();
- const usesNativeMailSearchToolbar = useNativeMailSearchToolbar();
+ const usesNativeMailSearchToolbar = useThreadSettingsMailSearchToolbar();
const hasCustomCatalogFilter = session.providerFilter !== null || session.showLegacy;
const commitAndClose = useEffectEvent(() => {
if (!session.commitPendingModel()) return;
@@ -1335,6 +1340,7 @@ function ThreadSettingsModelsScreen() {
headerSearchBarOptions:
Platform.OS === "ios" && !usesNativeMailSearchToolbar
? {
+ allowToolbarIntegration: true,
autoCapitalize: "none",
hideNavigationBar: false,
obscureBackground: false,
@@ -1378,7 +1384,6 @@ function ThreadSettingsModelsScreen() {
? "line.3.horizontal.decrease.circle.fill"
: "line.3.horizontal.decrease.circle"
}
- separateBackground
title="Model filters"
>
<Toolbar.Menu title="Provider">
@@ -1414,6 +1419,7 @@ function ThreadSettingsModelsScreen() {
</Toolbar.MenuAction>
) : null}
</Toolbar.Menu>
+ <Toolbar.SearchBarSlot />
</Toolbar>
) : null}
</>
diff --git a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
index d1d39357f2f..4075a49e977 100644
--- a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
@@ -5,6 +5,7 @@ import { Platform, Pressable, ScrollView, useWindowDimensions, View } from "reac
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AndroidSheetHeader } from "../../../components/ui/AndroidScreenHeader";
+import { SheetHeader } from "../../../components/ui/SheetHeader";
import { ScreenContent } from "../../../components/ui/ScreenContent";
import { NativeStackScreenOptions } from "../../../native/StackHeader";
import { AppText as Text, AppTextInput as TextInput } from "../../../components/ui/AppText";
@@ -81,11 +82,18 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
onBack={() => navigation.goBack()}
hideBottomBorder
/>
- ) : null}
+ ) : (
+ <SheetHeader
+ presentation="native"
+ title="Branches & worktrees"
+ onClose={() => navigation.goBack()}
+ />
+ )}
<ScreenContent fitToContents>
<ScrollView
nestedScrollEnabled
className="android:shrink android:grow-0 ios:flex-1"
+ contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}
diff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
index a2636f69756..43b0c5238ec 100644
--- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
@@ -1,4 +1,5 @@
import * as Dialog from "../../../components/ui/Dialog";
+import { SheetHeader } from "../../../components/ui/SheetHeader";
import { useOpenPullRequest } from "../../../native/useOpenPullRequest";
import {
type GitActionRequestInput,
@@ -368,35 +369,15 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
}
if (Platform.OS === "ios") {
- // Compact form sheet: a plain screen presented as formSheet never renders a
- // stack header, so — like the Settings sheet — the header must come from a
- // nested native stack INSIDE the sheet.
return (
<View collapsable={false} className="flex-1 bg-sheet">
- <ScreenStack style={{ flex: 1 }}>
- <NativeScreen
- activityState={2}
- enabled
- isNativeStack
- screenId="thread-git-sheet-native"
- scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
- className="flex-1 bg-sheet"
- >
- <NativeSheetContent>{content}</NativeSheetContent>
- <NativeHeader
- backgroundColor="rgba(0,0,0,0)"
- tintColorClassName="accent-foreground"
- hideBackButton
- hideShadow={false}
- navigationItemStyle="editor"
- title={currentBranchLabel}
- titleColorClassName="accent-foreground"
- titleFontSize={18}
- titleFontWeight="800"
- translucent
- />
- </NativeScreen>
- </ScreenStack>
+ <SheetHeader
+ presentation="native"
+ title={currentBranchLabel}
+ subtitle={currentStatusSummary}
+ onClose={() => navigation.goBack()}
+ />
+ {content}
</View>
);
}
diff --git a/apps/mobile/src/native/NativeHeaderToolbar.tsx b/apps/mobile/src/native/NativeHeaderToolbar.tsx
index 2e6e7059880..3f7f98a4b23 100644
--- a/apps/mobile/src/native/NativeHeaderToolbar.tsx
+++ b/apps/mobile/src/native/NativeHeaderToolbar.tsx
@@ -42,6 +42,10 @@ type NativeStackHeaderAxisBehavior = Extract<
NativeStackHeaderItem,
{ type: "button" }
>["axisBehavior"];
+type NativeStackHeaderVisibilityPriority = Extract<
+ NativeStackHeaderItem,
+ { type: "button" }
+>["visibilityPriority"];
type NativeToolbarItem = NativeStackHeaderItem | HeaderBarButtonSearchBarPlacementItem;
type NativeStackOptionsWithToolbar = NativeStackNavigationOptions & {
unstable_headerToolbarItems?: () => NativeToolbarItem[];
@@ -166,6 +170,7 @@ function convertToolbarChild(child: ReactNode): NativeToolbarItem | null {
? child.props.variant
: "plain",
identifier: typeof child.props.identifier === "string" ? child.props.identifier : undefined,
+ visibilityPriority: child.props.visibilityPriority as NativeStackHeaderVisibilityPriority,
};
}
@@ -277,6 +282,7 @@ function NativeHeaderToolbarButton(_props: {
readonly tintColor?: ColorValue;
readonly variant?: "plain" | "done" | "prominent";
readonly identifier?: string;
+ readonly visibilityPriority?: NativeStackHeaderVisibilityPriority;
}) {
return null;
}
diff --git a/apps/mobile/src/native/V5StackHeader.ios.tsx b/apps/mobile/src/native/V5StackHeader.ios.tsx
index e2a89fd28c4..c8af70a097b 100644
--- a/apps/mobile/src/native/V5StackHeader.ios.tsx
+++ b/apps/mobile/src/native/V5StackHeader.ios.tsx
@@ -128,6 +128,8 @@ function convertItems(items: NativeStackHeaderItem[], prefix: string): HeaderIte
axisBehavior: item.axisBehavior,
icon: convertIcon(item.icon),
onPress: item.disabled ? undefined : item.onPress,
+ visibilityPriority:
+ item.visibilityPriority === "default" ? "standard" : item.visibilityPriority,
variant: item.variant,
tintColor: item.tintColor,
hidesSharedBackground: item.hidesSharedBackground,
diff --git a/apps/mobile/src/native/createV5StackNavigator.ios.tsx b/apps/mobile/src/native/createV5StackNavigator.ios.tsx
index 6433ab50020..1c8cea90061 100644
--- a/apps/mobile/src/native/createV5StackNavigator.ios.tsx
+++ b/apps/mobile/src/native/createV5StackNavigator.ios.tsx
@@ -369,6 +369,7 @@ export function V5SheetStackView(props: V5StackViewProps) {
initialDetentIndex={options.sheetInitialDetentIndex}
largestUndimmedDetentIndex={options.sheetLargestUndimmedDetentIndex}
prefersGrabberVisible={options.sheetGrabberVisible}
+ prefersHorizontalBars={options.sheetPrefersHorizontalBars}
preferredCornerRadius={options.sheetCornerRadius}
prefersScrollingExpandsWhenScrolledToEdge={options.sheetExpandsWhenScrolledToEdge}
nativeContainerStyle={{
diff --git a/apps/mobile/src/native/sheet-surface.ts b/apps/mobile/src/native/sheet-surface.ts
index 7867b2b77e8..9de5943a008 100644
--- a/apps/mobile/src/native/sheet-surface.ts
+++ b/apps/mobile/src/native/sheet-surface.ts
@@ -1,3 +1,11 @@
-export const FORM_SHEET_PRESENTATION_OPTIONS = {
+import { Platform } from "react-native";
+
+export const HORIZONTAL_FORM_SHEET_OPTIONS = {
presentation: "formSheet" as const,
+ sheetPrefersHorizontalBars: true,
};
+
+export function formSheetDetents(initialDetent: number, androidExpandedDetent = 0.92) {
+ // Duo moves the status bar above the sheet only at the maximum native detent.
+ return [initialDetent, Platform.OS === "ios" ? 1 : androidExpandedDetent];
+}
diff --git a/patches/@react-navigation%[email protected] b/patches/@react-navigation%[email protected]
index d221ce6a875..3fc4b61604e 100644
--- a/patches/@react-navigation%[email protected]
+++ b/patches/@react-navigation%[email protected]
@@ -1,5 +1,5 @@
diff --git a/lib/module/views/NativeStackView.native.js b/lib/module/views/NativeStackView.native.js
-index 6882090..011ad0e 100644
+index 6882090..f1e14e1 100644
--- a/lib/module/views/NativeStackView.native.js
+++ b/lib/module/views/NativeStackView.native.js
@@ -17,8 +17,12 @@ const ANDROID_DEFAULT_HEADER_HEIGHT = 56;
@@ -15,7 +15,15 @@ index 6882090..011ad0e 100644
index,
focused,
shouldFreeze,
-@@ -305,7 +309,8 @@ const SceneView = /*#__PURE__*/React.memo(function SceneView({
+@@ -144,6 +148,7 @@ const SceneView = /*#__PURE__*/React.memo(function SceneView({
+ sheetAllowedDetents = [1.0],
+ sheetLargestUndimmedDetentIndex = -1,
+ sheetGrabberVisible = false,
++ sheetPrefersHorizontalBars = false,
+ sheetCornerRadius = -1.0,
+ sheetElevation = 24,
+ sheetExpandsWhenScrolledToEdge = true,
+@@ -305,7 +310,8 @@ const SceneView = /*#__PURE__*/React.memo(function SceneView({
}
}
});
@@ -25,7 +33,15 @@ index 6882090..011ad0e 100644
route: route,
navigation: navigation,
children: /*#__PURE__*/_jsx(ScreenStackItem, {
-@@ -427,6 +432,7 @@ const SceneView = /*#__PURE__*/React.memo(function SceneView({
+@@ -333,6 +339,7 @@ const SceneView = /*#__PURE__*/React.memo(function SceneView({
+ sheetAllowedDetents: sheetAllowedDetents,
+ sheetLargestUndimmedDetentIndex: sheetLargestUndimmedDetentIndex,
+ sheetGrabberVisible: sheetGrabberVisible,
++ sheetPrefersHorizontalBars: sheetPrefersHorizontalBars,
+ sheetInitialDetentIndex: sheetInitialDetentIndex,
+ sheetCornerRadius: sheetCornerRadius,
+ sheetElevation: sheetElevation,
+@@ -427,6 +434,7 @@ const SceneView = /*#__PURE__*/React.memo(function SceneView({
});
});
export function NativeStackView({
@@ -33,7 +49,7 @@ index 6882090..011ad0e 100644
state,
navigation,
descriptors,
-@@ -444,6 +450,17 @@ export function NativeStackView({
+@@ -444,6 +452,17 @@ export function NativeStackView({
return /*#__PURE__*/_jsx(SafeAreaProviderCompat, {
children: /*#__PURE__*/_jsx(ScreenStack, {
style: styles.container,
@@ -51,7 +67,7 @@ index 6882090..011ad0e 100644
children: state.routes.concat(state.preloadedRoutes).map((route, index) => {
const descriptor = descriptors[route.key] ?? preloadedDescriptors[route.key];
const isFocused = state.index === index;
-@@ -460,6 +477,7 @@ export function NativeStackView({
+@@ -460,6 +479,7 @@ export function NativeStackView({
// due to component being unmounted. To avoid this, we don't freeze the previous screen there
const shouldFreeze = isFabric() ? !isPreloaded && !isFocused && !isBelowFocused && !isModalOnIos : !isPreloaded && !isFocused && !isModalOnIos;
return /*#__PURE__*/_jsx(SceneView, {
@@ -60,7 +76,7 @@ index 6882090..011ad0e 100644
focused: isFocused,
shouldFreeze: shouldFreeze,
diff --git a/lib/module/views/useHeaderConfigProps.js b/lib/module/views/useHeaderConfigProps.js
-index 08055b2..8718847 100644
+index 08055b2..ccf1fde 100644
--- a/lib/module/views/useHeaderConfigProps.js
+++ b/lib/module/views/useHeaderConfigProps.js
@@ -18,6 +18,12 @@ const processBarButtonItems = (items, colors, fonts) => {
@@ -174,10 +190,19 @@ index 08055b2..8718847 100644
headerRightBarButtonItems: processBarButtonItems(rightItems, colors, fonts),
experimental_userInterfaceStyle: dark ? 'dark' : 'light'
diff --git a/lib/typescript/src/types.d.ts b/lib/typescript/src/types.d.ts
-index 27a3d8e..3adf86e 100644
+index 27a3d8e..7312e4e 100644
--- a/lib/typescript/src/types.d.ts
+++ b/lib/typescript/src/types.d.ts
-@@ -903,6 +903,8 @@ type SharedHeaderItem = {
+@@ -694,6 +694,8 @@ export type NativeStackNavigationOptions = {
+ * @platform ios
+ */
+ sheetGrabberVisible?: boolean;
++ /** Requests horizontal bars on iOS 27.1+. Defaults to UIKit automatic placement. */
++ sheetPrefersHorizontalBars?: boolean;
+ /**
+ * The largest sheet detent for which a view underneath won't be dimmed.
+ * Works only when `presentation` is set to `formSheet`.
+@@ -903,6 +905,8 @@ type SharedHeaderItem = {
* Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground
*/
sharesBackground?: boolean;
@@ -186,7 +211,7 @@ index 27a3d8e..3adf86e 100644
/**
* An identifier used to match items across transitions.
* Only available from iOS 26.0 and later.
-@@ -1148,6 +1150,13 @@ export type NativeStackHeaderItemSpacing = {
+@@ -1148,6 +1152,13 @@ export type NativeStackHeaderItemSpacing = {
*/
export type NativeStackHeaderItemCustom = {
type: 'custom';
@@ -232,10 +257,19 @@ index d533cd9..857b7ad 100644
//# sourceMappingURL=NativeStackView.native.d.ts.map
\ No newline at end of file
diff --git a/src/types.tsx b/src/types.tsx
-index 5d63f41..e9c53ee 100644
+index 5d63f41..f949a11 100644
--- a/src/types.tsx
+++ b/src/types.tsx
-@@ -959,6 +959,8 @@ type SharedHeaderItem = {
+@@ -746,6 +746,8 @@ export type NativeStackNavigationOptions = {
+ * @platform ios
+ */
+ sheetGrabberVisible?: boolean;
++ /** Requests horizontal bars on iOS 27.1+. Defaults to UIKit automatic placement. */
++ sheetPrefersHorizontalBars?: boolean;
+ /**
+ * The largest sheet detent for which a view underneath won't be dimmed.
+ * Works only when `presentation` is set to `formSheet`.
+@@ -959,6 +961,8 @@ type SharedHeaderItem = {
* Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground
*/
sharesBackground?: boolean;
@@ -244,7 +278,7 @@ index 5d63f41..e9c53ee 100644
/**
* An identifier used to match items across transitions.
* Only available from iOS 26.0 and later.
-@@ -1213,6 +1215,13 @@ export type NativeStackHeaderItemSpacing = {
+@@ -1213,6 +1217,13 @@ export type NativeStackHeaderItemSpacing = {
*/
export type NativeStackHeaderItemCustom = {
type: 'custom';
@@ -259,7 +293,7 @@ index 5d63f41..e9c53ee 100644
* A React Element to display as the item.
*/
diff --git a/src/views/NativeStackView.native.tsx b/src/views/NativeStackView.native.tsx
-index aa13bc7..ab4a9d1 100644
+index aa13bc7..225daf9 100644
--- a/src/views/NativeStackView.native.tsx
+++ b/src/views/NativeStackView.native.tsx
@@ -52,7 +52,14 @@ function isFabric() {
@@ -285,7 +319,15 @@ index aa13bc7..ab4a9d1 100644
index,
focused,
shouldFreeze,
-@@ -434,7 +442,7 @@ const SceneView = React.memo(function SceneView({
+@@ -199,6 +207,7 @@ const SceneView = React.memo(function SceneView({
+ sheetAllowedDetents = [1.0],
+ sheetLargestUndimmedDetentIndex = -1,
+ sheetGrabberVisible = false,
++ sheetPrefersHorizontalBars = false,
+ sheetCornerRadius = -1.0,
+ sheetElevation = 24,
+ sheetExpandsWhenScrolledToEdge = true,
+@@ -434,7 +443,7 @@ const SceneView = React.memo(function SceneView({
);
return (
@@ -294,7 +336,15 @@ index aa13bc7..ab4a9d1 100644
<ScreenStackItem
screenId={route.key}
activityState={isPreloaded ? 0 : 2}
-@@ -571,11 +579,12 @@ const SceneView = React.memo(function SceneView({
+@@ -463,6 +472,7 @@ const SceneView = React.memo(function SceneView({
+ sheetAllowedDetents={sheetAllowedDetents}
+ sheetLargestUndimmedDetentIndex={sheetLargestUndimmedDetentIndex}
+ sheetGrabberVisible={sheetGrabberVisible}
++ sheetPrefersHorizontalBars={sheetPrefersHorizontalBars}
+ sheetInitialDetentIndex={sheetInitialDetentIndex}
+ sheetCornerRadius={sheetCornerRadius}
+ sheetElevation={sheetElevation}
+@@ -571,11 +581,12 @@ const SceneView = React.memo(function SceneView({
</HeaderHeightContext.Provider>
</AnimatedHeaderHeightContext.Provider>
</ScreenStackItem>
@@ -308,7 +358,7 @@ index aa13bc7..ab4a9d1 100644
state: StackNavigationState<ParamListBase>;
navigation: NativeStackNavigationHelpers;
descriptors: NativeStackDescriptorMap;
-@@ -586,6 +595,7 @@ type Props = {
+@@ -586,6 +597,7 @@ type Props = {
};
export function NativeStackView({
@@ -316,7 +366,7 @@ index aa13bc7..ab4a9d1 100644
state,
navigation,
descriptors,
-@@ -633,6 +643,7 @@ export function NativeStackView({
+@@ -633,6 +645,7 @@ export function NativeStackView({
return (
<SceneView
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index aa6842a9c8b..475ae274e25 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -337,7 +337,7 @@ patchedDependencies:
'@pierre/[email protected]': 2ec81ba1e8ce4681095a3473c2bf78e630417740c622720ef624febb467c25fc
'@react-native-ai/[email protected]': 2d09870c2848d185cb05b53ed823a46e12dba519324d8dd8e584e28731990f9d
'@react-native-menu/[email protected]': a4866ecfcd44f318043de839d20110c17e14909004900f002ffe12050376f2ba
- '@react-navigation/[email protected]': caae6552051bce91a85f567f3a08f9c8d25ce4c53f65a9391a67f016bb1d798e
+ '@react-navigation/[email protected]': 990d575444c4af2ce8218b3b7a8280fe244c03abbdb32b822a2e862f791dbf42
[email protected]: bea1b6c0c0b23157fd5f439a1d7feff430f28ac1621ba135d8a13eeec60ccacd
[email protected]: a28c2dfcfc2b90d6c6247e199e6537391db9ecd941854c650910d607442512d3
[email protected]: cfff57561b0ee59b5addb3b2e6c6f20906e967507a530ab67e8db8108e520ba4
@@ -542,7 +542,7 @@ importers:
'@react-navigation/native-stack':
specifier: 7.21.0
- version: 7.21.0(patch_hash=caae6552051bce91a85f567f3a08f9c8d25ce4c53f65a9391a67f016bb1d798e)(45e036a3bd680d99803578d5030f7a06)
+ version: 7.21.0(patch_hash=990d575444c4af2ce8218b3b7a8280fe244c03abbdb32b822a2e862f791dbf42)(45e036a3bd680d99803578d5030f7a06)
'@shikijs/core':
specifier: 4.2.0
version: 4.2.0
@@ -15967,7 +15967,7 @@ snapshots:
optionalDependencies:
- '@react-navigation/[email protected](patch_hash=caae6552051bce91a85f567f3a08f9c8d25ce4c53f65a9391a67f016bb1d798e)(45e036a3bd680d99803578d5030f7a06)':
+ '@react-navigation/[email protected](patch_hash=990d575444c4af2ce8218b3b7a8280fe244c03abbdb32b822a2e862f791dbf42)(45e036a3bd680d99803578d5030f7a06)':
dependencies:
'@react-navigation/elements': 2.9.45(d8845bac868f4d8a58c8a8f12ad0d4a5)