The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): standardize shared button states and adoption (#18530)
Julius Marminge committed
Oct 15, 2026 at 15:46 UTC
2bcc5cc94d505fed94422dceba234f719dad26d1
23 files changed
+431
-410
apps/mobile/src/components/Button.android.tsx
renamed
+40
-18
@@ -1,10 +1,12 @@
1
+import { SymbolView } from "./AppSymbol";
2
import {
3
Box,
3
- Button,
4
+ Button as ComposeButton,
5
LoadingIndicator,
6
FilledTonalButton,
7
Host,
8
Row,
9
+ RNHostView,
10
Text,
11
TextButton,
12
} from "@expo/ui/jetpack-compose";
@@ -13,37 +15,42 @@ import { View } from "react-native";
15
16
import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
17
import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
16
-import type { MaterialButtonProps } from "./MaterialButton";
18
+import type { ButtonProps } from "./Button";
19
import { useAndroidControlSizing } from "./useAndroidControlSizing";
20
19
-export function MaterialButton(props: MaterialButtonProps) {
21
+export function Button(props: ButtonProps) {
22
const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
23
const typography = useScaledTextRole("footnote");
24
const { scale, mediumIconSize } = useAndroidControlSizing();
25
const tone = props.tone ?? "secondary";
26
const Component =
25
- tone === "text" ? TextButton : tone === "secondary" ? FilledTonalButton : Button;
27
+ tone === "text" ? TextButton : tone === "secondary" ? FilledTonalButton : ComposeButton;
28
const containerColor =
27
- tone === "primary"
28
- ? colors["--color-primary"]
29
- : tone === "danger"
30
- ? colors["--color-danger"]
31
- : tone === "text"
32
- ? "#00000000"
33
- : colors["--color-secondary"];
29
+ tone === "contrast"
30
+ ? colors["--color-foreground"]
31
+ : tone === "primary"
32
+ ? colors["--color-primary"]
33
+ : tone === "danger"
34
+ ? colors["--color-danger"]
35
+ : tone === "text"
36
+ ? "#00000000"
37
+ : colors["--color-secondary"];
38
const contentColor =
35
- tone === "primary"
36
- ? colors["--color-primary-foreground"]
37
- : tone === "danger"
38
- ? colors["--color-danger-foreground"]
39
- : tone === "text"
40
- ? colors["--color-primary-text"]
41
- : colors["--color-secondary-foreground"];
39
+ tone === "contrast"
40
+ ? colors["--color-screen"]
41
+ : tone === "primary"
42
+ ? colors["--color-primary-foreground"]
43
+ : tone === "danger"
44
+ ? colors["--color-danger-foreground"]
45
+ : tone === "text"
46
+ ? colors["--color-primary-text"]
47
+ : colors["--color-secondary-foreground"];
48
return (
49
<View
50
accessible
51
accessibilityRole="button"
52
accessibilityLabel={props.label}
53
+ accessibilityHint={props.accessibilityHint}
54
accessibilityState={{
55
disabled: Boolean(props.disabled || props.loading),
56
busy: Boolean(props.loading),
@@ -84,6 +91,21 @@ export function MaterialButton(props: MaterialButtonProps) {
91
/>
92
<Box modifiers={[size(8 * scale, 1)]} />
93
</>
94
+ ) : props.icon ? (
95
+ <>
96
+ <RNHostView matchContents modifiers={[size(mediumIconSize, mediumIconSize)]}>
97
+ <View style={{ width: mediumIconSize, height: mediumIconSize }}>
98
+ <SymbolView
99
+ name={props.icon}
100
+ size={mediumIconSize}
101
+ tintColor={
102
+ props.disabled ? colors["--color-foreground-muted"] : contentColor
103
+ }
104
+ />
105
+ </View>
106
+ </RNHostView>
107
+ <Box modifiers={[size(8 * scale, 1)]} />
108
+ </>
109
) : null}
110
<Text style={{ ...typography, fontWeight: "500" }}>{props.label}</Text>
111
</Row>
apps/mobile/src/components/Button.tsx
renamed
+22
-5
@@ -1,11 +1,15 @@
1
+import { SymbolView, type AppSymbolName } from "./AppSymbol";
2
import { Pressable } from "react-native";
3
+import { AppActivityIndicator } from "./AppActivityIndicator";
4
import { AppText } from "./AppText";
5
import { cn } from "../lib/cn";
6
5
-export interface MaterialButtonProps {
7
+export interface ButtonProps {
8
readonly label: string;
9
+ readonly icon?: AppSymbolName;
10
readonly onPress: () => void;
11
readonly disabled?: boolean;
12
+ readonly accessibilityHint?: string;
13
readonly loading?: boolean;
14
readonly tone?: "primary" | "secondary" | "danger" | "text" | "contrast";
15
readonly fullWidth?: boolean;
@@ -19,24 +23,37 @@ const TONE_CLASS_NAMES = {
23
text: ["bg-transparent", "text-primary-text"],
24
} as const;
25
22
-export function MaterialButton(props: MaterialButtonProps) {
26
+export function Button(props: ButtonProps) {
27
const [containerClassName, labelClassName] = TONE_CLASS_NAMES[props.tone ?? "secondary"];
28
const disabled = Boolean(props.disabled || props.loading);
29
return (
30
<Pressable
31
accessibilityRole="button"
28
- accessibilityState={{ disabled }}
32
+ accessibilityLabel={props.label}
33
+ accessibilityHint={props.accessibilityHint}
34
+ accessibilityState={{ disabled, busy: Boolean(props.loading) }}
35
disabled={disabled}
36
onPress={props.onPress}
37
className={cn(
32
- "min-h-12 justify-center rounded-full px-6 active:opacity-70",
38
+ "min-h-12 flex-row items-center justify-center gap-2 rounded-full px-6 active:opacity-70",
39
props.fullWidth ? "w-full" : "self-start",
40
disabled ? "bg-subtle-strong" : containerClassName,
41
)}
42
>
43
+ {props.loading ? (
44
+ <AppActivityIndicator colorClassName="accent-foreground-muted" />
45
+ ) : props.icon ? (
46
+ <SymbolView
47
+ name={props.icon}
48
+ size={18}
49
+ tintColorClassName={
50
+ disabled ? "accent-foreground-muted" : labelClassName.replace("text-", "accent-")
51
+ }
52
+ />
53
+ ) : null}
54
<AppText
55
className={cn(
39
- "text-center font-t3-medium",
56
+ "min-w-0 shrink text-center font-t3-medium",
57
disabled ? "text-foreground-muted" : labelClassName,
58
)}
59
>
apps/mobile/src/components/ControlPill.tsx
+2
-2
@@ -4,7 +4,7 @@ import { cn } from "../lib/cn";
4
import { SymbolView } from "./AppSymbol";
5
import { AppText as Text } from "./AppText";
6
import { MaterialIconButton } from "./MaterialIconButton";
7
-import { MaterialButton } from "./MaterialButton";
7
+import { Button } from "./Button";
8
import { useAndroidControlSizing } from "./useAndroidControlSizing";
9
10
export { ControlPillMenu } from "./ControlPillMenu";
@@ -91,7 +91,7 @@ export function ControlPill(props: {
91
(!props.accessibilityLabel || props.accessibilityLabel === props.label)
92
) {
93
return (
94
- <MaterialButton
94
+ <Button
95
label={props.label}
96
onPress={props.onPress}
97
disabled={props.disabled}
apps/mobile/src/components/EmptyState.tsx
+8
-15
@@ -1,7 +1,8 @@
1
-import { Pressable, View } from "react-native";
1
+import { View } from "react-native";
2
import type { ReactNode } from "react";
3
4
import { AppText as Text } from "./AppText";
5
+import { Button } from "./Button";
6
7
export function EmptyState(props: {
8
readonly title: string;
@@ -21,14 +22,9 @@ export function EmptyState(props: {
22
{props.action ? (
23
<View className="mt-5">{props.action}</View>
24
) : props.actionLabel && props.onAction ? (
24
- <Pressable
25
- className="mt-5 rounded-full bg-primary px-5 py-3 active:opacity-70"
26
- onPress={props.onAction}
27
- >
28
- <Text className="text-sm font-t3-bold text-primary-foreground">
29
- {props.actionLabel}
30
- </Text>
31
- </Pressable>
25
+ <View className="mt-5">
26
+ <Button tone="primary" label={props.actionLabel} onPress={props.onAction} />
27
+ </View>
28
) : null}
29
</View>
30
);
@@ -43,12 +39,9 @@ export function EmptyState(props: {
39
{props.action ? (
40
<View className="mt-4 self-start">{props.action}</View>
41
) : props.actionLabel && props.onAction ? (
46
- <Pressable
47
- className="mt-4 self-start rounded-full bg-primary px-4 py-2.5 active:opacity-70"
48
- onPress={props.onAction}
49
- >
50
- <Text className="text-sm font-t3-bold text-primary-foreground">{props.actionLabel}</Text>
51
- </Pressable>
42
+ <View className="mt-4 self-start">
43
+ <Button tone="primary" label={props.actionLabel} onPress={props.onAction} />
44
+ </View>
45
) : null}
46
</View>
47
);
apps/mobile/src/components/RenderErrorBoundary.tsx
+4
-9
@@ -2,7 +2,7 @@ import { Component, type ReactNode } from "react";
2
import { ScrollView, View } from "react-native";
3
4
import { AppText as Text } from "./AppText";
5
-import { MaterialButton } from "./MaterialButton";
5
+import { Button } from "./Button";
6
import { copyTextWithHaptic } from "../lib/copyTextWithHaptic";
7
8
interface RenderErrorBoundaryProps {
@@ -107,19 +107,14 @@ export function RenderFailureView(
107
{props.details.split("\n", 1)[0]?.slice(0, 300)}
108
</Text>
109
<View className="w-full max-w-xs gap-2">
110
- <MaterialButton label="Try again" onPress={props.retry} tone="primary" fullWidth />
111
- <MaterialButton
110
+ <Button label="Try again" onPress={props.retry} tone="primary" fullWidth />
111
+ <Button
112
label="Copy details"
113
onPress={() => copyTextWithHaptic(props.details, { target: "error details" })}
114
fullWidth
115
/>
116
{props.exit ? (
117
- <MaterialButton
118
- label={props.exit.label}
119
- onPress={props.exit.onPress}
120
- tone="text"
121
- fullWidth
122
- />
117
+ <Button label={props.exit.label} onPress={props.exit.onPress} tone="text" fullWidth />
118
) : null}
119
</View>
120
</ScrollView>
apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx
+2
-2
@@ -11,7 +11,7 @@ import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanim
11
12
import { AppText as Text } from "../../components/AppText";
13
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
14
-import { MaterialButton } from "../../components/MaterialButton";
14
+import { Button } from "../../components/Button";
15
import { MaterialIconButton } from "../../components/MaterialIconButton";
16
import { ThemedSwitch } from "../../components/ThemedSwitch";
17
import { cn } from "../../lib/cn";
@@ -185,7 +185,7 @@ export function ConnectionEnvironmentRow(props: {
185
<View className="flex-row items-center justify-end gap-2">
186
{props.environment.isRelayManaged ? null : (
187
<View className="flex-1">
188
- <MaterialButton
188
+ <Button
189
label="Save"
190
tone="primary"
191
fullWidth
apps/mobile/src/features/projects/AddProjectScreen.test.ts
+1
-1
@@ -25,7 +25,7 @@ vi.mock("react", async (importOriginal) => ({
25
useEffect: () => {},
26
}));
27
vi.mock("../../components/MaterialListRow", () => ({ MaterialListRow: "MaterialListRow" }));
28
-vi.mock("../../components/MaterialButton", () => ({ MaterialButton: "MaterialButton" }));
28
+vi.mock("../../components/Button", () => ({ Button: "Button" }));
29
vi.mock("../../components/ScreenScrollView", () => ({ ScreenScrollView: "ScrollView" }));
30
vi.mock("../settings/components/SettingsScreen", () => ({ SettingsScreen: "SettingsScreen" }));
31
vi.mock("../../components/ThemedSwitch", () => ({ ThemedSwitch: "Switch" }));
apps/mobile/src/features/projects/AddProjectScreen.tsx
+2
-2
@@ -2,7 +2,7 @@ import { AppActivityIndicator } from "../../components/AppActivityIndicator";
2
import { MaterialListRow } from "../../components/MaterialListRow";
3
import { SettingsScreen } from "../settings/components/SettingsScreen";
4
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
5
-import { MaterialButton } from "../../components/MaterialButton";
5
+import { Button } from "../../components/Button";
6
import {
7
addProjectRemoteSourceLabel,
8
addProjectRemoteSourcePathHint,
@@ -263,7 +263,7 @@ function PrimaryActionButton(props: {
263
readonly loading?: boolean;
264
readonly onPress: () => void;
265
}) {
266
- if (Platform.OS === "android") return <MaterialButton {...props} tone="primary" fullWidth />;
266
+ if (Platform.OS === "android") return <Button {...props} tone="primary" fullWidth />;
267
return (
268
<Pressable
269
disabled={props.disabled}
apps/mobile/src/features/pull-requests/PullRequestControls.tsx
+2
-2
@@ -7,7 +7,7 @@ import { Platform, Pressable, View } from "react-native";
7
import { useSafeAreaInsets } from "react-native-safe-area-context";
8
import { AppText as Text } from "../../components/AppText";
9
import { SymbolView, type AppSymbolName } from "../../components/AppSymbol";
10
-import { MaterialButton } from "../../components/MaterialButton";
10
+import { Button } from "../../components/Button";
11
import { MaterialIconButton } from "../../components/MaterialIconButton";
12
import { MaterialFloatingToolbar } from "./MaterialFloatingToolbar";
13
import { ControlPillMenu } from "../../components/ControlPillMenu";
@@ -137,7 +137,7 @@ export function PullRequestActionToolbar(props: {
137
const showPrimary = pendingReview || canOpenThread;
138
if (Platform.OS === "android") {
139
const primary = (
140
- <MaterialButton
140
+ <Button
141
label={primaryLabel}
142
tone="primary"
143
disabled={primaryDisabled}
apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx
+4
-4
@@ -9,7 +9,7 @@ import { NativeScrollViewMarker as ScrollViewMarker } from "../../native/NativeS
9
import { useSafeAreaInsets } from "react-native-safe-area-context";
10
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
11
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
12
-import { MaterialButton } from "../../components/MaterialButton";
12
+import { Button } from "../../components/Button";
13
import { GlassSurface } from "../../components/GlassSurface";
14
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
15
import { relativeTime } from "../../lib/time";
@@ -174,7 +174,7 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
174
{thread.isResolved ? "Resolved" : "Unresolved"}
175
{thread.isOutdated ? " · Outdated" : ""}
176
</Text>
177
- <MaterialButton
177
+ <Button
178
label="View file diff"
179
onPress={() =>
180
navigation.navigate("PullRequestFile", { ...params, path: thread.path })
@@ -199,7 +199,7 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
199
</View>
200
))}
201
{nextCursor ? (
202
- <MaterialButton
202
+ <Button
203
label={busy ? "Loading…" : "Load more replies"}
204
disabled={busy}
205
onPress={() => void more()}
@@ -232,7 +232,7 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
232
className="max-h-36 min-h-12 min-w-0 flex-1 rounded-[24px] border-0 bg-transparent px-4 py-3 text-base text-foreground"
233
/>
234
<View>
235
- <MaterialButton
235
+ <Button
236
label={busy ? "Posting…" : "Reply"}
237
tone="contrast"
238
disabled={busy || !body.trim()}
apps/mobile/src/features/pull-requests/PullRequestFiles.tsx
+2
-8
@@ -8,7 +8,7 @@ import { ActivityIndicator, Pressable, View } from "react-native";
8
import { AppText as Text } from "../../components/AppText";
9
import { EmptyState } from "../../components/EmptyState";
10
import { ControlPillMenu } from "../../components/ControlPillMenu";
11
-import { MaterialButton } from "../../components/MaterialButton";
11
+import { Button } from "../../components/Button";
12
import { MaterialIconButton } from "../../components/MaterialIconButton";
13
import { SymbolView } from "../../components/AppSymbol";
14
import { PierreEntryIcon } from "../../components/PierreEntryIcon";
@@ -242,13 +242,7 @@ export function usePullRequestFilesContent(props: {
242
result.nextCursor ? "No non-test files loaded yet" : "Only test files changed"
243
}
244
detail="Test files are hidden from this review."
245
- action={
246
- <MaterialButton
247
- label="Show test files"
248
- tone="contrast"
249
- onPress={filter.showAll}
250
- />
251
- }
245
+ action={<Button label="Show test files" tone="contrast" onPress={filter.showAll} />}
246
variant="plain"
247
/>
248
) : null}
apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx
+3
-3
@@ -3,7 +3,7 @@ import { useCallback, useRef, useState } from "react";
3
import { Alert, View } from "react-native";
4
import type { PullRequestReviewPosition } from "@t3tools/contracts";
5
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
6
-import { MaterialButton } from "../../components/MaterialButton";
6
+import { Button } from "../../components/Button";
7
import { uuidv4 } from "../../lib/uuid";
8
import { composerPullRequests } from "../../state/pull-requests";
9
import { useEnvironmentQuery } from "../../state/query";
@@ -77,7 +77,7 @@ export function PullRequestInlineCommentScreen({ route }: StaticScreenProps<Inli
77
title={saved ? "Edit review comment" : "Review comment"}
78
subtitle={`#${params.number} · ${reviewPositionLabel(params.position)}`}
79
footer={
80
- <MaterialButton
80
+ <Button
81
fullWidth
82
tone="contrast"
83
label={busy ? "Saving…" : "Save draft"}
@@ -125,7 +125,7 @@ export function PullRequestInlineCommentScreen({ route }: StaticScreenProps<Inli
125
<Text className="text-sm text-danger-foreground">{store.error ?? detail.error}</Text>
126
) : null}
127
{saved ? (
128
- <MaterialButton
128
+ <Button
129
label="Delete draft"
130
onPress={() =>
131
Alert.alert("Delete this draft?", "Your other review comments will be kept.", [
apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx
+2
-2
@@ -7,7 +7,7 @@ import { ActivityIndicator, Alert, Platform, Pressable, View } from "react-nativ
7
import { AppText as Text } from "../../components/AppText";
8
import { SymbolView } from "../../components/AppSymbol";
9
import { ControlPillMenu } from "../../components/ControlPillMenu";
10
-import { MaterialButton } from "../../components/MaterialButton";
10
+import { Button } from "../../components/Button";
11
import { MaterialIconButton } from "../../components/MaterialIconButton";
12
import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
13
import { composerPullRequests } from "../../state/pull-requests";
@@ -174,7 +174,7 @@ export function PullRequestMergeControls(props: {
174
>
175
{Platform.OS === "android" ? (
176
<View className="min-w-0 flex-1">
177
- <MaterialButton
177
+ <Button
178
label={busy ? "Working…" : !permissions.connected ? "Reconnect to merge" : label}
179
tone="primary"
180
fullWidth
apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx
+2
-2
@@ -10,7 +10,7 @@ import { clearSubmittedReview } from "./pullRequestReviewDrafts";
10
import { usePullRequestReviewDraft } from "./usePullRequestReviewDraft";
11
import { reviewPositionLabel } from "./pullRequestDiffComments";
12
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
13
-import { MaterialButton } from "../../components/MaterialButton";
13
+import { Button } from "../../components/Button";
14
import { SegmentedControl } from "../../components/SegmentedControl";
15
import { composerPullRequests } from "../../state/pull-requests";
16
import { useEnvironmentQuery } from "../../state/query";
@@ -134,7 +134,7 @@ export function PullRequestReviewSheet({
134
subtitle={`#${params.number}${reviewing && result.data?.headSha ? ` · reviewing ${result.data.headSha.slice(0, 7)}` : ` · ${params.repository}`}`}
135
busy={submission.busy}
136
footer={
137
- <MaterialButton
137
+ <Button
138
label={
139
submission.busy
140
? "Submitting…"
apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
+4
-4
@@ -18,7 +18,7 @@ import { ScrollViewMarker } from "react-native-screens";
18
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
19
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
20
import { EmptyState } from "../../components/EmptyState";
21
-import { MaterialButton } from "../../components/MaterialButton";
21
+import { Button } from "../../components/Button";
22
import { SymbolView } from "../../components/AppSymbol";
23
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
24
import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
@@ -259,7 +259,7 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
259
detail={result.error ?? "Search people and teams with access to this repository."}
260
variant="plain"
261
/>
262
- {result.error ? <MaterialButton label="Retry" onPress={result.refresh} /> : null}
262
+ {result.error ? <Button label="Retry" onPress={result.refresh} /> : null}
263
</View>
264
)
265
}
@@ -302,13 +302,13 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
302
autoCorrect={false}
303
className="min-h-12 rounded-xl bg-grouped-card px-3 text-base"
304
/>
305
- <MaterialButton
305
+ <Button
306
label="Request review"
307
fullWidth
308
disabled={!allowed || !query.trim() || pending !== null}
309
onPress={() => void update({ id: query.trim(), kind: "user", isRequested: false })}
310
/>
311
- <MaterialButton
311
+ <Button
312
label="Remove review request"
313
fullWidth
314
tone="text"
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+3
-5
@@ -26,7 +26,7 @@ import {
26
import * as Clipboard from "expo-clipboard";
27
import { ControlPillMenu } from "../../components/ControlPillMenu";
28
import { MaterialIconButton } from "../../components/MaterialIconButton";
29
-import { MaterialButton } from "../../components/MaterialButton";
29
+import { Button } from "../../components/Button";
30
import { usePullRequestReviewDraft } from "./usePullRequestReviewDraft";
31
import { usePullRequestFilesViewed } from "./usePullRequestFilesViewed";
32
import { usePullRequestPermissions } from "./usePullRequestPermissions";
@@ -1088,7 +1088,7 @@ export function PullRequestFileRouteScreen({
1088
<Text className="min-w-0 flex-1 text-xs text-foreground-muted">
1089
The branch changed. Reload before adding line comments.
1090
</Text>
1091
- <MaterialButton
1091
+ <Button
1092
label="Reload changes"
1093
onPress={() => {
1094
result.refresh();
@@ -1196,9 +1196,7 @@ export function PullRequestFileRouteScreen({
1196
<EmptyState
1197
title="Only test files changed"
1198
detail="Test files are hidden from this review."
1199
- action={
1200
- <MaterialButton label="Show test files" tone="contrast" onPress={filter.showAll} />
1201
- }
1199
+ action={<Button label="Show test files" tone="contrast" onPress={filter.showAll} />}
1200
variant="plain"
1201
/>
1202
</View>
apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
+314
-313
@@ -39,6 +39,7 @@ import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
39
import { Alert, AppState, Platform, Pressable, TextInput as RNTextInput, View } from "react-native";
40
import { useSafeAreaInsets } from "react-native-safe-area-context";
41
42
+import { Button } from "../../components/Button";
43
import { AppText as Text } from "../../components/AppText";
44
import { SymbolView } from "../../components/AppSymbol";
45
import {
@@ -695,338 +696,338 @@ function TaskForm({
696
};
697
698
return (
698
- <View
699
- className="gap-5"
700
- pointerEvents={saving ? "none" : "auto"}
701
- accessibilityElementsHidden={saving}
702
- importantForAccessibility={saving ? "no-hide-descendants" : "auto"}
703
- >
704
- {taskMissing ? (
705
- <Text className="px-1 text-base text-danger-foreground">This task no longer exists.</Text>
706
- ) : null}
707
-
708
- {environmentUnavailable ? (
709
- <Text className="px-1 text-base text-danger-foreground">
710
- This environment is disconnected. Reconnect before saving.
711
- </Text>
712
- ) : null}
713
- <SettingsSection>
714
- <SelectRow
715
- label="Runs on"
716
- value={environmentLabel}
717
- valueIcon={
718
- <EnvironmentMachineSymbol
719
- kind={resolveEnvironmentMachineKind(config)}
720
- size={18}
721
- tintColorClassName="accent-foreground-muted"
722
- />
723
- }
724
- actions={
725
- draft.task || saving || dictationPending
726
- ? []
727
- : availableTargets.map((target) => ({
728
- id: target.environmentId,
729
- title: target.label,
730
- image:
731
- ENVIRONMENT_MACHINE_SYMBOLS[resolveEnvironmentMachineKind(target.serverConfig)],
732
- state: target.environmentId === environmentId ? "on" : undefined,
733
- }))
734
- }
735
- onSelect={(id) => {
736
- const target = availableTargets.find((entry) => entry.environmentId === id);
737
- if (target) onChangeEnvironment(target);
738
- }}
739
- />
740
- </SettingsSection>
741
- <SettingsSection title="Task">
742
- <FormField
743
- label="Name"
744
- disabled={saving}
745
- value={draft.title}
746
- placeholder="Check for issues"
747
- onChange={(title) => setDraft({ ...draft, title })}
748
- />
749
- {promptField}
750
- </SettingsSection>
751
-
752
- <SettingsSection title="Context">
753
- <SelectRow
754
- label="Project"
755
- value={
756
- projects.find((project) => project.id === draft.projectId)?.title ??
757
- (projects.length ? "Choose project" : "No projects available")
758
- }
759
- actions={projects.map((project) => ({
760
- id: project.id,
761
- title: project.title,
762
- state: project.id === draft.projectId ? "on" : undefined,
763
- }))}
764
- onSelect={(id) => {
765
- const project = projects.find((item) => item.id === id);
766
- if (!project) return;
767
- const keepsExplicitModel =
768
- draft.modelSelectionIsExplicit &&
769
- (draft.modelSelection === null ||
770
- !config?.settings ||
771
- resolveProjectProviderInstanceEnabled(
772
- config.settings,
773
- project.id,
774
- draft.modelSelection.instanceId,
775
- ));
776
- setDraft({
777
- ...draft,
778
- projectId: project.id,
779
- modelSelection: keepsExplicitModel
780
- ? draft.modelSelection
781
- : scheduledTaskDefaultModel(config, project),
782
- modelSelectionIsExplicit: keepsExplicitModel,
783
- });
784
- }}
785
- />
786
- <PickerRow
787
- label="Model"
788
- borderTop
789
- value={
790
- modelOptions.find(
791
- (option) =>
792
- option.selection.instanceId === draft.modelSelection?.instanceId &&
793
- option.selection.model === draft.modelSelection?.model,
794
- )?.label ??
795
- draft.modelSelection?.model ??
796
- (modelOptions.length ? "Choose model" : "No models available")
797
- }
798
- onPress={() => navigation.navigate("SettingsScheduledTaskModel")}
799
- disabled={saving || dictationPending || environmentUnavailable}
800
- />
801
- </SettingsSection>
699
+ <View className="gap-5">
700
+ <View
701
+ className="gap-5"
702
+ pointerEvents={saving ? "none" : "auto"}
703
+ accessibilityElementsHidden={saving}
704
+ importantForAccessibility={saving ? "no-hide-descendants" : "auto"}
705
+ >
706
+ {taskMissing ? (
707
+ <Text className="px-1 text-base text-danger-foreground">This task no longer exists.</Text>
708
+ ) : null}
709
803
- <SettingsSection title="Workspace">
804
- <SelectRow
805
- label="Run in"
806
- value={
807
- draft.workspace === "worktree"
808
- ? "New worktree"
809
- : draft.workspace === "root"
810
- ? "Project checkout"
811
- : "Specific checkout"
812
- }
813
- actions={[
814
- {
815
- id: "worktree",
816
- title: "New worktree",
817
- state: draft.workspace === "worktree" ? "on" : undefined,
818
- },
819
- {
820
- id: "root",
821
- title: "Project checkout",
822
- state: draft.workspace === "root" ? "on" : undefined,
823
- },
824
- {
825
- id: "existing_worktree",
826
- title: "Specific checkout",
827
- state: draft.workspace === "existing_worktree" ? "on" : undefined,
828
- },
829
- ]}
830
- onSelect={(id) => {
831
- if (id === "worktree" || id === "root" || id === "existing_worktree")
832
- setDraft({ ...draft, workspace: id });
833
- }}
834
- />
835
- {draft.workspace === "worktree" ? (
836
- <PickerRow
837
- label="Base branch"
838
- value={resolveNewTaskBranchLabel({
839
- branchName: draft.baseRef,
840
- startFromOrigin: draft.startFromOrigin,
841
- workspaceMode: "worktree",
842
- })}
843
- borderTop
844
- disabled={!draft.projectId || saving || dictationPending || environmentUnavailable}
845
- onPress={() => navigation.navigate("SettingsScheduledTaskBranch")}
846
- />
710
+ {environmentUnavailable ? (
711
+ <Text className="px-1 text-base text-danger-foreground">
712
+ This environment is disconnected. Reconnect before saving.
713
+ </Text>
714
) : null}
848
- {draft.workspace === "existing_worktree" ? (
715
+ <SettingsSection>
716
+ <SelectRow
717
+ label="Runs on"
718
+ value={environmentLabel}
719
+ valueIcon={
720
+ <EnvironmentMachineSymbol
721
+ kind={resolveEnvironmentMachineKind(config)}
722
+ size={18}
723
+ tintColorClassName="accent-foreground-muted"
724
+ />
725
+ }
726
+ actions={
727
+ draft.task || saving || dictationPending
728
+ ? []
729
+ : availableTargets.map((target) => ({
730
+ id: target.environmentId,
731
+ title: target.label,
732
+ image:
733
+ ENVIRONMENT_MACHINE_SYMBOLS[
734
+ resolveEnvironmentMachineKind(target.serverConfig)
735
+ ],
736
+ state: target.environmentId === environmentId ? "on" : undefined,
737
+ }))
738
+ }
739
+ onSelect={(id) => {
740
+ const target = availableTargets.find((entry) => entry.environmentId === id);
741
+ if (target) onChangeEnvironment(target);
742
+ }}
743
+ />
744
+ </SettingsSection>
745
+ <SettingsSection title="Task">
746
<FormField
850
- label="Checkout path"
747
+ label="Name"
748
disabled={saving}
852
- value={draft.checkoutPath}
853
- borderTop
854
- onChange={(checkoutPath) => setDraft({ ...draft, checkoutPath })}
749
+ value={draft.title}
750
+ placeholder="Check for issues"
751
+ onChange={(title) => setDraft({ ...draft, title })}
752
/>
856
- ) : null}
857
- </SettingsSection>
753
+ {promptField}
754
+ </SettingsSection>
755
859
- <SettingsSection title="Schedule">
860
- <View className="px-4 py-3">
861
- <SegmentedControl
862
- options={[
863
- { value: "fixed_time", label: "At a time" },
864
- { value: "interval", label: "Interval" },
865
- { value: "webhook", label: "On webhook" },
866
- ]}
867
- selected={draft.schedule.mode}
868
- onSelect={(mode) => {
869
- setTimePickerOpen(false);
756
+ <SettingsSection title="Context">
757
+ <SelectRow
758
+ label="Project"
759
+ value={
760
+ projects.find((project) => project.id === draft.projectId)?.title ??
761
+ (projects.length ? "Choose project" : "No projects available")
762
+ }
763
+ actions={projects.map((project) => ({
764
+ id: project.id,
765
+ title: project.title,
766
+ state: project.id === draft.projectId ? "on" : undefined,
767
+ }))}
768
+ onSelect={(id) => {
769
+ const project = projects.find((item) => item.id === id);
770
+ if (!project) return;
771
+ const keepsExplicitModel =
772
+ draft.modelSelectionIsExplicit &&
773
+ (draft.modelSelection === null ||
774
+ !config?.settings ||
775
+ resolveProjectProviderInstanceEnabled(
776
+ config.settings,
777
+ project.id,
778
+ draft.modelSelection.instanceId,
779
+ ));
780
setDraft({
781
...draft,
872
- prompt:
873
- mode === "webhook" && !draft.prompt.trim()
874
- ? DEFAULT_WEBHOOK_PROMPT
875
- : draft.prompt,
876
- schedule: { ...draft.schedule, mode },
782
+ projectId: project.id,
783
+ modelSelection: keepsExplicitModel
784
+ ? draft.modelSelection
785
+ : scheduledTaskDefaultModel(config, project),
786
+ modelSelectionIsExplicit: keepsExplicitModel,
787
});
788
}}
789
/>
880
- </View>
881
- {draft.schedule.mode === "fixed_time" ? (
882
- <>
883
- <Pressable
884
- accessibilityRole="button"
885
- accessibilityLabel={`Time, ${formatTime(draft.schedule.timeOfDay)}`}
886
- onPress={() => setTimePickerOpen((open) => !open)}
887
- className="min-h-14 flex-row items-center gap-3 border-t border-border-subtle px-4 py-3 active:opacity-70"
888
- >
889
- <Text className="text-lg text-foreground">Time</Text>
890
- <Text className="min-w-0 flex-1 text-right text-base text-foreground-muted">
891
- {formatTime(draft.schedule.timeOfDay)}
892
- </Text>
893
- <SymbolView
894
- name="chevron.right"
895
- size={14}
896
- tintColorClassName="accent-chevron"
897
- type="monochrome"
898
- />
899
- </Pressable>
900
- {timePickerOpen ? (
901
- <DateTimePicker
902
- value={timePickerValue(draft.schedule.timeOfDay)}
903
- mode="time"
904
- display={Platform.OS === "ios" ? "spinner" : "default"}
905
- onDismiss={() => setTimePickerOpen(false)}
906
- onValueChange={(_, selected) => {
907
- const timeOfDay = `${String(selected.getHours()).padStart(2, "0")}:${String(selected.getMinutes()).padStart(2, "0")}`;
908
- setDraft({ ...draft, schedule: { ...draft.schedule, timeOfDay } });
909
- }}
910
- />
911
- ) : null}
912
- <SelectRow
913
- label="Repeat"
914
- value={repeatLabel(draft.schedule.weekdays)}
790
+ <PickerRow
791
+ label="Model"
792
+ borderTop
793
+ value={
794
+ modelOptions.find(
795
+ (option) =>
796
+ option.selection.instanceId === draft.modelSelection?.instanceId &&
797
+ option.selection.model === draft.modelSelection?.model,
798
+ )?.label ??
799
+ draft.modelSelection?.model ??
800
+ (modelOptions.length ? "Choose model" : "No models available")
801
+ }
802
+ onPress={() => navigation.navigate("SettingsScheduledTaskModel")}
803
+ disabled={saving || dictationPending || environmentUnavailable}
804
+ />
805
+ </SettingsSection>
806
+
807
+ <SettingsSection title="Workspace">
808
+ <SelectRow
809
+ label="Run in"
810
+ value={
811
+ draft.workspace === "worktree"
812
+ ? "New worktree"
813
+ : draft.workspace === "root"
814
+ ? "Project checkout"
815
+ : "Specific checkout"
816
+ }
817
+ actions={[
818
+ {
819
+ id: "worktree",
820
+ title: "New worktree",
821
+ state: draft.workspace === "worktree" ? "on" : undefined,
822
+ },
823
+ {
824
+ id: "root",
825
+ title: "Project checkout",
826
+ state: draft.workspace === "root" ? "on" : undefined,
827
+ },
828
+ {
829
+ id: "existing_worktree",
830
+ title: "Specific checkout",
831
+ state: draft.workspace === "existing_worktree" ? "on" : undefined,
832
+ },
833
+ ]}
834
+ onSelect={(id) => {
835
+ if (id === "worktree" || id === "root" || id === "existing_worktree")
836
+ setDraft({ ...draft, workspace: id });
837
+ }}
838
+ />
839
+ {draft.workspace === "worktree" ? (
840
+ <PickerRow
841
+ label="Base branch"
842
+ value={resolveNewTaskBranchLabel({
843
+ branchName: draft.baseRef,
844
+ startFromOrigin: draft.startFromOrigin,
845
+ workspaceMode: "worktree",
846
+ })}
847
borderTop
916
- actions={[
917
- {
918
- id: "every_day",
919
- title: "Every day",
920
- state: draft.schedule.weekdays.length === 7 ? "on" : undefined,
921
- },
922
- {
923
- id: "weekdays",
924
- title: "Weekdays",
925
- state: repeatLabel(draft.schedule.weekdays) === "Weekdays" ? "on" : undefined,
926
- },
927
- ...DAYS.map((day) => ({
928
- id: String(day.index),
929
- title: day.label,
930
- attributes: { keepsMenuPresented: true },
931
- state: draft.schedule.weekdays.includes(day.index) ? ("on" as const) : undefined,
932
- })),
933
- ]}
934
- onSelect={(id) => {
935
- const weekdays =
936
- id === "every_day"
937
- ? DAYS.map((day) => day.index)
938
- : id === "weekdays"
939
- ? [1, 2, 3, 4, 5]
940
- : (() => {
941
- const day = DAYS.find((item) => String(item.index) === id);
942
- if (!day) return draft.schedule.weekdays;
943
- return draft.schedule.weekdays.includes(day.index)
944
- ? draft.schedule.weekdays.filter((index) => index !== day.index)
945
- : [...draft.schedule.weekdays, day.index];
946
- })();
947
- setDraft({ ...draft, schedule: { ...draft.schedule, weekdays } });
948
- }}
949
- />
950
- </>
951
- ) : draft.schedule.mode === "webhook" ? (
952
- <>
953
- <WebhookScheduleDetails
954
- environmentId={environmentId}
955
- // The live row, so a rotated URL shows up without reopening the form.
956
- // Once the list has loaded, a missing task is gone; don't keep showing its URL.
957
- task={
958
- tasks.data
959
- ? (tasks.data.tasks.find((task) => task.id === draft.task?.id) ?? null)
960
- : draft.task
961
- }
962
- signatureConfigured={draft.schedule.signature !== null}
963
- disabled={!canOperate || saving || environmentUnavailable}
848
+ disabled={!draft.projectId || saving || dictationPending || environmentUnavailable}
849
+ onPress={() => navigation.navigate("SettingsScheduledTaskBranch")}
850
/>
851
+ ) : null}
852
+ {draft.workspace === "existing_worktree" ? (
853
<FormField
966
- label="Skip requests older than (minutes)"
967
- value={draft.schedule.maxDeliveryAgeMinutes}
968
- placeholder="Run every request"
969
- keyboardType="number-pad"
854
+ label="Checkout path"
855
disabled={saving}
856
+ value={draft.checkoutPath}
857
borderTop
972
- onChange={(maxDeliveryAgeMinutes) =>
973
- setDraft({ ...draft, schedule: { ...draft.schedule, maxDeliveryAgeMinutes } })
974
- }
858
+ onChange={(checkoutPath) => setDraft({ ...draft, checkoutPath })}
859
/>
976
- </>
977
- ) : (
978
- <>
979
- <FormField
980
- label="Minutes between runs"
981
- value={draft.schedule.intervalMinutes}
982
- keyboardType="decimal-pad"
983
- disabled={saving}
984
- borderTop
985
- onChange={(intervalMinutes) =>
986
- setDraft({ ...draft, schedule: { ...draft.schedule, intervalMinutes } })
987
- }
860
+ ) : null}
861
+ </SettingsSection>
862
+
863
+ <SettingsSection title="Schedule">
864
+ <View className="px-4 py-3">
865
+ <SegmentedControl
866
+ options={[
867
+ { value: "fixed_time", label: "At a time" },
868
+ { value: "interval", label: "Interval" },
869
+ { value: "webhook", label: "On webhook" },
870
+ ]}
871
+ selected={draft.schedule.mode}
872
+ onSelect={(mode) => {
873
+ setTimePickerOpen(false);
874
+ setDraft({
875
+ ...draft,
876
+ prompt:
877
+ mode === "webhook" && !draft.prompt.trim()
878
+ ? DEFAULT_WEBHOOK_PROMPT
879
+ : draft.prompt,
880
+ schedule: { ...draft.schedule, mode },
881
+ });
882
+ }}
883
/>
989
- {Number(draft.schedule.intervalMinutes) < 1 ? (
990
- <Text className="px-4 pb-3 text-sm text-danger-foreground">
991
- Intervals must be at least 1 minute. Update this interval before saving.
992
- </Text>
993
- ) : draft.task?.schedule.type === "interval" && draft.task.schedule.everyMs < 60_000 ? (
994
- <Text className="px-4 pb-3 text-sm text-foreground-muted">
995
- This task previously ran more than once per minute. Saving requires an interval of
996
- at least 1 minute.
997
- </Text>
998
- ) : null}
999
- </>
1000
- )}
1001
- <View className="min-h-14 flex-row items-center gap-3 border-t border-border-subtle px-4 py-3">
1002
- <Text className="min-w-0 flex-1 text-lg text-foreground">Enabled</Text>
1003
- <ThemedSwitch
1004
- accessibilityLabel="Task enabled"
1005
- value={draft.enabled}
1006
- onValueChange={(enabled) => setDraft({ ...draft, enabled })}
1007
- />
1008
- </View>
1009
- </SettingsSection>
1010
- {draft.schedule.mode === "fixed_time" ? (
1011
- <Text className="px-2 text-sm text-foreground-muted">
1012
- Time uses the environment's time zone, which may differ from your phone's.
1013
- </Text>
1014
- ) : null}
1015
- <Pressable
1016
- accessibilityRole="button"
1017
- accessibilityState={{
1018
- disabled: saving || dictationPending || taskMissing || environmentUnavailable,
1019
- }}
1020
- disabled={
1021
- !canOperate || saving || dictationPending || taskMissing || environmentUnavailable
1022
- }
884
+ </View>
885
+ {draft.schedule.mode === "fixed_time" ? (
886
+ <>
887
+ <Pressable
888
+ accessibilityRole="button"
889
+ accessibilityLabel={`Time, ${formatTime(draft.schedule.timeOfDay)}`}
890
+ onPress={() => setTimePickerOpen((open) => !open)}
891
+ className="min-h-14 flex-row items-center gap-3 border-t border-border-subtle px-4 py-3 active:opacity-70"
892
+ >
893
+ <Text className="text-lg text-foreground">Time</Text>
894
+ <Text className="min-w-0 flex-1 text-right text-base text-foreground-muted">
895
+ {formatTime(draft.schedule.timeOfDay)}
896
+ </Text>
897
+ <SymbolView
898
+ name="chevron.right"
899
+ size={14}
900
+ tintColorClassName="accent-chevron"
901
+ type="monochrome"
902
+ />
903
+ </Pressable>
904
+ {timePickerOpen ? (
905
+ <DateTimePicker
906
+ value={timePickerValue(draft.schedule.timeOfDay)}
907
+ mode="time"
908
+ display={Platform.OS === "ios" ? "spinner" : "default"}
909
+ onDismiss={() => setTimePickerOpen(false)}
910
+ onValueChange={(_, selected) => {
911
+ const timeOfDay = `${String(selected.getHours()).padStart(2, "0")}:${String(selected.getMinutes()).padStart(2, "0")}`;
912
+ setDraft({ ...draft, schedule: { ...draft.schedule, timeOfDay } });
913
+ }}
914
+ />
915
+ ) : null}
916
+ <SelectRow
917
+ label="Repeat"
918
+ value={repeatLabel(draft.schedule.weekdays)}
919
+ borderTop
920
+ actions={[
921
+ {
922
+ id: "every_day",
923
+ title: "Every day",
924
+ state: draft.schedule.weekdays.length === 7 ? "on" : undefined,
925
+ },
926
+ {
927
+ id: "weekdays",
928
+ title: "Weekdays",
929
+ state: repeatLabel(draft.schedule.weekdays) === "Weekdays" ? "on" : undefined,
930
+ },
931
+ ...DAYS.map((day) => ({
932
+ id: String(day.index),
933
+ title: day.label,
934
+ attributes: { keepsMenuPresented: true },
935
+ state: draft.schedule.weekdays.includes(day.index)
936
+ ? ("on" as const)
937
+ : undefined,
938
+ })),
939
+ ]}
940
+ onSelect={(id) => {
941
+ const weekdays =
942
+ id === "every_day"
943
+ ? DAYS.map((day) => day.index)
944
+ : id === "weekdays"
945
+ ? [1, 2, 3, 4, 5]
946
+ : (() => {
947
+ const day = DAYS.find((item) => String(item.index) === id);
948
+ if (!day) return draft.schedule.weekdays;
949
+ return draft.schedule.weekdays.includes(day.index)
950
+ ? draft.schedule.weekdays.filter((index) => index !== day.index)
951
+ : [...draft.schedule.weekdays, day.index];
952
+ })();
953
+ setDraft({ ...draft, schedule: { ...draft.schedule, weekdays } });
954
+ }}
955
+ />
956
+ </>
957
+ ) : draft.schedule.mode === "webhook" ? (
958
+ <>
959
+ <WebhookScheduleDetails
960
+ environmentId={environmentId}
961
+ // The live row, so a rotated URL shows up without reopening the form.
962
+ // Once the list has loaded, a missing task is gone; don't keep showing its URL.
963
+ task={
964
+ tasks.data
965
+ ? (tasks.data.tasks.find((task) => task.id === draft.task?.id) ?? null)
966
+ : draft.task
967
+ }
968
+ signatureConfigured={draft.schedule.signature !== null}
969
+ disabled={!canOperate || saving || environmentUnavailable}
970
+ />
971
+ <FormField
972
+ label="Skip requests older than (minutes)"
973
+ value={draft.schedule.maxDeliveryAgeMinutes}
974
+ placeholder="Run every request"
975
+ keyboardType="number-pad"
976
+ disabled={saving}
977
+ borderTop
978
+ onChange={(maxDeliveryAgeMinutes) =>
979
+ setDraft({ ...draft, schedule: { ...draft.schedule, maxDeliveryAgeMinutes } })
980
+ }
981
+ />
982
+ </>
983
+ ) : (
984
+ <>
985
+ <FormField
986
+ label="Minutes between runs"
987
+ value={draft.schedule.intervalMinutes}
988
+ keyboardType="decimal-pad"
989
+ disabled={saving}
990
+ borderTop
991
+ onChange={(intervalMinutes) =>
992
+ setDraft({ ...draft, schedule: { ...draft.schedule, intervalMinutes } })
993
+ }
994
+ />
995
+ {Number(draft.schedule.intervalMinutes) < 1 ? (
996
+ <Text className="px-4 pb-3 text-sm text-danger-foreground">
997
+ Intervals must be at least 1 minute. Update this interval before saving.
998
+ </Text>
999
+ ) : draft.task?.schedule.type === "interval" &&
1000
+ draft.task.schedule.everyMs < 60_000 ? (
1001
+ <Text className="px-4 pb-3 text-sm text-foreground-muted">
1002
+ This task previously ran more than once per minute. Saving requires an interval of
1003
+ at least 1 minute.
1004
+ </Text>
1005
+ ) : null}
1006
+ </>
1007
+ )}
1008
+ <View className="min-h-14 flex-row items-center gap-3 border-t border-border-subtle px-4 py-3">
1009
+ <Text className="min-w-0 flex-1 text-lg text-foreground">Enabled</Text>
1010
+ <ThemedSwitch
1011
+ accessibilityLabel="Task enabled"
1012
+ value={draft.enabled}
1013
+ onValueChange={(enabled) => setDraft({ ...draft, enabled })}
1014
+ />
1015
+ </View>
1016
+ </SettingsSection>
1017
+ {draft.schedule.mode === "fixed_time" ? (
1018
+ <Text className="px-2 text-sm text-foreground-muted">
1019
+ Time uses the environment's time zone, which may differ from your phone's.
1020
+ </Text>
1021
+ ) : null}
1022
+ </View>
1023
+ <Button
1024
+ tone="primary"
1025
+ fullWidth
1026
+ loading={saving}
1027
+ disabled={!canOperate || dictationPending || taskMissing || environmentUnavailable}
1028
onPress={() => void save()}
1024
- className="min-h-12 items-center justify-center rounded-[14px] bg-primary px-4 disabled:opacity-50"
1025
- >
1026
- <Text className="text-base font-t3-medium text-primary-foreground">
1027
- {saving ? "Saving…" : draft.task ? "Save changes" : "Create task"}
1028
- </Text>
1029
- </Pressable>
1029
+ label={saving ? "Saving…" : draft.task ? "Save changes" : "Create task"}
1030
+ />
1031
</View>
1032
);
1033
}
apps/mobile/src/features/terminal/TerminalContextSheet.tsx
+2
-2
@@ -11,7 +11,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
11
import { REVIEW_MONO_FONT_FAMILY } from "../review/reviewDiffRendering";
12
import { AppText as Text } from "../../components/AppText";
13
import { AppSheet } from "../../components/AppSheet";
14
-import { MaterialButton } from "../../components/MaterialButton";
14
+import { Button } from "../../components/Button";
15
import { uuidv4 } from "../../lib/uuid";
16
import { insertComposerDraftContext } from "../../state/use-composer-drafts";
17
@@ -112,7 +112,7 @@ export function TerminalContextSheet(props: {
112
Select fewer lines to fit the context limit.
113
</Text>
114
) : null}
115
- <MaterialButton
115
+ <Button
116
label="Attach selected output"
117
tone="primary"
118
fullWidth
apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
+2
-2
@@ -35,7 +35,7 @@ import { EmptyState } from "../../components/EmptyState";
35
import { GlassSurface } from "../../components/GlassSurface";
36
import { LoadingScreen } from "../../components/LoadingScreen";
37
import { MaterialScreenContent } from "../../components/MaterialScreenContent";
38
-import { MaterialButton } from "../../components/MaterialButton";
38
+import { Button } from "../../components/Button";
39
import { MaterialIconButton } from "../../components/MaterialIconButton";
40
import { environmentCatalog } from "../../connection/catalog";
41
import { useEnvironmentPresentation } from "../../state/presentation";
@@ -1296,7 +1296,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
1296
{Platform.OS === "android" && !keyboardState.isVisible ? (
1297
<View className="min-h-14 flex-row items-center gap-2 bg-card-alt px-2">
1298
{selectedThread && hasNativeTerminalSurface() ? (
1299
- <MaterialButton
1299
+ <Button
1300
label="Attach output"
1301
tone="text"
1302
onPress={() => setCaptureRequest((value) => value + 1)}
apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+3
-3
@@ -20,7 +20,7 @@ import { Alert, Platform, Pressable, View } from "react-native";
20
import { useSafeAreaInsets } from "react-native-safe-area-context";
21
import { cn } from "../../lib/cn";
22
import { MaterialScreenContent } from "../../components/MaterialScreenContent";
23
-import { MaterialButton } from "../../components/MaterialButton";
23
+import { Button } from "../../components/Button";
24
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
25
import { AppText as Text } from "../../components/AppText";
26
import { ProjectFavicon } from "../../components/ProjectFavicon";
@@ -388,7 +388,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
388
</Text>
389
{Platform.OS === "android" ? (
390
<>
391
- <MaterialButton
391
+ <Button
392
label={catalogState.hasReadyEnvironment ? "Add new project" : "Add environment"}
393
tone="primary"
394
onPress={() =>
@@ -398,7 +398,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
398
}
399
/>
400
{canStartScratch ? (
401
- <MaterialButton
401
+ <Button
402
label="Start without a project"
403
tone="secondary"
404
onPress={() => void startScratch()}
apps/mobile/src/features/threads/ThreadQueueControl.tsx
+2
-2
@@ -14,7 +14,7 @@ import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-scree
14
import { useSafeAreaInsets } from "react-native-safe-area-context";
15
import Reanimated, { ReduceMotion, useAnimatedStyle, withTiming } from "react-native-reanimated";
16
17
-import { MaterialButton } from "../../components/MaterialButton";
17
+import { Button } from "../../components/Button";
18
import { AndroidSheetHeader } from "../../components/AndroidScreenHeader";
19
import { AppText as Text } from "../../components/AppText";
20
import { SymbolView } from "../../components/AppSymbol";
@@ -198,7 +198,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
198
{workflow?.isHeld && queuedRuns.length > 0 ? (
199
<View className="gap-2 py-3">
200
<Text className="text-sm text-foreground-muted">Queue held after restart</Text>
201
- <MaterialButton
201
+ <Button
202
label="Resume queue"
203
disabled={resuming || busyRunId !== null}
204
onPress={async () => {
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+2
-2
@@ -52,7 +52,7 @@ import { SymbolView } from "../../components/AppSymbol";
52
import { AppText as Text } from "../../components/AppText";
53
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
54
import { AndroidAnchoredMenu } from "../../components/AndroidAnchoredMenu";
55
-import { MaterialButton } from "../../components/MaterialButton";
55
+import { Button } from "../../components/Button";
56
import { MaterialIconButton } from "../../components/MaterialIconButton";
57
import { ProviderIcon } from "../../components/ProviderIcon";
58
import { ThemedSwitch } from "../../components/ThemedSwitch";
@@ -1364,7 +1364,7 @@ function ThreadSettingsModelsScreen() {
1364
)}
1365
</AndroidAnchoredMenu>
1366
{session.pendingModel ? (
1367
- <MaterialButton label="Save" tone="text" onPress={commitAndClose} />
1367
+ <Button label="Save" tone="text" onPress={commitAndClose} />
1368
) : null}
1369
</View>
1370
}
apps/mobile/src/features/threads/git/gitSheetComponents.tsx
+3
-2
@@ -2,7 +2,7 @@ import { SymbolView } from "../../../components/AppSymbol";
2
import type { ComponentProps } from "react";
3
import { Platform, Pressable, View } from "react-native";
4
import { AppText as Text } from "../../../components/AppText";
5
-import { MaterialButton } from "../../../components/MaterialButton";
5
+import { Button } from "../../../components/Button";
6
import { cn } from "../../../lib/cn";
7
8
/* ─── Shared sheet components ──────────────────────────────────────── */
@@ -17,8 +17,9 @@ export function SheetActionButton(props: {
17
if (Platform.OS === "android")
18
return (
19
<View className="flex-1">
20
- <MaterialButton
20
+ <Button
21
label={props.label}
22
+ icon={props.icon}
23
tone={props.tone}
24
disabled={props.disabled}
25
onPress={props.onPress}