TypeScript
fix(mobile): add compose to the single-column iPad list (#18157)
Alex328dc27d63dd
diff --git a/apps/mobile/src/features/home/HomeHeader.tsx b/apps/mobile/src/features/home/HomeHeader.tsxindex 5dfe5ebc66a..2dab3868e2c 100644--- a/apps/mobile/src/features/home/HomeHeader.tsx+++ b/apps/mobile/src/features/home/HomeHeader.tsx@@ -19,13 +19,14 @@ export type { HomeHeaderEnvironment } from "./HomeHeader.types";export function HomeHeader(props: HomeHeaderProps) {const navigation = useNavigation<NativeStackNavigationProp<ParamListBase>>();- const { panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();+ const { layout, panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();const usesNativeMailSearchToolbar = useNativeMailSearchToolbar();const primaryColumn = use(NativePrimaryColumnContext);const sidebarHeader =Platform.OS === "ios" &&primaryColumn !== null &&(Platform.isPad || !usesNativeMailSearchToolbar);+ const showsCompactCompose = Platform.OS === "ios" && Platform.isPad && !layout.usesSplitView;const searchBarRef = useRef<SearchBarCommands>(null);const focusAfterReveal = useRef(false);useEffect(@@ -59,20 +60,35 @@ export function HomeHeader(props: HomeHeaderProps) {return (<><NativeStackScreenOptions- optionsVersion={filterMenu.items}+ optionsVersion={[filterMenu.items, showsCompactCompose]}options={{// Static header config (glass, title, fonts) lives in Stack.tsx// (GLASS_HEADER_OPTIONS). Only dynamic values are set here.headerTintColor: iconColor,unstable_headerRightItems: () =>sidebarHeader- ? createSidebarHeaderItems({- filterIcon: hasCustomListOptions- ? "line.3.horizontal.decrease.circle.fill"- : "line.3.horizontal.decrease.circle",- filterMenu,- onOpenSettings: props.onOpenSettings,- })+ ? [+ ...createSidebarHeaderItems({+ filterIcon: hasCustomListOptions+ ? "line.3.horizontal.decrease.circle.fill"+ : "line.3.horizontal.decrease.circle",+ filterMenu,+ onOpenSettings: props.onOpenSettings,+ }),+ ...(showsCompactCompose+ ? [+ withNativeGlassHeaderItem({+ accessibilityLabel: "New task",+ axisBehavior: "horizontalOnly",+ icon: { name: "square.and.pencil", type: "sfSymbol" } as const,+ identifier: "home-new-task",+ label: "",+ onPress: props.onStartNewTask,+ type: "button",+ }),+ ]+ : []),+ ]: [withNativeGlassHeaderItem({accessibilityLabel: "Open settings",