The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 09:15 UTC
refactor(mobile): unify navigation and floating toolbar APIs (#20002)
Julius Marminge committed
Oct 15, 2026 at 15:51 UTC
fbbd4596e4298283398c046c8938a87c2db610a3
26 files changed
+288
-256
apps/mobile/src/components/AppBar.tsx
+8
-7
@@ -1,10 +1,11 @@
1
+import { Toolbar } from "./Toolbar";
2
import { AppActivityIndicator } from "./AppActivityIndicator";
3
import type { HeaderBarButtonMailSearchToolbarItem } from "react-native-screens";
4
import { useId } from "react";
5
import { Platform, View } from "react-native";
6
import { createNativeHeaderMenu } from "./nativeHeaderMenu.ios";
7
import { ScreenHeaderButton } from "./ScreenHeaderButton";
7
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../native/StackHeader";
8
+import { NativeStackScreenOptions } from "../native/StackHeader";
9
import { useNativeWorkspaceColumnsSupported } from "../native/NativeWorkspaceColumns";
10
import { useAdaptiveWorkspaceLayout } from "../features/layout/AdaptiveWorkspaceLayout";
11
import {
@@ -114,7 +115,7 @@ export function AppBar(props: AppBarProps) {
115
}}
116
/>
117
{layout.usesSplitView && (props.sidebar !== false || props.backInSplitView) ? (
117
- <NativeHeaderToolbar placement="left">
118
+ <Toolbar placement="left">
119
{props.backInSplitView && (props.backInSplitView.onPress || props.onBack) ? (
120
<ScreenHeaderButton
121
{...props.backInSplitView}
@@ -141,24 +142,24 @@ export function AppBar(props: AppBarProps) {
142
}
143
/>
144
) : null}
144
- </NativeHeaderToolbar>
145
+ </Toolbar>
146
) : null}
147
{(props.actions?.length ||
148
(!compactSearch && refresh) ||
149
visibleMenus.length ||
150
props.trailing) &&
151
props.options?.unstable_headerRightItems === undefined ? (
151
- <NativeHeaderToolbar placement="right">
152
+ <Toolbar placement="right">
153
{props.actions?.map(({ loading, ...action }) =>
154
loading ? (
154
- <NativeHeaderToolbar.Custom key={action.accessibilityLabel}>
155
+ <Toolbar.Custom key={action.accessibilityLabel}>
156
<View
157
accessibilityLabel={action.accessibilityLabel}
158
className="size-9 items-center justify-center"
159
>
160
<AppActivityIndicator color={action.tintColor} />
161
</View>
161
- </NativeHeaderToolbar.Custom>
162
+ </Toolbar.Custom>
163
) : (
164
<ScreenHeaderButton
165
key={action.accessibilityLabel}
@@ -178,7 +179,7 @@ export function AppBar(props: AppBarProps) {
179
) : null}
180
{visibleMenus.map(createNativeHeaderMenu)}
181
{props.trailing}
181
- </NativeHeaderToolbar>
182
+ </Toolbar>
183
) : null}
184
</>
185
);
apps/mobile/src/components/ScreenHeaderButton.tsx
+4
-3
@@ -1,4 +1,5 @@
1
-import { NativeHeaderToolbar } from "../native/StackHeader";
1
+import { Toolbar } from "./Toolbar";
2
+
3
export const ScreenHeaderButton: (
3
- props: Parameters<typeof NativeHeaderToolbar.Button>[0] & { readonly selected?: boolean },
4
-) => ReturnType<typeof NativeHeaderToolbar.Button> = NativeHeaderToolbar.Button;
4
+ props: Parameters<typeof Toolbar.Button>[0] & { readonly selected?: boolean },
5
+) => ReturnType<typeof Toolbar.Button> = Toolbar.Button;
apps/mobile/src/components/Toolbar.android.tsx
+13
-1
@@ -1,3 +1,4 @@
1
+import { NativeHeaderToolbar } from "../native/NativeHeaderToolbar";
2
import { NativeThemeHost } from "./NativeThemeHost.android";
3
import { HorizontalFloatingToolbar, RNHostView } from "@expo/ui/jetpack-compose";
4
import type { ToolbarProps } from "./Toolbar.types";
@@ -5,8 +6,9 @@ import type { ToolbarProps } from "./Toolbar.types";
6
import { useControlTheme } from "./useControlTheme";
7
8
/** Native toolbar surface; hosted RN controls retain their existing menus and accessibility. */
8
-export function Toolbar(props: ToolbarProps) {
9
+function ToolbarRoot(props: ToolbarProps) {
10
const { colors } = useControlTheme();
11
+ if (props.placement) return <NativeHeaderToolbar {...props} />;
12
return (
13
<NativeThemeHost
14
matchContents
@@ -24,3 +26,13 @@ export function Toolbar(props: ToolbarProps) {
26
</NativeThemeHost>
27
);
28
}
29
+
30
+export const Toolbar = Object.assign(ToolbarRoot, {
31
+ Button: NativeHeaderToolbar.Button,
32
+ Custom: NativeHeaderToolbar.Custom,
33
+ Label: NativeHeaderToolbar.Label,
34
+ Menu: NativeHeaderToolbar.Menu,
35
+ MenuAction: NativeHeaderToolbar.MenuAction,
36
+ SearchBarSlot: NativeHeaderToolbar.SearchBarSlot,
37
+ Spacer: NativeHeaderToolbar.Spacer,
38
+});
apps/mobile/src/components/Toolbar.tsx
+19
-2
@@ -1,5 +1,22 @@
1
+import { GlassContainer } from "expo-glass-effect";
2
+import { NativeHeaderToolbar } from "../native/NativeHeaderToolbar";
3
import type { ToolbarProps } from "./Toolbar.types";
4
3
-export function Toolbar(props: ToolbarProps) {
4
- return props.children;
5
+function ToolbarRoot(props: ToolbarProps) {
6
+ if (props.placement) return <NativeHeaderToolbar {...props} />;
7
+ return (
8
+ <GlassContainer style={{ flexDirection: "row", alignItems: "center" }}>
9
+ {props.children}
10
+ </GlassContainer>
11
+ );
12
}
13
+
14
+export const Toolbar = Object.assign(ToolbarRoot, {
15
+ Button: NativeHeaderToolbar.Button,
16
+ Custom: NativeHeaderToolbar.Custom,
17
+ Label: NativeHeaderToolbar.Label,
18
+ Menu: NativeHeaderToolbar.Menu,
19
+ MenuAction: NativeHeaderToolbar.MenuAction,
20
+ SearchBarSlot: NativeHeaderToolbar.SearchBarSlot,
21
+ Spacer: NativeHeaderToolbar.Spacer,
22
+});
apps/mobile/src/components/Toolbar.types.ts
+5
-5
@@ -1,6 +1,6 @@
1
-import type { ReactElement } from "react";
1
+import type { ReactElement, ReactNode } from "react";
2
3
-/** Native floating action group. Its owner supplies placement and action content. */
4
-export interface ToolbarProps {
5
- readonly children: ReactElement;
6
-}
3
+/** Navigation toolbars attach to the current screen; floating groups stay in layout. */
4
+export type ToolbarProps =
5
+ | { readonly placement: "left" | "right" | "bottom"; readonly children?: ReactNode }
6
+ | { readonly placement?: undefined; readonly children: ReactElement };
apps/mobile/src/components/nativeHeaderMenu.ios.tsx
+9
-13
@@ -1,19 +1,15 @@
1
-import { NativeHeaderToolbar } from "../native/StackHeader";
1
+import { Toolbar } from "./Toolbar";
2
+
3
import type { AppBarMenu, AppBarMenuItem } from "./AppBar.types";
4
5
function renderMenuItems(items: ReadonlyArray<AppBarMenuItem>) {
6
return items.map((item) =>
7
"items" in item ? (
7
- <NativeHeaderToolbar.Menu
8
- key={item.id}
9
- title={item.title}
10
- icon={item.icon}
11
- inline={item.inline}
12
- >
8
+ <Toolbar.Menu key={item.id} title={item.title} icon={item.icon} inline={item.inline}>
9
{renderMenuItems(item.items)}
14
- </NativeHeaderToolbar.Menu>
10
+ </Toolbar.Menu>
11
) : (
16
- <NativeHeaderToolbar.MenuAction
12
+ <Toolbar.MenuAction
13
key={item.id}
14
icon={item.icon}
15
subtitle={item.subtitle}
@@ -22,7 +18,7 @@ function renderMenuItems(items: ReadonlyArray<AppBarMenuItem>) {
18
onPress={item.onPress}
19
>
20
{item.title}
25
- </NativeHeaderToolbar.MenuAction>
21
+ </Toolbar.MenuAction>
22
),
23
);
24
}
@@ -30,15 +26,15 @@ function renderMenuItems(items: ReadonlyArray<AppBarMenuItem>) {
26
/** Returns direct native items for toolbar serialization, including nested menu data. */
27
export function createNativeHeaderMenu(menu: AppBarMenu) {
28
return (
33
- <NativeHeaderToolbar.Menu
29
+ <Toolbar.Menu
30
key={menu.title}
31
title={menu.title}
32
accessibilityLabel={menu.title}
33
icon={typeof menu.icon === "string" ? menu.icon : menu.icon.ios}
34
separateBackground={menu.separateBackground ?? true}
35
>
40
- {menu.status ? <NativeHeaderToolbar.Label>{menu.status}</NativeHeaderToolbar.Label> : null}
36
+ {menu.status ? <Toolbar.Label>{menu.status}</Toolbar.Label> : null}
37
{renderMenuItems(menu.items)}
42
- </NativeHeaderToolbar.Menu>
38
+ </Toolbar.Menu>
39
);
40
}
apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
+5
-4
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
3
import * as Dialog from "../../components/Dialog";
4
import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";
@@ -15,7 +16,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
16
17
import { ControlPill } from "../../components/ControlPill";
18
import { AppBar } from "../../components/AppBar";
18
-import { NativeHeaderToolbar } from "../../native/StackHeader";
19
+
20
import { useThreadServerBrowserTabs } from "../../state/preview";
21
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
22
import { BrowserTabMenu } from "./BrowserTabMenu";
@@ -159,14 +160,14 @@ function BrowserPreviewScreen({
160
}
161
/>
162
{Platform.OS === "ios" ? (
162
- <NativeHeaderToolbar placement="left">
163
- <NativeHeaderToolbar.Button
163
+ <Toolbar placement="left">
164
+ <Toolbar.Button
165
icon="xmark"
166
accessibilityLabel="Close browser"
167
onPress={onClose}
168
separateBackground
169
/>
169
- </NativeHeaderToolbar>
170
+ </Toolbar>
171
) : null}
172
{tab ? (
173
<>
apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
+5
-4
@@ -1,5 +1,6 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
2
-import { NativeHeaderToolbar } from "../../native/StackHeader";
3
+
4
import { useAuth } from "@clerk/expo";
5
import { StackActions, useNavigation } from "@react-navigation/native";
6
import { useCallback, useEffect, useState } from "react";
@@ -99,9 +100,9 @@ function ConfiguredConnectOnboardingRouteScreen() {
100
]}
101
/>
102
) : (
102
- <NativeHeaderToolbar placement="right">
103
- <NativeHeaderToolbar.Button icon="xmark" onPress={handleClose} separateBackground />
104
- </NativeHeaderToolbar>
103
+ <Toolbar placement="right">
104
+ <Toolbar.Button icon="xmark" onPress={handleClose} separateBackground />
105
+ </Toolbar>
106
)}
107
<ScrollView
108
nestedScrollEnabled
apps/mobile/src/features/connection/ConnectionsRouteScreen.tsx
+5
-4
@@ -1,5 +1,6 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
2
-import { NativeHeaderToolbar } from "../../native/StackHeader";
3
+
4
import { useNavigation } from "@react-navigation/native";
5
import type { EnvironmentId } from "@t3tools/contracts";
6
import { useCallback, useState } from "react";
@@ -41,13 +42,13 @@ export function ConnectionsRouteScreen() {
42
]}
43
/>
44
) : (
44
- <NativeHeaderToolbar placement="right">
45
- <NativeHeaderToolbar.Button
45
+ <Toolbar placement="right">
46
+ <Toolbar.Button
47
icon="plus"
48
onPress={() => navigation.navigate("ConnectionsNew")}
49
separateBackground
50
/>
50
- </NativeHeaderToolbar>
51
+ </Toolbar>
52
)}
53
<ScrollView
54
contentInsetAdjustmentBehavior="automatic"
apps/mobile/src/features/files/AttachmentFileScreen.tsx
+12
-11
@@ -1,6 +1,7 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import * as Dialog from "../../components/Dialog";
3
/* oxlint-disable react/no-array-index-key -- Captured table rows and columns have stable positions and may contain identical values. */
3
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
4
+import { NativeStackScreenOptions } from "../../native/StackHeader";
5
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
6
import type { MenuAction } from "@react-native-menu/menu";
7
import { EnvironmentId } from "@t3tools/contracts";
@@ -380,38 +381,38 @@ export function AttachmentFileScreen(props: AttachmentFileScreenProps) {
381
}
382
/>
383
) : null}
383
- <NativeHeaderToolbar placement="right">
384
- <NativeHeaderToolbar.Menu accessibilityLabel="File actions" icon="ellipsis">
384
+ <Toolbar placement="right">
385
+ <Toolbar.Menu accessibilityLabel="File actions" icon="ellipsis">
386
{renderedMode ? (
386
- <NativeHeaderToolbar.Menu inline>
387
+ <Toolbar.Menu inline>
388
{menuActions
389
.filter(({ inline }) => inline)
390
.map((action) => (
390
- <NativeHeaderToolbar.MenuAction
391
+ <Toolbar.MenuAction
392
key={action.id}
393
icon={action.icon}
394
isOn={action.id === selectedAction}
395
onPress={action.onPress}
396
>
397
{action.title}
397
- </NativeHeaderToolbar.MenuAction>
398
+ </Toolbar.MenuAction>
399
))}
399
- </NativeHeaderToolbar.Menu>
400
+ </Toolbar.Menu>
401
) : null}
402
{menuActions
403
.filter(({ inline }) => !inline)
404
.map((action) => (
404
- <NativeHeaderToolbar.MenuAction
405
+ <Toolbar.MenuAction
406
key={action.id}
407
icon={action.icon}
408
destructive={"destructive" in action}
409
onPress={action.onPress}
410
>
411
{action.title}
411
- </NativeHeaderToolbar.MenuAction>
412
+ </Toolbar.MenuAction>
413
))}
413
- </NativeHeaderToolbar.Menu>
414
- </NativeHeaderToolbar>
414
+ </Toolbar.Menu>
415
+ </Toolbar>
416
<AttachmentDocumentBody
417
document={document}
418
name={params.name}
apps/mobile/src/features/home/HomeHeader.tsx
+27
-26
@@ -1,4 +1,5 @@
1
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
1
+import { Toolbar } from "../../components/Toolbar";
2
+import { NativeStackScreenOptions } from "../../native/StackHeader";
3
import { use, useCallback, useEffect, useRef } from "react";
4
import { useNavigation, type ParamListBase } from "@react-navigation/native";
5
import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
@@ -104,7 +105,7 @@ export function HomeHeader(props: HomeHeaderProps) {
105
}),
106
],
107
// The keys below are set per-branch (not `undefined`) so a later
107
- // reapply cannot clobber options owned by NativeHeaderToolbar.
108
+ // reapply cannot clobber options owned by Toolbar.
109
...(sidebarHeader
110
? {
111
headerSearchBarOptions: {
@@ -165,8 +166,8 @@ export function HomeHeader(props: HomeHeaderProps) {
166
/>
167
168
{sidebarHeader || usesNativeMailSearchToolbar ? null : (
168
- <NativeHeaderToolbar placement="bottom">
169
- <NativeHeaderToolbar.Menu
169
+ <Toolbar placement="bottom">
170
+ <Toolbar.Menu
171
accessibilityLabel="Filter threads"
172
icon={
173
hasCustomListOptions
@@ -176,56 +177,56 @@ export function HomeHeader(props: HomeHeaderProps) {
177
title="Thread list options"
178
separateBackground
179
>
179
- <NativeHeaderToolbar.Menu title="Environment">
180
- <NativeHeaderToolbar.Label>Environment</NativeHeaderToolbar.Label>
181
- <NativeHeaderToolbar.MenuAction
180
+ <Toolbar.Menu title="Environment">
181
+ <Toolbar.Label>Environment</Toolbar.Label>
182
+ <Toolbar.MenuAction
183
isOn={props.selectedEnvironmentId === null}
184
onPress={() => props.onEnvironmentChange(null)}
185
subtitle="Show threads from every environment"
186
>
186
- <NativeHeaderToolbar.Label>All environments</NativeHeaderToolbar.Label>
187
- </NativeHeaderToolbar.MenuAction>
187
+ <Toolbar.Label>All environments</Toolbar.Label>
188
+ </Toolbar.MenuAction>
189
{props.environments.map((environment) => (
189
- <NativeHeaderToolbar.MenuAction
190
+ <Toolbar.MenuAction
191
key={environment.environmentId}
192
isOn={props.selectedEnvironmentId === environment.environmentId}
193
onPress={() => props.onEnvironmentChange(environment.environmentId)}
194
>
194
- <NativeHeaderToolbar.Label>{environment.label}</NativeHeaderToolbar.Label>
195
- </NativeHeaderToolbar.MenuAction>
195
+ <Toolbar.Label>{environment.label}</Toolbar.Label>
196
+ </Toolbar.MenuAction>
197
))}
197
- </NativeHeaderToolbar.Menu>
198
+ </Toolbar.Menu>
199
200
{props.projects.length > 0 ? (
200
- <NativeHeaderToolbar.Menu title="Project">
201
- <NativeHeaderToolbar.Label>Project</NativeHeaderToolbar.Label>
202
- <NativeHeaderToolbar.MenuAction
201
+ <Toolbar.Menu title="Project">
202
+ <Toolbar.Label>Project</Toolbar.Label>
203
+ <Toolbar.MenuAction
204
isOn={props.selectedProjectKey === null}
205
onPress={() => props.onProjectChange(null)}
206
subtitle="Show threads from every project"
207
>
207
- <NativeHeaderToolbar.Label>All projects</NativeHeaderToolbar.Label>
208
- </NativeHeaderToolbar.MenuAction>
208
+ <Toolbar.Label>All projects</Toolbar.Label>
209
+ </Toolbar.MenuAction>
210
{props.projects.map((project) => (
210
- <NativeHeaderToolbar.MenuAction
211
+ <Toolbar.MenuAction
212
key={project.key}
213
isOn={props.selectedProjectKey === project.key}
214
onPress={() => props.onProjectChange(project.key)}
215
>
215
- <NativeHeaderToolbar.Label>{project.label}</NativeHeaderToolbar.Label>
216
- </NativeHeaderToolbar.MenuAction>
216
+ <Toolbar.Label>{project.label}</Toolbar.Label>
217
+ </Toolbar.MenuAction>
218
))}
218
- </NativeHeaderToolbar.Menu>
219
+ </Toolbar.Menu>
220
) : null}
220
- </NativeHeaderToolbar.Menu>
221
- <NativeHeaderToolbar.Spacer flexible />
222
- <NativeHeaderToolbar.Button
221
+ </Toolbar.Menu>
222
+ <Toolbar.Spacer flexible />
223
+ <Toolbar.Button
224
accessibilityLabel="New task"
225
icon="square.and.pencil"
226
onPress={props.onStartNewTask}
227
separateBackground
228
/>
228
- </NativeHeaderToolbar>
229
+ </Toolbar>
230
)}
231
</>
232
);
apps/mobile/src/features/home/HomeRouteScreen.tsx
+5
-4
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { use } from "react";
3
import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
4
import * as Arr from "effect/Array";
@@ -9,7 +10,7 @@ import { Platform, useWindowDimensions } from "react-native";
10
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
11
import { resolveScratchProjectScopeKey } from "@t3tools/client-runtime/state/project-grouping";
12
12
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
13
+import { NativeStackScreenOptions } from "../../native/StackHeader";
14
import { useProjects } from "../../state/entities";
15
import { environmentThreadShells } from "../../state/threads";
16
import { usePendingNewTasks } from "../../state/use-pending-new-tasks";
@@ -176,13 +177,13 @@ export function HomeRouteScreen() {
177
}
178
/>
179
{Platform.OS === "ios" ? (
179
- <NativeHeaderToolbar placement="left">
180
- <NativeHeaderToolbar.Button
180
+ <Toolbar placement="left">
181
+ <Toolbar.Button
182
accessibilityLabel="New task"
183
icon="square.and.pencil"
184
onPress={() => navigation.navigate("NewTaskSheet", { screen: "NewTask" })}
185
/>
185
- </NativeHeaderToolbar>
186
+ </Toolbar>
187
) : null}
188
{Platform.OS === "android" ? <AndroidScreenHeader title="Threads" /> : null}
189
<WorkspaceEmptyDetail
apps/mobile/src/features/pull-requests/PullRequestControls.tsx
+24
-24
@@ -11,7 +11,7 @@ import { Button } from "../../components/Button";
11
import { IconButton } from "../../components/IconButton";
12
import { Toolbar } from "../../components/Toolbar";
13
import { Menu } from "../../components/Menu";
14
-import { NativeHeaderToolbar } from "../../native/StackHeader";
14
+
15
import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
16
import { type PullRequestParams } from "./usePullRequestDiff";
17
import { usePullRequestPermissions } from "./usePullRequestPermissions";
@@ -190,19 +190,19 @@ export function PullRequestActionToolbar(props: {
190
);
191
}
192
const nativeThreadItems = threadMenuItems.map((item) => (
193
- <NativeHeaderToolbar.MenuAction
193
+ <Toolbar.MenuAction
194
key={item.id}
195
icon={item.image}
196
subtitle={"subtitle" in item ? item.subtitle : undefined}
197
disabled={"attributes" in item && item.attributes.disabled}
198
onPress={() => agent.select(item.id)}
199
>
200
- <NativeHeaderToolbar.Label>{item.title}</NativeHeaderToolbar.Label>
201
- </NativeHeaderToolbar.MenuAction>
200
+ <Toolbar.Label>{item.title}</Toolbar.Label>
201
+ </Toolbar.MenuAction>
202
));
203
const primaryControl = showPrimary ? (
204
!pendingReview && chooseThread ? (
205
- <NativeHeaderToolbar.Menu
205
+ <Toolbar.Menu
206
identifier="pull-request-primary-action"
207
title={primaryLabel}
208
accessibilityLabel={primaryLabel}
@@ -219,9 +219,9 @@ export function PullRequestActionToolbar(props: {
219
separateBackground
220
>
221
{nativeThreadItems}
222
- </NativeHeaderToolbar.Menu>
222
+ </Toolbar.Menu>
223
) : (
224
- <NativeHeaderToolbar.Button
224
+ <Toolbar.Button
225
identifier="pull-request-primary-action"
226
label={primaryLabel}
227
accessibilityLabel={primaryLabel}
@@ -241,7 +241,7 @@ export function PullRequestActionToolbar(props: {
241
)
242
) : null;
243
const agentControl = showAgentControls ? (
244
- <NativeHeaderToolbar.Menu
244
+ <Toolbar.Menu
245
identifier="pull-request-agent"
246
icon="sparkles"
247
title="AI helpers"
@@ -251,35 +251,35 @@ export function PullRequestActionToolbar(props: {
251
>
252
{agentActions.map((action) =>
253
chooseThread && !action.disabled ? (
254
- <NativeHeaderToolbar.Menu key={action.task} title={action.title} icon={action.icon}>
254
+ <Toolbar.Menu key={action.task} title={action.title} icon={action.icon}>
255
{agent.threadActions(action.task).map((item) => (
256
- <NativeHeaderToolbar.MenuAction
256
+ <Toolbar.MenuAction
257
key={item.id}
258
icon={item.image}
259
subtitle={"subtitle" in item ? item.subtitle : undefined}
260
disabled={"attributes" in item && item.attributes.disabled}
261
onPress={() => agent.select(item.id)}
262
>
263
- <NativeHeaderToolbar.Label>{item.title}</NativeHeaderToolbar.Label>
264
- </NativeHeaderToolbar.MenuAction>
263
+ <Toolbar.Label>{item.title}</Toolbar.Label>
264
+ </Toolbar.MenuAction>
265
))}
266
- </NativeHeaderToolbar.Menu>
266
+ </Toolbar.Menu>
267
) : (
268
- <NativeHeaderToolbar.MenuAction
268
+ <Toolbar.MenuAction
269
key={action.task}
270
icon={action.icon}
271
disabled={action.disabled}
272
onPress={() => agent.start(action.task)}
273
>
274
- <NativeHeaderToolbar.Label>{action.title}</NativeHeaderToolbar.Label>
275
- </NativeHeaderToolbar.MenuAction>
274
+ <Toolbar.Label>{action.title}</Toolbar.Label>
275
+ </Toolbar.MenuAction>
276
),
277
)}
278
- </NativeHeaderToolbar.Menu>
278
+ </Toolbar.Menu>
279
) : null;
280
// Tabler file-diff geometry, rasterized at 1x/2x/3x for UIKit template images.
281
const filesControl = (
282
- <NativeHeaderToolbar.Button
282
+ <Toolbar.Button
283
identifier="workspace-trailing-action"
284
icon={{ type: "image", source: require("../../../assets/icons/file-diff.png") }}
285
accessibilityLabel="Changed files"
@@ -289,19 +289,19 @@ export function PullRequestActionToolbar(props: {
289
);
290
if (verticalControls)
291
return (
292
- <NativeHeaderToolbar placement="bottom">
292
+ <Toolbar placement="bottom">
293
{filesControl}
294
{agentControl}
295
{primaryControl}
296
- </NativeHeaderToolbar>
296
+ </Toolbar>
297
);
298
return (
299
- <NativeHeaderToolbar placement="bottom">
299
+ <Toolbar placement="bottom">
300
{agentControl}
301
- <NativeHeaderToolbar.Spacer flexible />
301
+ <Toolbar.Spacer flexible />
302
{primaryControl}
303
- <NativeHeaderToolbar.Spacer flexible />
303
+ <Toolbar.Spacer flexible />
304
{filesControl}
305
- </NativeHeaderToolbar>
305
+ </Toolbar>
306
);
307
}
apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx
+5
-4
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
3
import { useAtomRefresh } from "@effect/atom-react";
4
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
@@ -12,7 +13,7 @@ import { AppText as Text, AppTextInput as TextInput } from "../../components/App
13
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
14
import { Button } from "../../components/Button";
15
import { GlassSurface } from "../../components/GlassSurface";
15
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
16
+import { NativeStackScreenOptions } from "../../native/StackHeader";
17
import { relativeTime } from "../../lib/time";
18
import { composerPullRequests } from "../../state/pull-requests";
19
import { useAtomCommand } from "../../state/use-atom-command";
@@ -146,13 +147,13 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
147
/>
148
) : null}
149
{permissions.canResolve && thread ? (
149
- <NativeHeaderToolbar placement="right">
150
- <NativeHeaderToolbar.Button
150
+ <Toolbar placement="right">
151
+ <Toolbar.Button
152
label={resolveLabel}
153
disabled={busy || activity.isPending}
154
onPress={() => void toggleResolved()}
155
/>
155
- </NativeHeaderToolbar>
156
+ </Toolbar>
157
) : null}
158
<ScrollViewMarker style={{ flex: 1 }}>
159
<ScrollView
apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
+5
-4
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
3
import { usePullRequestConnected } from "./usePullRequestConnected";
4
import { useAtomValue } from "@effect/atom-react";
@@ -20,7 +21,7 @@ import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
21
import { EmptyState } from "../../components/EmptyState";
22
import { Button } from "../../components/Button";
23
import { SymbolView } from "../../components/AppSymbol";
23
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
24
+import { NativeStackScreenOptions } from "../../native/StackHeader";
25
import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
26
import { composerPullRequests } from "../../state/pull-requests";
27
import { useEnvironmentQuery } from "../../state/query";
@@ -140,13 +141,13 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
141
};
142
return (
143
<View className="flex-1 bg-sheet">
143
- <NativeHeaderToolbar placement="left">
144
- <NativeHeaderToolbar.Button
144
+ <Toolbar placement="left">
145
+ <Toolbar.Button
146
icon="xmark"
147
accessibilityLabel="Close request review"
148
onPress={() => navigation.goBack()}
149
/>
149
- </NativeHeaderToolbar>
150
+ </Toolbar>
151
<NativeStackScreenOptions
152
options={{
153
title: "Request review",
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+41
-48
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
3
import { Chip } from "../../components/Chip";
4
import { pullRequestTabOffset } from "./pullRequestTabScroll";
@@ -72,7 +73,7 @@ import { EmptyState } from "../../components/EmptyState";
73
import { SegmentedControl } from "../../components/SegmentedControl";
74
import { SymbolView } from "../../components/AppSymbol";
75
import { relativeTime } from "../../lib/time";
75
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
76
+import { NativeStackScreenOptions } from "../../native/StackHeader";
77
import { usePullRequestConnected } from "./usePullRequestConnected";
78
import { composerPullRequests } from "../../state/pull-requests";
79
import { useEnvironmentQuery } from "../../state/query";
@@ -446,44 +447,42 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
447
]}
448
/>
449
) : null}
449
- <NativeHeaderToolbar placement="right">
450
- <NativeHeaderToolbar.Menu
450
+ <Toolbar placement="right">
451
+ <Toolbar.Menu
452
title="Pull request"
453
accessibilityLabel="Pull request actions"
454
icon="ellipsis"
455
>
456
{permissions.verdicts.length ? (
456
- <NativeHeaderToolbar.MenuAction
457
+ <Toolbar.MenuAction
458
icon="text.bubble"
459
onPress={() =>
460
navigation.navigate("PullRequestReview", { ...params, mode: "review" })
461
}
462
>
462
- <NativeHeaderToolbar.Label>Submit review</NativeHeaderToolbar.Label>
463
- </NativeHeaderToolbar.MenuAction>
463
+ <Toolbar.Label>Submit review</Toolbar.Label>
464
+ </Toolbar.MenuAction>
465
) : null}
466
{permissions.canComment ? (
466
- <NativeHeaderToolbar.MenuAction
467
+ <Toolbar.MenuAction
468
icon="plus.bubble"
469
onPress={() =>
470
navigation.navigate("PullRequestReview", { ...params, mode: "comment" })
471
}
472
>
472
- <NativeHeaderToolbar.Label>Add comment</NativeHeaderToolbar.Label>
473
- </NativeHeaderToolbar.MenuAction>
473
+ <Toolbar.Label>Add comment</Toolbar.Label>
474
+ </Toolbar.MenuAction>
475
) : null}
476
{pr ? (
476
- <NativeHeaderToolbar.MenuAction
477
+ <Toolbar.MenuAction
478
icon="arrow.up.right"
479
onPress={() => void Linking.openURL(pr.url)}
480
>
480
- <NativeHeaderToolbar.Label>
481
- {openOnProviderLabel(pr.provider)}
482
- </NativeHeaderToolbar.Label>
483
- </NativeHeaderToolbar.MenuAction>
481
+ <Toolbar.Label>{openOnProviderLabel(pr.provider)}</Toolbar.Label>
482
+ </Toolbar.MenuAction>
483
) : null}
484
{showsDeleteBranch ? (
486
- <NativeHeaderToolbar.MenuAction
485
+ <Toolbar.MenuAction
486
icon={PR_ACTION_ICONS["delete-branch"]}
487
destructive
488
disabled={!action.available("delete-branch")}
@@ -496,13 +495,11 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
495
}
496
onPress={confirmDeleteBranch}
497
>
499
- <NativeHeaderToolbar.Label>
500
- {PR_ACTION_LABELS["delete-branch"]}
501
- </NativeHeaderToolbar.Label>
502
- </NativeHeaderToolbar.MenuAction>
498
+ <Toolbar.Label>{PR_ACTION_LABELS["delete-branch"]}</Toolbar.Label>
499
+ </Toolbar.MenuAction>
500
) : null}
504
- </NativeHeaderToolbar.Menu>
505
- </NativeHeaderToolbar>
501
+ </Toolbar.Menu>
502
+ </Toolbar>
503
<View
504
style={{
505
flex: 1,
@@ -1014,63 +1011,59 @@ export function PullRequestFileRouteScreen({
1011
}
1012
/>
1013
) : null}
1017
- <NativeHeaderToolbar placement="right">
1018
- <NativeHeaderToolbar.Menu
1019
- title="Diff options"
1020
- accessibilityLabel="Diff options"
1021
- icon="ellipsis"
1022
- >
1014
+ <Toolbar placement="right">
1015
+ <Toolbar.Menu title="Diff options" accessibilityLabel="Diff options" icon="ellipsis">
1016
{permissions.verdicts.length ? (
1024
- <NativeHeaderToolbar.MenuAction
1017
+ <Toolbar.MenuAction
1018
icon="text.bubble"
1019
onPress={() =>
1020
navigation.navigate("PullRequestReview", { ...route.params, mode: "review" })
1021
}
1022
>
1030
- <NativeHeaderToolbar.Label>Submit review</NativeHeaderToolbar.Label>
1031
- </NativeHeaderToolbar.MenuAction>
1023
+ <Toolbar.Label>Submit review</Toolbar.Label>
1024
+ </Toolbar.MenuAction>
1025
) : null}
1026
{permissions.canComment ? (
1034
- <NativeHeaderToolbar.MenuAction
1027
+ <Toolbar.MenuAction
1028
icon="plus.bubble"
1029
onPress={() =>
1030
navigation.navigate("PullRequestReview", { ...route.params, mode: "comment" })
1031
}
1032
>
1040
- <NativeHeaderToolbar.Label>Add comment</NativeHeaderToolbar.Label>
1041
- </NativeHeaderToolbar.MenuAction>
1033
+ <Toolbar.Label>Add comment</Toolbar.Label>
1034
+ </Toolbar.MenuAction>
1035
) : null}
1043
- <NativeHeaderToolbar.MenuAction
1036
+ <Toolbar.MenuAction
1037
icon="text.alignleft"
1038
isOn={appearance.codeWordBreak}
1039
onPress={() => setCodeWordBreak(!appearance.codeWordBreak)}
1040
>
1048
- <NativeHeaderToolbar.Label>Word wrap</NativeHeaderToolbar.Label>
1049
- </NativeHeaderToolbar.MenuAction>
1050
- <NativeHeaderToolbar.MenuAction
1041
+ <Toolbar.Label>Word wrap</Toolbar.Label>
1042
+ </Toolbar.MenuAction>
1043
+ <Toolbar.MenuAction
1044
icon="line.3.horizontal.decrease"
1045
isOn={filter.hideTestFiles}
1046
onPress={toggleTestFiles}
1047
>
1055
- <NativeHeaderToolbar.Label>Hide test files</NativeHeaderToolbar.Label>
1056
- </NativeHeaderToolbar.MenuAction>
1048
+ <Toolbar.Label>Hide test files</Toolbar.Label>
1049
+ </Toolbar.MenuAction>
1050
{selectedRow && selectedFile && canCommentOnDiff ? (
1058
- <NativeHeaderToolbar.MenuAction icon="bubble.left" onPress={() => commentOnLine()}>
1059
- <NativeHeaderToolbar.Label>
1051
+ <Toolbar.MenuAction icon="bubble.left" onPress={() => commentOnLine()}>
1052
+ <Toolbar.Label>
1053
{route.params.replacingDraftId ? "Move draft to this line" : "Add review comment"}
1061
- </NativeHeaderToolbar.Label>
1062
- </NativeHeaderToolbar.MenuAction>
1054
+ </Toolbar.Label>
1055
+ </Toolbar.MenuAction>
1056
) : null}
1057
{selectedRow && selectedFile ? (
1065
- <NativeHeaderToolbar.MenuAction
1058
+ <Toolbar.MenuAction
1059
icon="document.on.document"
1060
onPress={() => void Clipboard.setStringAsync(selectedRow.content ?? "")}
1061
>
1069
- <NativeHeaderToolbar.Label>Copy line</NativeHeaderToolbar.Label>
1070
- </NativeHeaderToolbar.MenuAction>
1062
+ <Toolbar.Label>Copy line</Toolbar.Label>
1063
+ </Toolbar.MenuAction>
1064
) : null}
1072
- </NativeHeaderToolbar.Menu>
1073
- </NativeHeaderToolbar>
1065
+ </Toolbar.Menu>
1066
+ </Toolbar>
1067
{route.params.replacingDraftId ? (
1068
<Text className="px-4 py-2 text-xs text-foreground-muted">
1069
Select a current line, then choose “Move draft to this line” from its menu.
apps/mobile/src/features/pull-requests/guide/PullRequestGuideScreen.tsx
+9
-12
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../../components/Toolbar";
2
import { parsePatchFiles } from "@pierre/diffs/utils/parsePatchFiles";
3
import type { FileDiffMetadata } from "@pierre/diffs";
4
import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
@@ -17,7 +18,7 @@ import { ScreenScrollView } from "../../../components/ScreenScrollView";
18
import { Menu } from "../../../components/Menu";
19
import { IconButton } from "../../../components/IconButton";
20
import { useAppearancePreferences } from "../../settings/appearance/AppearancePreferencesProvider";
20
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../../native/StackHeader";
21
+import { NativeStackScreenOptions } from "../../../native/StackHeader";
22
import { PullRequestCardGroup, PullRequestCardRow } from "../PullRequestControls";
23
import { PullRequestMarkdown, PullRequestMarkdownRepository } from "../PullRequestMarkdown";
24
import { usePullRequestDiff, type PullRequestParams } from "../usePullRequestDiff";
@@ -162,21 +163,17 @@ export function PullRequestGuideStopScreen({ route }: StaticScreenProps<GuideSto
163
}
164
/>
165
) : null}
165
- <NativeHeaderToolbar placement="right">
166
- <NativeHeaderToolbar.Menu
167
- title="Guide options"
168
- accessibilityLabel="Guide options"
169
- icon="ellipsis"
170
- >
171
- <NativeHeaderToolbar.MenuAction
166
+ <Toolbar placement="right">
167
+ <Toolbar.Menu title="Guide options" accessibilityLabel="Guide options" icon="ellipsis">
168
+ <Toolbar.MenuAction
169
icon="text.alignleft"
170
isOn={appearance.codeWordBreak}
171
onPress={() => setCodeWordBreak(!appearance.codeWordBreak)}
172
>
176
- <NativeHeaderToolbar.Label>Word wrap</NativeHeaderToolbar.Label>
177
- </NativeHeaderToolbar.MenuAction>
178
- </NativeHeaderToolbar.Menu>
179
- </NativeHeaderToolbar>
173
+ <Toolbar.Label>Word wrap</Toolbar.Label>
174
+ </Toolbar.MenuAction>
175
+ </Toolbar.Menu>
176
+ </Toolbar>
177
<PullRequestMarkdownRepository
178
params={route.params}
179
value={`https://${route.params.host ?? "github.com"}/${route.params.repository}`}
apps/mobile/src/features/settings/SettingsOpenSourceLicensesRouteScreen.tsx
+5
-4
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
3
import { LegendList } from "@legendapp/list/react-native";
4
import { type StaticScreenProps, useNavigation } from "@react-navigation/native";
@@ -15,7 +16,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
16
import { SymbolView } from "../../components/AppSymbol";
17
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
18
import { SettingsScreen } from "./components/SettingsScreen";
18
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
19
+import { NativeStackScreenOptions } from "../../native/StackHeader";
20
import {
21
createNativeMailSearchToolbarItem,
22
NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET,
@@ -140,9 +141,9 @@ export function SettingsOpenSourceLicensesRouteScreen() {
141
/>
142
) : null}
143
{Platform.OS === "ios" && !usesNativeMailSearchToolbar ? (
143
- <NativeHeaderToolbar placement="bottom">
144
- <NativeHeaderToolbar.SearchBarSlot />
145
- </NativeHeaderToolbar>
144
+ <Toolbar placement="bottom">
145
+ <Toolbar.SearchBarSlot />
146
+ </Toolbar>
147
) : null}
148
149
<LegendList
apps/mobile/src/features/settings/SettingsRouteScreen.tsx
+5
-4
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
3
import { useAuth, useUser } from "@clerk/expo";
4
import { useNavigation } from "@react-navigation/native";
@@ -7,7 +8,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
8
9
import { hasCloudPublicConfig } from "../cloud/publicConfig";
10
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
10
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
11
+import { NativeStackScreenOptions } from "../../native/StackHeader";
12
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
13
import { SettingsRow } from "./components/SettingsRow";
14
import { SettingsSection } from "./components/SettingsSection";
@@ -34,13 +35,13 @@ export function SettingsRouteScreen() {
35
) : null}
36
{Platform.OS === "ios" && layout.usesSplitView ? (
37
<>
37
- <NativeHeaderToolbar placement="left">
38
- <NativeHeaderToolbar.Button
38
+ <Toolbar placement="left">
39
+ <Toolbar.Button
40
accessibilityLabel="Go back"
41
icon="chevron.left"
42
onPress={() => navigation.goBack()}
43
/>
43
- </NativeHeaderToolbar>
44
+ </Toolbar>
45
</>
46
) : null}
47
<SettingsEnvironmentFilterHeader closeSettings />
apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx
+8
-7
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import {
3
DatePicker,
4
Host,
@@ -32,7 +33,7 @@ import { NavigationContainer, NavigationIndependentTree } from "@react-navigatio
33
import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
34
import { ScrollView, useWindowDimensions, View } from "react-native";
35
import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
35
-import { NativeHeaderToolbar } from "../../native/StackHeader";
36
+
37
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
38
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
39
@@ -249,16 +250,16 @@ function SnoozePopoverNavigation(props: {
250
<SnoozeStack.Screen name="CustomSnooze">
251
{() => (
252
<>
252
- <NativeHeaderToolbar placement="left">
253
- <NativeHeaderToolbar.Button
253
+ <Toolbar placement="left">
254
+ <Toolbar.Button
255
accessibilityLabel="Cancel custom snooze"
256
icon="xmark"
257
onPress={props.onClose}
258
/>
258
- </NativeHeaderToolbar>
259
- <NativeHeaderToolbar placement="right">
260
- <NativeHeaderToolbar.Button label="Snooze" onPress={props.onSubmit} />
261
- </NativeHeaderToolbar>
259
+ </Toolbar>
260
+ <Toolbar placement="right">
261
+ <Toolbar.Button label="Snooze" onPress={props.onSubmit} />
262
+ </Toolbar>
263
<ScrollView
264
contentInsetAdjustmentBehavior="automatic"
265
showsVerticalScrollIndicator={false}
apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
+5
-4
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import * as Dialog from "../../components/Dialog";
3
import { AppActivityIndicator } from "../../components/AppActivityIndicator";
4
import { NavigationRow } from "../../components/NavigationRow";
@@ -23,7 +24,7 @@ import { AppText as Text } from "../../components/AppText";
24
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
25
import { ThemedSwitch } from "../../components/ThemedSwitch";
26
import { cn } from "../../lib/cn";
26
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
27
+import { NativeStackScreenOptions } from "../../native/StackHeader";
28
import { useServerConfigs } from "../../state/entities";
29
import { useEnvironmentScope } from "../../state/session";
30
import { useAtomCommand } from "../../state/use-atom-command";
@@ -593,9 +594,9 @@ export function BranchPickerScreen(props: {
594
}}
595
/>
596
{usesNativeMailSearchToolbar ? null : (
596
- <NativeHeaderToolbar placement="bottom">
597
- <NativeHeaderToolbar.SearchBarSlot />
598
- </NativeHeaderToolbar>
597
+ <Toolbar placement="bottom">
598
+ <Toolbar.SearchBarSlot />
599
+ </Toolbar>
600
)}
601
{branchContent}
602
</>
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+5
-4
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import * as Dialog from "../../components/Dialog";
3
import { useAtomValue } from "@effect/atom-react";
4
import * as Cause from "effect/Cause";
@@ -8,7 +9,7 @@ import {
9
pastedTextDisposition,
10
replaceTextSelection,
11
} from "@t3tools/client-runtime/text-paste";
11
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
12
+import { NativeStackScreenOptions } from "../../native/StackHeader";
13
import {
14
CommonActions,
15
StackActions,
@@ -1896,13 +1897,13 @@ export function NewTaskDraftScreen(props: {
1897
title: "New thread",
1898
}}
1899
/>
1899
- <NativeHeaderToolbar placement="left">
1900
- <NativeHeaderToolbar.Button
1900
+ <Toolbar placement="left">
1901
+ <Toolbar.Button
1902
accessibilityLabel="Cancel new task"
1903
label="Cancel"
1904
onPress={closeNewTask}
1905
/>
1905
- </NativeHeaderToolbar>
1906
+ </Toolbar>
1907
1908
{heroViewport}
1909
<KeyboardStickyView
apps/mobile/src/features/threads/ThreadGitControls.tsx
+21
-22
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import * as Dialog from "../../components/Dialog";
3
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
4
import { createNativeHeaderMenu } from "../../components/nativeHeaderMenu.ios";
@@ -16,7 +17,7 @@ import {
17
resolveQuickAction,
18
} from "@t3tools/client-runtime/state/vcs";
19
import { useNavigation } from "@react-navigation/native";
19
-import { NativeHeaderToolbar } from "../../native/StackHeader";
20
+
21
import { useCallback, useMemo } from "react";
22
import { useEnvironmentScope } from "../../state/session";
23
import {
@@ -458,9 +459,9 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
459
}
460
461
return (
461
- <NativeHeaderToolbar placement="right">
462
+ <Toolbar placement="right">
463
{showActionControls && props.auxiliaryPaneControl ? (
463
- <NativeHeaderToolbar.Button
464
+ <Toolbar.Button
465
accessibilityLabel={props.auxiliaryPaneControl.accessibilityLabel}
466
icon="sidebar.right"
467
onPress={props.auxiliaryPaneControl.onPress}
@@ -468,7 +469,7 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
469
/>
470
) : null}
471
{showActionControls ? (
471
- <NativeHeaderToolbar.Menu
472
+ <Toolbar.Menu
473
accessibilityLabel="Open terminal"
474
icon="terminal"
475
disabled={!props.canOpenTerminal}
@@ -476,30 +477,28 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
477
>
478
{props.projectScripts.length > 0 ? (
479
props.projectScripts.map((script) => (
479
- <NativeHeaderToolbar.MenuAction
480
+ <Toolbar.MenuAction
481
key={script.id}
482
icon={projectScriptMenuIcon(script.icon)}
483
disabled={!props.canOperateTerminal}
484
onPress={() => void props.onRunProjectScript(script)}
485
subtitle={script.command}
486
>
486
- <NativeHeaderToolbar.Label>
487
- {projectScriptMenuLabel(script)}
488
- </NativeHeaderToolbar.Label>
489
- </NativeHeaderToolbar.MenuAction>
487
+ <Toolbar.Label>{projectScriptMenuLabel(script)}</Toolbar.Label>
488
+ </Toolbar.MenuAction>
489
))
490
) : (
492
- <NativeHeaderToolbar.MenuAction
491
+ <Toolbar.MenuAction
492
icon="play"
493
disabled
494
onPress={() => {}}
495
subtitle="This project has no saved scripts yet"
496
>
498
- <NativeHeaderToolbar.Label>No project scripts</NativeHeaderToolbar.Label>
499
- </NativeHeaderToolbar.MenuAction>
497
+ <Toolbar.Label>No project scripts</Toolbar.Label>
498
+ </Toolbar.MenuAction>
499
)}
500
{props.terminalSessions.map((session) => (
502
- <NativeHeaderToolbar.MenuAction
501
+ <Toolbar.MenuAction
502
key={session.terminalId}
503
icon="terminal"
504
onPress={() => props.onOpenTerminal(session.terminalId)}
@@ -513,21 +512,21 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
512
.filter(Boolean)
513
.join(" · ")}
514
>
516
- <NativeHeaderToolbar.Label>{session.displayLabel}</NativeHeaderToolbar.Label>
517
- </NativeHeaderToolbar.MenuAction>
515
+ <Toolbar.Label>{session.displayLabel}</Toolbar.Label>
516
+ </Toolbar.MenuAction>
517
))}
519
- <NativeHeaderToolbar.MenuAction
518
+ <Toolbar.MenuAction
519
icon="plus"
520
disabled={!props.canOperateTerminal}
521
onPress={props.onOpenNewTerminal}
522
subtitle="Start another shell for this thread"
523
>
525
- <NativeHeaderToolbar.Label>Open new terminal</NativeHeaderToolbar.Label>
526
- </NativeHeaderToolbar.MenuAction>
527
- </NativeHeaderToolbar.Menu>
524
+ <Toolbar.Label>Open new terminal</Toolbar.Label>
525
+ </Toolbar.MenuAction>
526
+ </Toolbar.Menu>
527
) : null}
528
{showActionControls && props.showDirectFileControl ? (
530
- <NativeHeaderToolbar.Button
529
+ <Toolbar.Button
530
accessibilityLabel="Open files"
531
disabled={!props.canOpenFiles}
532
icon="folder"
@@ -536,13 +535,13 @@ export function ThreadGitControls(props: ThreadGitControlsProps) {
535
/>
536
) : null}
537
{showActionControls ? createNativeHeaderMenu(threadGitMenuDefinition(props, model)) : null}
539
- </NativeHeaderToolbar>
538
+ </Toolbar>
539
);
540
}
541
542
/**
543
* The standalone git actions menu (branch status, quick commit/push action,
545
- * review, more). Rendered inside a NativeHeaderToolbar by both the thread
544
+ * review, more). Rendered inside a Toolbar by both the thread
545
* chat header and the review screen's toolbar.
546
*/
547
export function ThreadGitMenu(props: ThreadGitMenuProps) {
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+23
-26
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import * as Dialog from "../../components/Dialog";
3
import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
4
import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts";
@@ -60,11 +61,7 @@ import { applyProviderOptionSelection } from "../../lib/providerOptions";
61
import { resolveProviderOptionDescriptors } from "../../lib/providerOptions";
62
import { useUniwindTheme } from "../../lib/useUniwindTheme";
63
import { rememberModelOptions } from "../../state/use-model-option-memory";
63
-import {
64
- NativeHeaderToolbar,
65
- NativeStackScreenOptions,
66
- nativeHeaderScrollEdgeEffects,
67
-} from "../../native/StackHeader";
64
+import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
65
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
66
import { ChatGptSharingStatus } from "./ChatGptSharingStatus";
67
import { environmentServerConfigsAtom, serverEnvironment } from "../../state/server";
@@ -1415,23 +1412,23 @@ function ThreadSettingsModelsScreen() {
1412
}}
1413
/>
1414
</ScreenContent>
1418
- <NativeHeaderToolbar placement="left">
1419
- <NativeHeaderToolbar.Button
1415
+ <Toolbar placement="left">
1416
+ <Toolbar.Button
1417
accessibilityLabel="Cancel thread settings"
1418
label="Cancel"
1419
onPress={presentation.onClose}
1420
/>
1424
- </NativeHeaderToolbar>
1425
- <NativeHeaderToolbar placement="right">
1426
- <NativeHeaderToolbar.Button
1421
+ </Toolbar>
1422
+ <Toolbar placement="right">
1423
+ <Toolbar.Button
1424
accessibilityLabel={session.pendingModel ? "Save thread settings" : "Done"}
1425
label={session.pendingModel ? "Save" : "Done"}
1426
onPress={commitAndClose}
1427
/>
1431
- </NativeHeaderToolbar>
1428
+ </Toolbar>
1429
{Platform.OS === "ios" && !usesNativeMailSearchToolbar ? (
1433
- <NativeHeaderToolbar placement="bottom">
1434
- <NativeHeaderToolbar.Menu
1430
+ <Toolbar placement="bottom">
1431
+ <Toolbar.Menu
1432
accessibilityLabel="Filter models"
1433
icon={
1434
hasCustomCatalogFilter
@@ -1441,40 +1438,40 @@ function ThreadSettingsModelsScreen() {
1438
separateBackground
1439
title="Model filters"
1440
>
1444
- <NativeHeaderToolbar.Menu title="Provider">
1445
- <NativeHeaderToolbar.Label>Provider</NativeHeaderToolbar.Label>
1446
- <NativeHeaderToolbar.MenuAction
1441
+ <Toolbar.Menu title="Provider">
1442
+ <Toolbar.Label>Provider</Toolbar.Label>
1443
+ <Toolbar.MenuAction
1444
isOn={session.providerFilter === null}
1445
onPress={() => session.setProviderFilter(null)}
1446
>
1447
All providers
1451
- </NativeHeaderToolbar.MenuAction>
1452
- <NativeHeaderToolbar.MenuAction
1448
+ </Toolbar.MenuAction>
1449
+ <Toolbar.MenuAction
1450
isOn={session.providerFilter === FAVORITES_PROVIDER_FILTER}
1451
onPress={() => session.setProviderFilter(FAVORITES_PROVIDER_FILTER)}
1452
>
1453
Favorites
1457
- </NativeHeaderToolbar.MenuAction>
1454
+ </Toolbar.MenuAction>
1455
{session.providerGroups.map((group) => (
1459
- <NativeHeaderToolbar.MenuAction
1456
+ <Toolbar.MenuAction
1457
key={group.providerKey}
1458
isOn={session.providerFilter === group.providerKey}
1459
onPress={() => session.setProviderFilter(group.providerKey)}
1460
>
1461
{group.providerLabel}
1465
- </NativeHeaderToolbar.MenuAction>
1462
+ </Toolbar.MenuAction>
1463
))}
1467
- </NativeHeaderToolbar.Menu>
1464
+ </Toolbar.Menu>
1465
{session.hasLegacyModels ? (
1469
- <NativeHeaderToolbar.MenuAction
1466
+ <Toolbar.MenuAction
1467
isOn={session.showLegacy}
1468
onPress={() => session.setShowLegacy(!session.showLegacy)}
1469
>
1470
Show legacy models
1474
- </NativeHeaderToolbar.MenuAction>
1471
+ </Toolbar.MenuAction>
1472
) : null}
1476
- </NativeHeaderToolbar.Menu>
1477
- </NativeHeaderToolbar>
1473
+ </Toolbar.Menu>
1474
+ </Toolbar>
1475
) : null}
1476
</>
1477
);
apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx
+10
-9
@@ -1,3 +1,4 @@
1
+import { Toolbar } from "../../components/Toolbar";
2
import { useFocusEffect, useNavigation } from "@react-navigation/native";
3
import { use, useCallback, useEffect, useRef } from "react";
4
import { Platform } from "react-native";
@@ -5,7 +6,7 @@ import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
6
import type { SearchBarCommands } from "react-native-screens";
7
8
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
8
-import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
9
+import { NativeStackScreenOptions } from "../../native/StackHeader";
10
import { NativeWorkspaceTabActivityContext } from "../../native/v5-workspace-context";
11
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
12
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
@@ -101,8 +102,8 @@ export function WorkspaceToolbar(props: {
102
}}
103
/>
104
{/* UIKit lays trailing items out from the edge inward. */}
104
- <NativeHeaderToolbar placement="right">
105
- <NativeHeaderToolbar.Button
105
+ <Toolbar placement="right">
106
+ <Toolbar.Button
107
accessibilityLabel="Settings"
108
icon="gearshape"
109
onPress={() =>
@@ -113,7 +114,7 @@ export function WorkspaceToolbar(props: {
114
}
115
/>
116
{NATIVE_LIQUID_GLASS_SUPPORTED ? null : (
116
- <NativeHeaderToolbar.Button
117
+ <Toolbar.Button
118
accessibilityLabel={
119
selectedTab === "pullRequests" ? "Search pull requests" : "Search threads"
120
}
@@ -121,11 +122,11 @@ export function WorkspaceToolbar(props: {
122
onPress={focusSearch}
123
/>
124
)}
124
- </NativeHeaderToolbar>
125
- <NativeHeaderToolbar placement="bottom">
126
- {nativeToolbarCompose ? <NativeHeaderToolbar.Spacer flexible /> : null}
125
+ </Toolbar>
126
+ <Toolbar placement="bottom">
127
+ {nativeToolbarCompose ? <Toolbar.Spacer flexible /> : null}
128
{nativeToolbarCompose ? (
128
- <NativeHeaderToolbar.Button
129
+ <Toolbar.Button
130
identifier="workspace-compose"
131
accessibilityLabel="New chat"
132
icon="square.and.pencil"
@@ -133,7 +134,7 @@ export function WorkspaceToolbar(props: {
134
separateBackground
135
/>
136
) : null}
136
- </NativeHeaderToolbar>
137
+ </Toolbar>
138
</>
139
);
140
}
apps/mobile/src/native/NativeHeaderToolbar.android.tsx
+5
@@ -18,6 +18,10 @@ function NativeHeaderToolbarMenuAction(
18
return null;
19
}
20
21
+function NativeHeaderToolbarCustom(_props: Parameters<typeof IosNativeHeaderToolbar.Custom>[0]) {
22
+ return null;
23
+}
24
+
25
function NativeHeaderToolbarLabel(_props: Parameters<typeof IosNativeHeaderToolbar.Label>[0]) {
26
return null;
27
}
@@ -33,6 +37,7 @@ function NativeHeaderToolbarSearchBarSlot() {
37
// Native header item factories are iOS-only; Android owns its in-flow header.
38
export const NativeHeaderToolbar = Object.assign(NativeHeaderToolbarRoot, {
39
Button: NativeHeaderToolbarButton,
40
+ Custom: NativeHeaderToolbarCustom,
41
Label: NativeHeaderToolbarLabel,
42
Menu: Object.assign(NativeHeaderToolbarMenu, {
43
Action: NativeHeaderToolbarMenuAction,