Skip to content
TypeScript

refactor(mobile): unify navigation and floating toolbar APIs (#20002)

Julius Marmingefbbd4596e429
diff --git a/apps/mobile/src/components/AppBar.tsx b/apps/mobile/src/components/AppBar.tsx
index 36a3659098c..977270431ec 100644
--- a/apps/mobile/src/components/AppBar.tsx
+++ b/apps/mobile/src/components/AppBar.tsx
@@ -1,10 +1,11 @@
+import { Toolbar } from "./Toolbar";
import { AppActivityIndicator } from "./AppActivityIndicator";
import type { HeaderBarButtonMailSearchToolbarItem } from "react-native-screens";
import { useId } from "react";
import { Platform, View } from "react-native";
import { createNativeHeaderMenu } from "./nativeHeaderMenu.ios";
import { ScreenHeaderButton } from "./ScreenHeaderButton";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../native/StackHeader";
+import { NativeStackScreenOptions } from "../native/StackHeader";
import { useNativeWorkspaceColumnsSupported } from "../native/NativeWorkspaceColumns";
import { useAdaptiveWorkspaceLayout } from "../features/layout/AdaptiveWorkspaceLayout";
import {
@@ -114,7 +115,7 @@ export function AppBar(props: AppBarProps) {
}}
/>
{layout.usesSplitView && (props.sidebar !== false || props.backInSplitView) ? (
- <NativeHeaderToolbar placement="left">
+ <Toolbar placement="left">
{props.backInSplitView && (props.backInSplitView.onPress || props.onBack) ? (
<ScreenHeaderButton
{...props.backInSplitView}
@@ -141,24 +142,24 @@ export function AppBar(props: AppBarProps) {
}
/>
) : null}
- </NativeHeaderToolbar>
+ </Toolbar>
) : null}
{(props.actions?.length ||
(!compactSearch && refresh) ||
visibleMenus.length ||
props.trailing) &&
props.options?.unstable_headerRightItems === undefined ? (
- <NativeHeaderToolbar placement="right">
+ <Toolbar placement="right">
{props.actions?.map(({ loading, ...action }) =>
loading ? (
- <NativeHeaderToolbar.Custom key={action.accessibilityLabel}>
+ <Toolbar.Custom key={action.accessibilityLabel}>
<View
accessibilityLabel={action.accessibilityLabel}
className="size-9 items-center justify-center"
>
<AppActivityIndicator color={action.tintColor} />
</View>
- </NativeHeaderToolbar.Custom>
+ </Toolbar.Custom>
) : (
<ScreenHeaderButton
key={action.accessibilityLabel}
@@ -178,7 +179,7 @@ export function AppBar(props: AppBarProps) {
) : null}
{visibleMenus.map(createNativeHeaderMenu)}
{props.trailing}
- </NativeHeaderToolbar>
+ </Toolbar>
) : null}
</>
);
diff --git a/apps/mobile/src/components/ScreenHeaderButton.tsx b/apps/mobile/src/components/ScreenHeaderButton.tsx
index 929a2e9f62e..470b252a3cc 100644
--- a/apps/mobile/src/components/ScreenHeaderButton.tsx
+++ b/apps/mobile/src/components/ScreenHeaderButton.tsx
@@ -1,4 +1,5 @@
-import { NativeHeaderToolbar } from "../native/StackHeader";
+import { Toolbar } from "./Toolbar";
+
export const ScreenHeaderButton: (
- props: Parameters<typeof NativeHeaderToolbar.Button>[0] & { readonly selected?: boolean },
-) => ReturnType<typeof NativeHeaderToolbar.Button> = NativeHeaderToolbar.Button;
+ props: Parameters<typeof Toolbar.Button>[0] & { readonly selected?: boolean },
+) => ReturnType<typeof Toolbar.Button> = Toolbar.Button;
diff --git a/apps/mobile/src/components/Toolbar.android.tsx b/apps/mobile/src/components/Toolbar.android.tsx
index 72a9dd1d833..d3d96b0deaa 100644
--- a/apps/mobile/src/components/Toolbar.android.tsx
+++ b/apps/mobile/src/components/Toolbar.android.tsx
@@ -1,3 +1,4 @@
+import { NativeHeaderToolbar } from "../native/NativeHeaderToolbar";
import { NativeThemeHost } from "./NativeThemeHost.android";
import { HorizontalFloatingToolbar, RNHostView } from "@expo/ui/jetpack-compose";
import type { ToolbarProps } from "./Toolbar.types";
@@ -5,8 +6,9 @@ import type { ToolbarProps } from "./Toolbar.types";
import { useControlTheme } from "./useControlTheme";
/** Native toolbar surface; hosted RN controls retain their existing menus and accessibility. */
-export function Toolbar(props: ToolbarProps) {
+function ToolbarRoot(props: ToolbarProps) {
const { colors } = useControlTheme();
+ if (props.placement) return <NativeHeaderToolbar {...props} />;
return (
<NativeThemeHost
matchContents
@@ -24,3 +26,13 @@ export function Toolbar(props: ToolbarProps) {
</NativeThemeHost>
);
}
+
+export const Toolbar = Object.assign(ToolbarRoot, {
+ Button: NativeHeaderToolbar.Button,
+ Custom: NativeHeaderToolbar.Custom,
+ Label: NativeHeaderToolbar.Label,
+ Menu: NativeHeaderToolbar.Menu,
+ MenuAction: NativeHeaderToolbar.MenuAction,
+ SearchBarSlot: NativeHeaderToolbar.SearchBarSlot,
+ Spacer: NativeHeaderToolbar.Spacer,
+});
diff --git a/apps/mobile/src/components/Toolbar.tsx b/apps/mobile/src/components/Toolbar.tsx
index 40f41357279..f9c28e83fb9 100644
--- a/apps/mobile/src/components/Toolbar.tsx
+++ b/apps/mobile/src/components/Toolbar.tsx
@@ -1,5 +1,22 @@
+import { GlassContainer } from "expo-glass-effect";
+import { NativeHeaderToolbar } from "../native/NativeHeaderToolbar";
import type { ToolbarProps } from "./Toolbar.types";
-export function Toolbar(props: ToolbarProps) {
- return props.children;
+function ToolbarRoot(props: ToolbarProps) {
+ if (props.placement) return <NativeHeaderToolbar {...props} />;
+ return (
+ <GlassContainer style={{ flexDirection: "row", alignItems: "center" }}>
+ {props.children}
+ </GlassContainer>
+ );
}
+
+export const Toolbar = Object.assign(ToolbarRoot, {
+ Button: NativeHeaderToolbar.Button,
+ Custom: NativeHeaderToolbar.Custom,
+ Label: NativeHeaderToolbar.Label,
+ Menu: NativeHeaderToolbar.Menu,
+ MenuAction: NativeHeaderToolbar.MenuAction,
+ SearchBarSlot: NativeHeaderToolbar.SearchBarSlot,
+ Spacer: NativeHeaderToolbar.Spacer,
+});
diff --git a/apps/mobile/src/components/Toolbar.types.ts b/apps/mobile/src/components/Toolbar.types.ts
index 8f6ea11aa8f..600e0e185e8 100644
--- a/apps/mobile/src/components/Toolbar.types.ts
+++ b/apps/mobile/src/components/Toolbar.types.ts
@@ -1,6 +1,6 @@
-import type { ReactElement } from "react";
+import type { ReactElement, ReactNode } from "react";
-/** Native floating action group. Its owner supplies placement and action content. */
-export interface ToolbarProps {
- readonly children: ReactElement;
-}
+/** Navigation toolbars attach to the current screen; floating groups stay in layout. */
+export type ToolbarProps =
+ | { readonly placement: "left" | "right" | "bottom"; readonly children?: ReactNode }
+ | { readonly placement?: undefined; readonly children: ReactElement };
diff --git a/apps/mobile/src/components/nativeHeaderMenu.ios.tsx b/apps/mobile/src/components/nativeHeaderMenu.ios.tsx
index b441139b8c8..ee7e8cc56bf 100644
--- a/apps/mobile/src/components/nativeHeaderMenu.ios.tsx
+++ b/apps/mobile/src/components/nativeHeaderMenu.ios.tsx
@@ -1,19 +1,15 @@
-import { NativeHeaderToolbar } from "../native/StackHeader";
+import { Toolbar } from "./Toolbar";
+
import type { AppBarMenu, AppBarMenuItem } from "./AppBar.types";
function renderMenuItems(items: ReadonlyArray<AppBarMenuItem>) {
return items.map((item) =>
"items" in item ? (
- <NativeHeaderToolbar.Menu
- key={item.id}
- title={item.title}
- icon={item.icon}
- inline={item.inline}
- >
+ <Toolbar.Menu key={item.id} title={item.title} icon={item.icon} inline={item.inline}>
{renderMenuItems(item.items)}
- </NativeHeaderToolbar.Menu>
+ </Toolbar.Menu>
) : (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={item.id}
icon={item.icon}
subtitle={item.subtitle}
@@ -22,7 +18,7 @@ function renderMenuItems(items: ReadonlyArray<AppBarMenuItem>) {
onPress={item.onPress}
>
{item.title}
- </NativeHeaderToolbar.MenuAction>
+ </Toolbar.MenuAction>
),
);
}
@@ -30,15 +26,15 @@ function renderMenuItems(items: ReadonlyArray<AppBarMenuItem>) {
/** Returns direct native items for toolbar serialization, including nested menu data. */
export function createNativeHeaderMenu(menu: AppBarMenu) {
return (
- <NativeHeaderToolbar.Menu
+ <Toolbar.Menu
key={menu.title}
title={menu.title}
accessibilityLabel={menu.title}
icon={typeof menu.icon === "string" ? menu.icon : menu.icon.ios}
separateBackground={menu.separateBackground ?? true}
>
- {menu.status ? <NativeHeaderToolbar.Label>{menu.status}</NativeHeaderToolbar.Label> : null}
+ {menu.status ? <Toolbar.Label>{menu.status}</Toolbar.Label> : null}
{renderMenuItems(menu.items)}
- </NativeHeaderToolbar.Menu>
+ </Toolbar.Menu>
);
}
diff --git a/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx b/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
index 97571294857..467ff3767f9 100644
--- a/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
+++ b/apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
import * as Dialog from "../../components/Dialog";
import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";
@@ -15,7 +16,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { ControlPill } from "../../components/ControlPill";
import { AppBar } from "../../components/AppBar";
-import { NativeHeaderToolbar } from "../../native/StackHeader";
+
import { useThreadServerBrowserTabs } from "../../state/preview";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
import { BrowserTabMenu } from "./BrowserTabMenu";
@@ -159,14 +160,14 @@ function BrowserPreviewScreen({
}
/>
{Platform.OS === "ios" ? (
- <NativeHeaderToolbar placement="left">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="left">
+ <Toolbar.Button
icon="xmark"
accessibilityLabel="Close browser"
onPress={onClose}
separateBackground
/>
- </NativeHeaderToolbar>
+ </Toolbar>
) : null}
{tab ? (
<>
diff --git a/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx b/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
index 7987e8ff6d6..f6dc4d9edfd 100644
--- a/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
+++ b/apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
@@ -1,5 +1,6 @@
+import { Toolbar } from "../../components/Toolbar";
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
-import { NativeHeaderToolbar } from "../../native/StackHeader";
+
import { useAuth } from "@clerk/expo";
import { StackActions, useNavigation } from "@react-navigation/native";
import { useCallback, useEffect, useState } from "react";
@@ -99,9 +100,9 @@ function ConfiguredConnectOnboardingRouteScreen() {
]}
/>
) : (
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Button icon="xmark" onPress={handleClose} separateBackground />
- </NativeHeaderToolbar>
+ <Toolbar placement="right">
+ <Toolbar.Button icon="xmark" onPress={handleClose} separateBackground />
+ </Toolbar>
)}
<ScrollView
nestedScrollEnabled
diff --git a/apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx b/apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx
index 1e7f128ed43..bf5a371e57a 100644
--- a/apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx
+++ b/apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx
@@ -1,5 +1,6 @@
+import { Toolbar } from "../../components/Toolbar";
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
-import { NativeHeaderToolbar } from "../../native/StackHeader";
+
import { useNavigation } from "@react-navigation/native";
import type { EnvironmentId } from "@t3tools/contracts";
import { useCallback, useState } from "react";
@@ -41,13 +42,13 @@ export function ConnectionsRouteScreen() {
]}
/>
) : (
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="right">
+ <Toolbar.Button
icon="plus"
onPress={() => navigation.navigate("ConnectionsNew")}
separateBackground
/>
- </NativeHeaderToolbar>
+ </Toolbar>
)}
<ScrollView
contentInsetAdjustmentBehavior="automatic"
diff --git a/apps/mobile/src/features/files/AttachmentFileScreen.tsx b/apps/mobile/src/features/files/AttachmentFileScreen.tsx
index 2c80d038c1a..015d35477d6 100644
--- a/apps/mobile/src/features/files/AttachmentFileScreen.tsx
+++ b/apps/mobile/src/features/files/AttachmentFileScreen.tsx
@@ -1,6 +1,7 @@
+import { Toolbar } from "../../components/Toolbar";
import * as Dialog from "../../components/Dialog";
/* oxlint-disable react/no-array-index-key -- Captured table rows and columns have stable positions and may contain identical values. */
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
import type { MenuAction } from "@react-native-menu/menu";
import { EnvironmentId } from "@t3tools/contracts";
@@ -380,38 +381,38 @@ export function AttachmentFileScreen(props: AttachmentFileScreenProps) {
}
/>
) : null}
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Menu accessibilityLabel="File actions" icon="ellipsis">
+ <Toolbar placement="right">
+ <Toolbar.Menu accessibilityLabel="File actions" icon="ellipsis">
{renderedMode ? (
- <NativeHeaderToolbar.Menu inline>
+ <Toolbar.Menu inline>
{menuActions
.filter(({ inline }) => inline)
.map((action) => (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={action.id}
icon={action.icon}
isOn={action.id === selectedAction}
onPress={action.onPress}
>
{action.title}
- </NativeHeaderToolbar.MenuAction>
+ </Toolbar.MenuAction>
))}
- </NativeHeaderToolbar.Menu>
+ </Toolbar.Menu>
) : null}
{menuActions
.filter(({ inline }) => !inline)
.map((action) => (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={action.id}
icon={action.icon}
destructive={"destructive" in action}
onPress={action.onPress}
>
{action.title}
- </NativeHeaderToolbar.MenuAction>
+ </Toolbar.MenuAction>
))}
- </NativeHeaderToolbar.Menu>
- </NativeHeaderToolbar>
+ </Toolbar.Menu>
+ </Toolbar>
<AttachmentDocumentBody
document={document}
name={params.name}
diff --git a/apps/mobile/src/features/home/HomeHeader.tsx b/apps/mobile/src/features/home/HomeHeader.tsx
index 5c5d2a5a385..2c4ee6ddc59 100644
--- a/apps/mobile/src/features/home/HomeHeader.tsx
+++ b/apps/mobile/src/features/home/HomeHeader.tsx
@@ -1,4 +1,5 @@
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { Toolbar } from "../../components/Toolbar";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { use, useCallback, useEffect, useRef } from "react";
import { useNavigation, type ParamListBase } from "@react-navigation/native";
import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
@@ -104,7 +105,7 @@ export function HomeHeader(props: HomeHeaderProps) {
}),
],
// The keys below are set per-branch (not `undefined`) so a later
- // reapply cannot clobber options owned by NativeHeaderToolbar.
+ // reapply cannot clobber options owned by Toolbar.
...(sidebarHeader
? {
headerSearchBarOptions: {
@@ -165,8 +166,8 @@ export function HomeHeader(props: HomeHeaderProps) {
/>
{sidebarHeader || usesNativeMailSearchToolbar ? null : (
- <NativeHeaderToolbar placement="bottom">
- <NativeHeaderToolbar.Menu
+ <Toolbar placement="bottom">
+ <Toolbar.Menu
accessibilityLabel="Filter threads"
icon={
hasCustomListOptions
@@ -176,56 +177,56 @@ export function HomeHeader(props: HomeHeaderProps) {
title="Thread list options"
separateBackground
>
- <NativeHeaderToolbar.Menu title="Environment">
- <NativeHeaderToolbar.Label>Environment</NativeHeaderToolbar.Label>
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.Menu title="Environment">
+ <Toolbar.Label>Environment</Toolbar.Label>
+ <Toolbar.MenuAction
isOn={props.selectedEnvironmentId === null}
onPress={() => props.onEnvironmentChange(null)}
subtitle="Show threads from every environment"
>
- <NativeHeaderToolbar.Label>All environments</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>All environments</Toolbar.Label>
+ </Toolbar.MenuAction>
{props.environments.map((environment) => (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={environment.environmentId}
isOn={props.selectedEnvironmentId === environment.environmentId}
onPress={() => props.onEnvironmentChange(environment.environmentId)}
>
- <NativeHeaderToolbar.Label>{environment.label}</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>{environment.label}</Toolbar.Label>
+ </Toolbar.MenuAction>
))}
- </NativeHeaderToolbar.Menu>
+ </Toolbar.Menu>
{props.projects.length > 0 ? (
- <NativeHeaderToolbar.Menu title="Project">
- <NativeHeaderToolbar.Label>Project</NativeHeaderToolbar.Label>
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.Menu title="Project">
+ <Toolbar.Label>Project</Toolbar.Label>
+ <Toolbar.MenuAction
isOn={props.selectedProjectKey === null}
onPress={() => props.onProjectChange(null)}
subtitle="Show threads from every project"
>
- <NativeHeaderToolbar.Label>All projects</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>All projects</Toolbar.Label>
+ </Toolbar.MenuAction>
{props.projects.map((project) => (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={project.key}
isOn={props.selectedProjectKey === project.key}
onPress={() => props.onProjectChange(project.key)}
>
- <NativeHeaderToolbar.Label>{project.label}</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>{project.label}</Toolbar.Label>
+ </Toolbar.MenuAction>
))}
- </NativeHeaderToolbar.Menu>
+ </Toolbar.Menu>
) : null}
- </NativeHeaderToolbar.Menu>
- <NativeHeaderToolbar.Spacer flexible />
- <NativeHeaderToolbar.Button
+ </Toolbar.Menu>
+ <Toolbar.Spacer flexible />
+ <Toolbar.Button
accessibilityLabel="New task"
icon="square.and.pencil"
onPress={props.onStartNewTask}
separateBackground
/>
- </NativeHeaderToolbar>
+ </Toolbar>
)}
</>
);
diff --git a/apps/mobile/src/features/home/HomeRouteScreen.tsx b/apps/mobile/src/features/home/HomeRouteScreen.tsx
index 8ce82e95182..4fc5f604caa 100644
--- a/apps/mobile/src/features/home/HomeRouteScreen.tsx
+++ b/apps/mobile/src/features/home/HomeRouteScreen.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import { use } from "react";
import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
import * as Arr from "effect/Array";
@@ -9,7 +10,7 @@ import { Platform, useWindowDimensions } from "react-native";
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import { resolveScratchProjectScopeKey } from "@t3tools/client-runtime/state/project-grouping";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { useProjects } from "../../state/entities";
import { environmentThreadShells } from "../../state/threads";
import { usePendingNewTasks } from "../../state/use-pending-new-tasks";
@@ -176,13 +177,13 @@ export function HomeRouteScreen() {
}
/>
{Platform.OS === "ios" ? (
- <NativeHeaderToolbar placement="left">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="left">
+ <Toolbar.Button
accessibilityLabel="New task"
icon="square.and.pencil"
onPress={() => navigation.navigate("NewTaskSheet", { screen: "NewTask" })}
/>
- </NativeHeaderToolbar>
+ </Toolbar>
) : null}
{Platform.OS === "android" ? <AndroidScreenHeader title="Threads" /> : null}
<WorkspaceEmptyDetail
diff --git a/apps/mobile/src/features/pull-requests/PullRequestControls.tsx b/apps/mobile/src/features/pull-requests/PullRequestControls.tsx
index 4421ce9c726..fdfdab4d6f0 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestControls.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestControls.tsx
@@ -11,7 +11,7 @@ import { Button } from "../../components/Button";
import { IconButton } from "../../components/IconButton";
import { Toolbar } from "../../components/Toolbar";
import { Menu } from "../../components/Menu";
-import { NativeHeaderToolbar } from "../../native/StackHeader";
+
import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
import { type PullRequestParams } from "./usePullRequestDiff";
import { usePullRequestPermissions } from "./usePullRequestPermissions";
@@ -190,19 +190,19 @@ export function PullRequestActionToolbar(props: {
);
}
const nativeThreadItems = threadMenuItems.map((item) => (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={item.id}
icon={item.image}
subtitle={"subtitle" in item ? item.subtitle : undefined}
disabled={"attributes" in item && item.attributes.disabled}
onPress={() => agent.select(item.id)}
>
- <NativeHeaderToolbar.Label>{item.title}</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>{item.title}</Toolbar.Label>
+ </Toolbar.MenuAction>
));
const primaryControl = showPrimary ? (
!pendingReview && chooseThread ? (
- <NativeHeaderToolbar.Menu
+ <Toolbar.Menu
identifier="pull-request-primary-action"
title={primaryLabel}
accessibilityLabel={primaryLabel}
@@ -219,9 +219,9 @@ export function PullRequestActionToolbar(props: {
separateBackground
>
{nativeThreadItems}
- </NativeHeaderToolbar.Menu>
+ </Toolbar.Menu>
) : (
- <NativeHeaderToolbar.Button
+ <Toolbar.Button
identifier="pull-request-primary-action"
label={primaryLabel}
accessibilityLabel={primaryLabel}
@@ -241,7 +241,7 @@ export function PullRequestActionToolbar(props: {
)
) : null;
const agentControl = showAgentControls ? (
- <NativeHeaderToolbar.Menu
+ <Toolbar.Menu
identifier="pull-request-agent"
icon="sparkles"
title="AI helpers"
@@ -251,35 +251,35 @@ export function PullRequestActionToolbar(props: {
>
{agentActions.map((action) =>
chooseThread && !action.disabled ? (
- <NativeHeaderToolbar.Menu key={action.task} title={action.title} icon={action.icon}>
+ <Toolbar.Menu key={action.task} title={action.title} icon={action.icon}>
{agent.threadActions(action.task).map((item) => (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={item.id}
icon={item.image}
subtitle={"subtitle" in item ? item.subtitle : undefined}
disabled={"attributes" in item && item.attributes.disabled}
onPress={() => agent.select(item.id)}
>
- <NativeHeaderToolbar.Label>{item.title}</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>{item.title}</Toolbar.Label>
+ </Toolbar.MenuAction>
))}
- </NativeHeaderToolbar.Menu>
+ </Toolbar.Menu>
) : (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={action.task}
icon={action.icon}
disabled={action.disabled}
onPress={() => agent.start(action.task)}
>
- <NativeHeaderToolbar.Label>{action.title}</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>{action.title}</Toolbar.Label>
+ </Toolbar.MenuAction>
),
)}
- </NativeHeaderToolbar.Menu>
+ </Toolbar.Menu>
) : null;
// Tabler file-diff geometry, rasterized at 1x/2x/3x for UIKit template images.
const filesControl = (
- <NativeHeaderToolbar.Button
+ <Toolbar.Button
identifier="workspace-trailing-action"
icon={{ type: "image", source: require("../../../assets/icons/file-diff.png") }}
accessibilityLabel="Changed files"
@@ -289,19 +289,19 @@ export function PullRequestActionToolbar(props: {
);
if (verticalControls)
return (
- <NativeHeaderToolbar placement="bottom">
+ <Toolbar placement="bottom">
{filesControl}
{agentControl}
{primaryControl}
- </NativeHeaderToolbar>
+ </Toolbar>
);
return (
- <NativeHeaderToolbar placement="bottom">
+ <Toolbar placement="bottom">
{agentControl}
- <NativeHeaderToolbar.Spacer flexible />
+ <Toolbar.Spacer flexible />
{primaryControl}
- <NativeHeaderToolbar.Spacer flexible />
+ <Toolbar.Spacer flexible />
{filesControl}
- </NativeHeaderToolbar>
+ </Toolbar>
);
}
diff --git a/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx
index 1c6761c883a..fe6430c8873 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
import { useAtomRefresh } from "@effect/atom-react";
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
@@ -12,7 +13,7 @@ import { AppText as Text, AppTextInput as TextInput } from "../../components/App
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { Button } from "../../components/Button";
import { GlassSurface } from "../../components/GlassSurface";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { relativeTime } from "../../lib/time";
import { composerPullRequests } from "../../state/pull-requests";
import { useAtomCommand } from "../../state/use-atom-command";
@@ -146,13 +147,13 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
/>
) : null}
{permissions.canResolve && thread ? (
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="right">
+ <Toolbar.Button
label={resolveLabel}
disabled={busy || activity.isPending}
onPress={() => void toggleResolved()}
/>
- </NativeHeaderToolbar>
+ </Toolbar>
) : null}
<ScrollViewMarker style={{ flex: 1 }}>
<ScrollView
diff --git a/apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
index 5badb635769..24d4efe5356 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
import { usePullRequestConnected } from "./usePullRequestConnected";
import { useAtomValue } from "@effect/atom-react";
@@ -20,7 +21,7 @@ import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { EmptyState } from "../../components/EmptyState";
import { Button } from "../../components/Button";
import { SymbolView } from "../../components/AppSymbol";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
import { composerPullRequests } from "../../state/pull-requests";
import { useEnvironmentQuery } from "../../state/query";
@@ -140,13 +141,13 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
};
return (
<View className="flex-1 bg-sheet">
- <NativeHeaderToolbar placement="left">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="left">
+ <Toolbar.Button
icon="xmark"
accessibilityLabel="Close request review"
onPress={() => navigation.goBack()}
/>
- </NativeHeaderToolbar>
+ </Toolbar>
<NativeStackScreenOptions
options={{
title: "Request review",
diff --git a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
index 01083ba211f..1f4627592b5 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
import { Chip } from "../../components/Chip";
import { pullRequestTabOffset } from "./pullRequestTabScroll";
@@ -72,7 +73,7 @@ import { EmptyState } from "../../components/EmptyState";
import { SegmentedControl } from "../../components/SegmentedControl";
import { SymbolView } from "../../components/AppSymbol";
import { relativeTime } from "../../lib/time";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { usePullRequestConnected } from "./usePullRequestConnected";
import { composerPullRequests } from "../../state/pull-requests";
import { useEnvironmentQuery } from "../../state/query";
@@ -446,44 +447,42 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
]}
/>
) : null}
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Menu
+ <Toolbar placement="right">
+ <Toolbar.Menu
title="Pull request"
accessibilityLabel="Pull request actions"
icon="ellipsis"
>
{permissions.verdicts.length ? (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon="text.bubble"
onPress={() =>
navigation.navigate("PullRequestReview", { ...params, mode: "review" })
}
>
- <NativeHeaderToolbar.Label>Submit review</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>Submit review</Toolbar.Label>
+ </Toolbar.MenuAction>
) : null}
{permissions.canComment ? (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon="plus.bubble"
onPress={() =>
navigation.navigate("PullRequestReview", { ...params, mode: "comment" })
}
>
- <NativeHeaderToolbar.Label>Add comment</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>Add comment</Toolbar.Label>
+ </Toolbar.MenuAction>
) : null}
{pr ? (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon="arrow.up.right"
onPress={() => void Linking.openURL(pr.url)}
>
- <NativeHeaderToolbar.Label>
- {openOnProviderLabel(pr.provider)}
- </NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>{openOnProviderLabel(pr.provider)}</Toolbar.Label>
+ </Toolbar.MenuAction>
) : null}
{showsDeleteBranch ? (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon={PR_ACTION_ICONS["delete-branch"]}
destructive
disabled={!action.available("delete-branch")}
@@ -496,13 +495,11 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
}
onPress={confirmDeleteBranch}
>
- <NativeHeaderToolbar.Label>
- {PR_ACTION_LABELS["delete-branch"]}
- </NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>{PR_ACTION_LABELS["delete-branch"]}</Toolbar.Label>
+ </Toolbar.MenuAction>
) : null}
- </NativeHeaderToolbar.Menu>
- </NativeHeaderToolbar>
+ </Toolbar.Menu>
+ </Toolbar>
<View
style={{
flex: 1,
@@ -1014,63 +1011,59 @@ export function PullRequestFileRouteScreen({
}
/>
) : null}
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Menu
- title="Diff options"
- accessibilityLabel="Diff options"
- icon="ellipsis"
- >
+ <Toolbar placement="right">
+ <Toolbar.Menu title="Diff options" accessibilityLabel="Diff options" icon="ellipsis">
{permissions.verdicts.length ? (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon="text.bubble"
onPress={() =>
navigation.navigate("PullRequestReview", { ...route.params, mode: "review" })
}
>
- <NativeHeaderToolbar.Label>Submit review</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>Submit review</Toolbar.Label>
+ </Toolbar.MenuAction>
) : null}
{permissions.canComment ? (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon="plus.bubble"
onPress={() =>
navigation.navigate("PullRequestReview", { ...route.params, mode: "comment" })
}
>
- <NativeHeaderToolbar.Label>Add comment</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>Add comment</Toolbar.Label>
+ </Toolbar.MenuAction>
) : null}
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon="text.alignleft"
isOn={appearance.codeWordBreak}
onPress={() => setCodeWordBreak(!appearance.codeWordBreak)}
>
- <NativeHeaderToolbar.Label>Word wrap</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.Label>Word wrap</Toolbar.Label>
+ </Toolbar.MenuAction>
+ <Toolbar.MenuAction
icon="line.3.horizontal.decrease"
isOn={filter.hideTestFiles}
onPress={toggleTestFiles}
>
- <NativeHeaderToolbar.Label>Hide test files</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>Hide test files</Toolbar.Label>
+ </Toolbar.MenuAction>
{selectedRow && selectedFile && canCommentOnDiff ? (
- <NativeHeaderToolbar.MenuAction icon="bubble.left" onPress={() => commentOnLine()}>
- <NativeHeaderToolbar.Label>
+ <Toolbar.MenuAction icon="bubble.left" onPress={() => commentOnLine()}>
+ <Toolbar.Label>
{route.params.replacingDraftId ? "Move draft to this line" : "Add review comment"}
- </NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ </Toolbar.Label>
+ </Toolbar.MenuAction>
) : null}
{selectedRow && selectedFile ? (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon="document.on.document"
onPress={() => void Clipboard.setStringAsync(selectedRow.content ?? "")}
>
- <NativeHeaderToolbar.Label>Copy line</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>Copy line</Toolbar.Label>
+ </Toolbar.MenuAction>
) : null}
- </NativeHeaderToolbar.Menu>
- </NativeHeaderToolbar>
+ </Toolbar.Menu>
+ </Toolbar>
{route.params.replacingDraftId ? (
<Text className="px-4 py-2 text-xs text-foreground-muted">
Select a current line, then choose “Move draft to this line” from its menu.
diff --git a/apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx b/apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx
index 4a59aa843eb..0f4c29c80f4 100644
--- a/apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../../components/Toolbar";
import { parsePatchFiles } from "@pierre/diffs/utils/parsePatchFiles";
import type { FileDiffMetadata } from "@pierre/diffs";
import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
@@ -17,7 +18,7 @@ import { ScreenScrollView } from "../../../components/ScreenScrollView";
import { Menu } from "../../../components/Menu";
import { IconButton } from "../../../components/IconButton";
import { useAppearancePreferences } from "../../settings/appearance/AppearancePreferencesProvider";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
import { PullRequestCardGroup, PullRequestCardRow } from "../PullRequestControls";
import { PullRequestMarkdown, PullRequestMarkdownRepository } from "../PullRequestMarkdown";
import { usePullRequestDiff, type PullRequestParams } from "../usePullRequestDiff";
@@ -162,21 +163,17 @@ export function PullRequestGuideStopScreen({ route }: StaticScreenProps<GuideSto
}
/>
) : null}
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Menu
- title="Guide options"
- accessibilityLabel="Guide options"
- icon="ellipsis"
- >
- <NativeHeaderToolbar.MenuAction
+ <Toolbar placement="right">
+ <Toolbar.Menu title="Guide options" accessibilityLabel="Guide options" icon="ellipsis">
+ <Toolbar.MenuAction
icon="text.alignleft"
isOn={appearance.codeWordBreak}
onPress={() => setCodeWordBreak(!appearance.codeWordBreak)}
>
- <NativeHeaderToolbar.Label>Word wrap</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
- </NativeHeaderToolbar.Menu>
- </NativeHeaderToolbar>
+ <Toolbar.Label>Word wrap</Toolbar.Label>
+ </Toolbar.MenuAction>
+ </Toolbar.Menu>
+ </Toolbar>
<PullRequestMarkdownRepository
params={route.params}
value={`https://${route.params.host ?? "github.com"}/${route.params.repository}`}
diff --git a/apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx
index 7a120d8f9f2..076f81d753e 100644
--- a/apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { LegendList } from "@legendapp/list/react-native";
import { type StaticScreenProps, useNavigation } from "@react-navigation/native";
@@ -15,7 +16,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { SymbolView } from "../../components/AppSymbol";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
import { SettingsScreen } from "./components/SettingsScreen";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import {
createNativeMailSearchToolbarItem,
NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET,
@@ -140,9 +141,9 @@ export function SettingsOpenSourceLicensesRouteScreen() {
/>
) : null}
{Platform.OS === "ios" && !usesNativeMailSearchToolbar ? (
- <NativeHeaderToolbar placement="bottom">
- <NativeHeaderToolbar.SearchBarSlot />
- </NativeHeaderToolbar>
+ <Toolbar placement="bottom">
+ <Toolbar.SearchBarSlot />
+ </Toolbar>
) : null}
<LegendList
diff --git a/apps/mobile/src/features/settings/SettingsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
index adb6551cf5f..4ebe13696f6 100644
--- a/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { useAuth, useUser } from "@clerk/expo";
import { useNavigation } from "@react-navigation/native";
@@ -7,7 +8,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { hasCloudPublicConfig } from "../cloud/publicConfig";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
import { SettingsRow } from "./components/SettingsRow";
import { SettingsSection } from "./components/SettingsSection";
@@ -34,13 +35,13 @@ export function SettingsRouteScreen() {
) : null}
{Platform.OS === "ios" && layout.usesSplitView ? (
<>
- <NativeHeaderToolbar placement="left">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="left">
+ <Toolbar.Button
accessibilityLabel="Go back"
icon="chevron.left"
onPress={() => navigation.goBack()}
/>
- </NativeHeaderToolbar>
+ </Toolbar>
</>
) : null}
<SettingsEnvironmentFilterHeader closeSettings />
diff --git a/apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx b/apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx
index 5df9282d13f..7e2fccc6dc2 100644
--- a/apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx
+++ b/apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import {
DatePicker,
Host,
@@ -32,7 +33,7 @@ import { NavigationContainer, NavigationIndependentTree } from "@react-navigatio
import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
import { ScrollView, useWindowDimensions, View } from "react-native";
import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
-import { NativeHeaderToolbar } from "../../native/StackHeader";
+
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
@@ -249,16 +250,16 @@ function SnoozePopoverNavigation(props: {
<SnoozeStack.Screen name="CustomSnooze">
{() => (
<>
- <NativeHeaderToolbar placement="left">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="left">
+ <Toolbar.Button
accessibilityLabel="Cancel custom snooze"
icon="xmark"
onPress={props.onClose}
/>
- </NativeHeaderToolbar>
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Button label="Snooze" onPress={props.onSubmit} />
- </NativeHeaderToolbar>
+ </Toolbar>
+ <Toolbar placement="right">
+ <Toolbar.Button label="Snooze" onPress={props.onSubmit} />
+ </Toolbar>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
showsVerticalScrollIndicator={false}
diff --git a/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx b/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
index 4220e13d8d1..9a8b3d0d015 100644
--- a/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
+++ b/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import * as Dialog from "../../components/Dialog";
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
import { NavigationRow } from "../../components/NavigationRow";
@@ -23,7 +24,7 @@ import { AppText as Text } from "../../components/AppText";
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
import { ThemedSwitch } from "../../components/ThemedSwitch";
import { cn } from "../../lib/cn";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { useServerConfigs } from "../../state/entities";
import { useEnvironmentScope } from "../../state/session";
import { useAtomCommand } from "../../state/use-atom-command";
@@ -593,9 +594,9 @@ export function BranchPickerScreen(props: {
}}
/>
{usesNativeMailSearchToolbar ? null : (
- <NativeHeaderToolbar placement="bottom">
- <NativeHeaderToolbar.SearchBarSlot />
- </NativeHeaderToolbar>
+ <Toolbar placement="bottom">
+ <Toolbar.SearchBarSlot />
+ </Toolbar>
)}
{branchContent}
</>
diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
index 3e250602086..2b1ed4d5a49 100644
--- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import * as Dialog from "../../components/Dialog";
import { useAtomValue } from "@effect/atom-react";
import * as Cause from "effect/Cause";
@@ -8,7 +9,7 @@ import {
pastedTextDisposition,
replaceTextSelection,
} from "@t3tools/client-runtime/text-paste";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import {
CommonActions,
StackActions,
@@ -1896,13 +1897,13 @@ export function NewTaskDraftScreen(props: {
title: "New thread",
}}
/>
- <NativeHeaderToolbar placement="left">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="left">
+ <Toolbar.Button
accessibilityLabel="Cancel new task"
label="Cancel"
onPress={closeNewTask}
/>
- </NativeHeaderToolbar>
+ </Toolbar>
{heroViewport}
<KeyboardStickyView
diff --git a/apps/mobile/src/features/threads/ThreadGitControls.tsx b/apps/mobile/src/features/threads/ThreadGitControls.tsx
index f750d7f5cac..dacbed4975d 100644
--- a/apps/mobile/src/features/threads/ThreadGitControls.tsx
+++ b/apps/mobile/src/features/threads/ThreadGitControls.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import * as Dialog from "../../components/Dialog";
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
import { createNativeHeaderMenu } from "../../components/nativeHeaderMenu.ios";
@@ -16,7 +17,7 @@ import {
resolveQuickAction,
} from "@t3tools/client-runtime/state/vcs";
import { useNavigation } from "@react-navigation/native";
-import { NativeHeaderToolbar } from "../../native/StackHeader";
+
import { useCallback, useMemo } from "react";
import { useEnvironmentScope } from "../../state/session";
import {
@@ -458,9 +459,9 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
}
return (
- <NativeHeaderToolbar placement="right">
+ <Toolbar placement="right">
{showActionControls && props.auxiliaryPaneControl ? (
- <NativeHeaderToolbar.Button
+ <Toolbar.Button
accessibilityLabel={props.auxiliaryPaneControl.accessibilityLabel}
icon="sidebar.right"
onPress={props.auxiliaryPaneControl.onPress}
@@ -468,7 +469,7 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
/>
) : null}
{showActionControls ? (
- <NativeHeaderToolbar.Menu
+ <Toolbar.Menu
accessibilityLabel="Open terminal"
icon="terminal"
disabled={!props.canOpenTerminal}
@@ -476,30 +477,28 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
>
{props.projectScripts.length > 0 ? (
props.projectScripts.map((script) => (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={script.id}
icon={projectScriptMenuIcon(script.icon)}
disabled={!props.canOperateTerminal}
onPress={() => void props.onRunProjectScript(script)}
subtitle={script.command}
>
- <NativeHeaderToolbar.Label>
- {projectScriptMenuLabel(script)}
- </NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>{projectScriptMenuLabel(script)}</Toolbar.Label>
+ </Toolbar.MenuAction>
))
) : (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon="play"
disabled
onPress={() => {}}
subtitle="This project has no saved scripts yet"
>
- <NativeHeaderToolbar.Label>No project scripts</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>No project scripts</Toolbar.Label>
+ </Toolbar.MenuAction>
)}
{props.terminalSessions.map((session) => (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={session.terminalId}
icon="terminal"
onPress={() => props.onOpenTerminal(session.terminalId)}
@@ -513,21 +512,21 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
.filter(Boolean)
.join(" · ")}
>
- <NativeHeaderToolbar.Label>{session.displayLabel}</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
+ <Toolbar.Label>{session.displayLabel}</Toolbar.Label>
+ </Toolbar.MenuAction>
))}
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
icon="plus"
disabled={!props.canOperateTerminal}
onPress={props.onOpenNewTerminal}
subtitle="Start another shell for this thread"
>
- <NativeHeaderToolbar.Label>Open new terminal</NativeHeaderToolbar.Label>
- </NativeHeaderToolbar.MenuAction>
- </NativeHeaderToolbar.Menu>
+ <Toolbar.Label>Open new terminal</Toolbar.Label>
+ </Toolbar.MenuAction>
+ </Toolbar.Menu>
) : null}
{showActionControls && props.showDirectFileControl ? (
- <NativeHeaderToolbar.Button
+ <Toolbar.Button
accessibilityLabel="Open files"
disabled={!props.canOpenFiles}
icon="folder"
@@ -536,13 +535,13 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
/>
) : null}
{showActionControls ? createNativeHeaderMenu(threadGitMenuDefinition(props, model)) : null}
- </NativeHeaderToolbar>
+ </Toolbar>
);
}
/**
* The standalone git actions menu (branch status, quick commit/push action,
- * review, more). Rendered inside a NativeHeaderToolbar by both the thread
+ * review, more). Rendered inside a Toolbar by both the thread
* chat header and the review screen's toolbar.
*/
export function ThreadGitMenu(props: ThreadGitMenuProps) {
diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
index c8b7c299ca1..c8d0f6d3d04 100644
--- a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+++ b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import * as Dialog from "../../components/Dialog";
import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts";
@@ -60,11 +61,7 @@ import { applyProviderOptionSelection } from "../../lib/providerOptions";
import { resolveProviderOptionDescriptors } from "../../lib/providerOptions";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
import { rememberModelOptions } from "../../state/use-model-option-memory";
-import {
- NativeHeaderToolbar,
- NativeStackScreenOptions,
- nativeHeaderScrollEdgeEffects,
-} from "../../native/StackHeader";
+import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import { ChatGptSharingStatus } from "./ChatGptSharingStatus";
import { environmentServerConfigsAtom, serverEnvironment } from "../../state/server";
@@ -1415,23 +1412,23 @@ function ThreadSettingsModelsScreen() {
}}
/>
</ScreenContent>
- <NativeHeaderToolbar placement="left">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="left">
+ <Toolbar.Button
accessibilityLabel="Cancel thread settings"
label="Cancel"
onPress={presentation.onClose}
/>
- </NativeHeaderToolbar>
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Button
+ </Toolbar>
+ <Toolbar placement="right">
+ <Toolbar.Button
accessibilityLabel={session.pendingModel ? "Save thread settings" : "Done"}
label={session.pendingModel ? "Save" : "Done"}
onPress={commitAndClose}
/>
- </NativeHeaderToolbar>
+ </Toolbar>
{Platform.OS === "ios" && !usesNativeMailSearchToolbar ? (
- <NativeHeaderToolbar placement="bottom">
- <NativeHeaderToolbar.Menu
+ <Toolbar placement="bottom">
+ <Toolbar.Menu
accessibilityLabel="Filter models"
icon={
hasCustomCatalogFilter
@@ -1441,40 +1438,40 @@ function ThreadSettingsModelsScreen() {
separateBackground
title="Model filters"
>
- <NativeHeaderToolbar.Menu title="Provider">
- <NativeHeaderToolbar.Label>Provider</NativeHeaderToolbar.Label>
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.Menu title="Provider">
+ <Toolbar.Label>Provider</Toolbar.Label>
+ <Toolbar.MenuAction
isOn={session.providerFilter === null}
onPress={() => session.setProviderFilter(null)}
>
All providers
- </NativeHeaderToolbar.MenuAction>
- <NativeHeaderToolbar.MenuAction
+ </Toolbar.MenuAction>
+ <Toolbar.MenuAction
isOn={session.providerFilter === FAVORITES_PROVIDER_FILTER}
onPress={() => session.setProviderFilter(FAVORITES_PROVIDER_FILTER)}
>
Favorites
- </NativeHeaderToolbar.MenuAction>
+ </Toolbar.MenuAction>
{session.providerGroups.map((group) => (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
key={group.providerKey}
isOn={session.providerFilter === group.providerKey}
onPress={() => session.setProviderFilter(group.providerKey)}
>
{group.providerLabel}
- </NativeHeaderToolbar.MenuAction>
+ </Toolbar.MenuAction>
))}
- </NativeHeaderToolbar.Menu>
+ </Toolbar.Menu>
{session.hasLegacyModels ? (
- <NativeHeaderToolbar.MenuAction
+ <Toolbar.MenuAction
isOn={session.showLegacy}
onPress={() => session.setShowLegacy(!session.showLegacy)}
>
Show legacy models
- </NativeHeaderToolbar.MenuAction>
+ </Toolbar.MenuAction>
) : null}
- </NativeHeaderToolbar.Menu>
- </NativeHeaderToolbar>
+ </Toolbar.Menu>
+ </Toolbar>
) : null}
</>
);
diff --git a/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx b/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
index de33580eae5..cb60221f249 100644
--- a/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
+++ b/apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
@@ -1,3 +1,4 @@
+import { Toolbar } from "../../components/Toolbar";
import { useFocusEffect, useNavigation } from "@react-navigation/native";
import { use, useCallback, useEffect, useRef } from "react";
import { Platform } from "react-native";
@@ -5,7 +6,7 @@ import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
import type { SearchBarCommands } from "react-native-screens";
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
+import { NativeStackScreenOptions } from "../../native/StackHeader";
import { NativeWorkspaceTabActivityContext } from "../../native/v5-workspace-context";
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
@@ -101,8 +102,8 @@ export function WorkspaceToolbar(props: {
}}
/>
{/* UIKit lays trailing items out from the edge inward. */}
- <NativeHeaderToolbar placement="right">
- <NativeHeaderToolbar.Button
+ <Toolbar placement="right">
+ <Toolbar.Button
accessibilityLabel="Settings"
icon="gearshape"
onPress={() =>
@@ -113,7 +114,7 @@ export function WorkspaceToolbar(props: {
}
/>
{NATIVE_LIQUID_GLASS_SUPPORTED ? null : (
- <NativeHeaderToolbar.Button
+ <Toolbar.Button
accessibilityLabel={
selectedTab === "pullRequests" ? "Search pull requests" : "Search threads"
}
@@ -121,11 +122,11 @@ export function WorkspaceToolbar(props: {
onPress={focusSearch}
/>
)}
- </NativeHeaderToolbar>
- <NativeHeaderToolbar placement="bottom">
- {nativeToolbarCompose ? <NativeHeaderToolbar.Spacer flexible /> : null}
+ </Toolbar>
+ <Toolbar placement="bottom">
+ {nativeToolbarCompose ? <Toolbar.Spacer flexible /> : null}
{nativeToolbarCompose ? (
- <NativeHeaderToolbar.Button
+ <Toolbar.Button
identifier="workspace-compose"
accessibilityLabel="New chat"
icon="square.and.pencil"
@@ -133,7 +134,7 @@ export function WorkspaceToolbar(props: {
separateBackground
/>
) : null}
- </NativeHeaderToolbar>
+ </Toolbar>
</>
);
}
diff --git a/apps/mobile/src/native/NativeHeaderToolbar.android.tsx b/apps/mobile/src/native/NativeHeaderToolbar.android.tsx
index efa7b7e6813..132f8f56636 100644
--- a/apps/mobile/src/native/NativeHeaderToolbar.android.tsx
+++ b/apps/mobile/src/native/NativeHeaderToolbar.android.tsx
@@ -18,6 +18,10 @@ function NativeHeaderToolbarMenuAction(
return null;
}
+function NativeHeaderToolbarCustom(_props: Parameters<typeof IosNativeHeaderToolbar.Custom>[0]) {
+ return null;
+}
+
function NativeHeaderToolbarLabel(_props: Parameters<typeof IosNativeHeaderToolbar.Label>[0]) {
return null;
}
@@ -33,6 +37,7 @@ function NativeHeaderToolbarSearchBarSlot() {
// Native header item factories are iOS-only; Android owns its in-flow header.
export const NativeHeaderToolbar = Object.assign(NativeHeaderToolbarRoot, {
Button: NativeHeaderToolbarButton,
+ Custom: NativeHeaderToolbarCustom,
Label: NativeHeaderToolbarLabel,
Menu: Object.assign(NativeHeaderToolbarMenu, {
Action: NativeHeaderToolbarMenuAction,