Skip to content

Commit 328dc27

Browse files
authored
fix(mobile): add compose to the single-column iPad list (pingdotgg#18157)
1 parent 4946602 commit 328dc27

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

‎apps/mobile/src/features/home/HomeHeader.tsx‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ export type { HomeHeaderEnvironment } from "./HomeHeader.types";
1919

2020
export function HomeHeader(props: HomeHeaderProps) {
2121
const navigation = useNavigation<NativeStackNavigationProp<ParamListBase>>();
22-
const { panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();
22+
const { layout, panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();
2323
const usesNativeMailSearchToolbar = useNativeMailSearchToolbar();
2424
const primaryColumn = use(NativePrimaryColumnContext);
2525
const sidebarHeader =
2626
Platform.OS === "ios" &&
2727
primaryColumn !== null &&
2828
(Platform.isPad || !usesNativeMailSearchToolbar);
29+
const showsCompactCompose = Platform.OS === "ios" && Platform.isPad && !layout.usesSplitView;
2930
const searchBarRef = useRef<SearchBarCommands>(null);
3031
const focusAfterReveal = useRef(false);
3132
useEffect(
@@ -59,20 +60,35 @@ export function HomeHeader(props: HomeHeaderProps) {
5960
return (
6061
<>
6162
<NativeStackScreenOptions
62-
optionsVersion={filterMenu.items}
63+
optionsVersion={[filterMenu.items, showsCompactCompose]}
6364
options={{
6465
// Static header config (glass, title, fonts) lives in Stack.tsx
6566
// (GLASS_HEADER_OPTIONS). Only dynamic values are set here.
6667
headerTintColor: iconColor,
6768
unstable_headerRightItems: () =>
6869
sidebarHeader
69-
? createSidebarHeaderItems({
70-
filterIcon: hasCustomListOptions
71-
? "line.3.horizontal.decrease.circle.fill"
72-
: "line.3.horizontal.decrease.circle",
73-
filterMenu,
74-
onOpenSettings: props.onOpenSettings,
75-
})
70+
? [
71+
...createSidebarHeaderItems({
72+
filterIcon: hasCustomListOptions
73+
? "line.3.horizontal.decrease.circle.fill"
74+
: "line.3.horizontal.decrease.circle",
75+
filterMenu,
76+
onOpenSettings: props.onOpenSettings,
77+
}),
78+
...(showsCompactCompose
79+
? [
80+
withNativeGlassHeaderItem({
81+
accessibilityLabel: "New task",
82+
axisBehavior: "horizontalOnly",
83+
icon: { name: "square.and.pencil", type: "sfSymbol" } as const,
84+
identifier: "home-new-task",
85+
label: "",
86+
onPress: props.onStartNewTask,
87+
type: "button",
88+
}),
89+
]
90+
: []),
91+
]
7692
: [
7793
withNativeGlassHeaderItem({
7894
accessibilityLabel: "Open settings",

0 commit comments

Comments
 (0)