The best way to control Claude Code, Codex and more from any computer or phone
refactor(mobile): finish shared control token adoption (#19996)
Julius Marminge committed
Oct 15, 2026 at 15:46 UTC
4b8fb2e2372cc8c402fd24bafe40030093bfebfc
12 files changed
+165
-180
apps/mobile/src/components/Chip.tsx
+2
-1
@@ -37,11 +37,12 @@ export function Chip(props: {
37
<SymbolView name={props.icon} size={15} tintColorClassName={iconColor} />
38
) : null}
39
<AppText
40
+ textRole={small ? "caption" : "footnote"}
41
numberOfLines={small ? undefined : 1}
42
className={cn(
43
"shrink",
44
!small && "max-w-[180px]",
44
- small ? "text-2xs" : "text-sm font-t3-medium",
45
+ !small && "font-t3-medium",
46
props.selected ? "text-primary-foreground" : "text-foreground-muted",
47
)}
48
>
apps/mobile/src/components/EmptyState.tsx
+11
-4
@@ -15,8 +15,13 @@ export function EmptyState(props: {
15
if (props.variant === "plain") {
16
return (
17
<View className="items-center px-8 py-8">
18
- <Text className="text-center text-xl font-t3-bold text-foreground">{props.title}</Text>
19
- <Text className="mt-2 text-center font-sans text-base leading-normal text-foreground-muted">
18
+ <Text textRole="title" className="text-center font-t3-bold text-foreground">
19
+ {props.title}
20
+ </Text>
21
+ <Text
22
+ textRole="body"
23
+ className="mt-2 text-center font-sans leading-normal text-foreground-muted"
24
+ >
25
{props.detail}
26
</Text>
27
{props.action ? (
@@ -32,8 +37,10 @@ export function EmptyState(props: {
37
38
return (
39
<View className="rounded-[22px] border border-border bg-card p-5">
35
- <Text className="font-t3-bold text-lg text-foreground">{props.title}</Text>
36
- <Text className="mt-2 font-sans text-sm leading-relaxed text-foreground-muted">
40
+ <Text textRole="headline" className="font-t3-bold text-foreground">
41
+ {props.title}
42
+ </Text>
43
+ <Text textRole="footnote" className="mt-2 font-sans leading-relaxed text-foreground-muted">
44
{props.detail}
45
</Text>
46
{props.action ? (
apps/mobile/src/components/FloatingActionButton.tsx
+1
-1
@@ -26,8 +26,8 @@ export function FloatingActionButton(props: FloatingActionButtonProps) {
26
/>
27
{props.variant === "extended" && props.expanded !== false ? (
28
<AppText
29
+ textRole="footnote"
30
className={cn(
30
- "text-sm",
31
props.tone === "primary" ? "text-primary-foreground" : "text-secondary-foreground",
32
)}
33
>
apps/mobile/src/components/Notice.tsx
+2
-1
@@ -39,9 +39,10 @@ export function Notice(props: {
39
) : null}
40
<AppText
41
selectable
42
+ textRole="footnote"
43
accessibilityLiveRegion="polite"
44
className={cn(
44
- "min-w-0 flex-1 text-sm",
45
+ "min-w-0 flex-1",
46
danger ? "text-danger-foreground" : "text-foreground",
47
!props.floating && "font-t3-medium",
48
)}
apps/mobile/src/components/NumberField.android.tsx
+3
-2
@@ -2,7 +2,7 @@ import { View } from "react-native";
2
3
import { AppText } from "./AppText";
4
import { IconButton } from "./IconButton";
5
-import type { NumberFieldProps } from "./NumberField";
5
+import type { NumberFieldProps } from "./NumberField.types";
6
7
export function NumberField(props: NumberFieldProps) {
8
const adjust = (amount: number) => {
@@ -26,7 +26,8 @@ export function NumberField(props: NumberFieldProps) {
26
onPress={() => adjust(-1)}
27
/>
28
<AppText
29
- className="min-w-8 text-center text-base"
29
+ textRole="body"
30
+ className="min-w-8 text-center"
31
style={{ fontVariant: ["tabular-nums"] }}
32
accessibilityLabel={`${props.label}: ${props.formatValue?.(props.value) ?? props.value}`}
33
accessibilityLiveRegion="polite"
apps/mobile/src/components/NumberField.ios.tsx
deleted
-92
@@ -1,92 +0,0 @@
1
-import { Button, HStack, Picker, Popover, Text, VStack } from "@expo/ui/swift-ui";
2
-import {
3
- accessibilityLabel,
4
- buttonStyle,
5
- disabled,
6
- font,
7
- foregroundStyle,
8
- frame,
9
- padding,
10
- pickerStyle,
11
- presentationBackground,
12
- tag,
13
-} from "@expo/ui/swift-ui/modifiers";
14
-import { useState } from "react";
15
-
16
-import { NativeThemeHost } from "./NativeThemeHost";
17
-import { useControlTheme } from "./useControlTheme";
18
-import type { NumberFieldProps } from "./NumberField";
19
-
20
-export function NumberField(props: NumberFieldProps) {
21
- const { colors, fontSize } = useControlTheme();
22
- const values = Array.from({ length: props.max - props.min + 1 }, (_, index) => props.min + index);
23
- const [open, setOpen] = useState(false);
24
- const [draft, setDraft] = useState(props.value);
25
- return (
26
- <NativeThemeHost matchContents>
27
- <Popover isPresented={open} onIsPresentedChange={setOpen}>
28
- <Popover.Trigger>
29
- <Button
30
- onPress={() => {
31
- if (props.disabled) return;
32
- setDraft(props.value);
33
- setOpen(true);
34
- }}
35
- modifiers={[
36
- buttonStyle("bordered"),
37
- disabled(props.disabled),
38
- accessibilityLabel(
39
- `${props.label}: ${props.formatValue?.(props.value) ?? props.value}`,
40
- ),
41
- frame({ minWidth: 64, minHeight: 44 }),
42
- foregroundStyle(colors["--color-primary-text"]),
43
- font({ size: fontSize }),
44
- ]}
45
- >
46
- <Text>{String(props.value)}</Text>
47
- </Button>
48
- </Popover.Trigger>
49
- <Popover.Content>
50
- <VStack
51
- modifiers={[
52
- padding({ all: 12 }),
53
- frame({ width: 240 }),
54
- presentationBackground(colors["--color-sheet-solid"]),
55
- ]}
56
- >
57
- <Picker
58
- label={props.label}
59
- selection={draft}
60
- onSelectionChange={setDraft}
61
- modifiers={[pickerStyle("wheel"), frame({ height: 180 })]}
62
- >
63
- {values.map((value) => (
64
- <Text
65
- key={value}
66
- modifiers={[tag(value), foregroundStyle(colors["--color-foreground"])]}
67
- >
68
- {props.formatValue?.(value) ?? String(value)}
69
- </Text>
70
- ))}
71
- </Picker>
72
- <HStack spacing={24}>
73
- <Button
74
- label="Cancel"
75
- onPress={() => setOpen(false)}
76
- modifiers={[foregroundStyle(colors["--color-primary-text"])]}
77
- />
78
- <Button
79
- label="Done"
80
- onPress={() => {
81
- setOpen(false);
82
- if (!props.disabled && draft !== props.value) props.onValueChange(draft);
83
- }}
84
- modifiers={[foregroundStyle(colors["--color-primary-text"])]}
85
- />
86
- </HStack>
87
- </VStack>
88
- </Popover.Content>
89
- </Popover>
90
- </NativeThemeHost>
91
- );
92
-}
apps/mobile/src/components/NumberField.tsx
+89
-40
@@ -1,47 +1,96 @@
1
+import { Button, HStack, Picker, Popover, Text, VStack } from "@expo/ui/swift-ui";
2
+import {
3
+ accessibilityLabel,
4
+ buttonStyle,
5
+ disabled,
6
+ font,
7
+ foregroundStyle,
8
+ frame,
9
+ padding,
10
+ pickerStyle,
11
+ presentationBackground,
12
+ tag,
13
+} from "@expo/ui/swift-ui/modifiers";
14
import { useState } from "react";
2
-import { AppTextInput } from "./AppText";
15
4
-export interface NumberFieldProps {
5
- readonly label: string;
6
- readonly min: number;
7
- readonly max: number;
8
- readonly formatValue?: (value: number) => string;
9
- readonly value: number;
10
- readonly onValueChange: (value: number) => void;
11
- readonly disabled?: boolean;
12
-}
16
+import { NativeThemeHost } from "./NativeThemeHost";
17
+import { useControlTheme } from "./useControlTheme";
18
+import type { NumberFieldProps } from "./NumberField.types";
19
20
export function NumberField(props: NumberFieldProps) {
15
- const [draft, setDraft] = useState<string | null>(null);
16
- const commit = () => {
17
- if (props.disabled) {
18
- setDraft(null);
19
- return;
20
- }
21
- const text = (draft ?? "").trim();
22
- setDraft(null);
23
- // Validate the whole input; decimals and trailing text must not become whole days.
24
- const parsed = /^\d+$/.test(text) ? Number(text) : Number.NaN;
25
- if (
26
- Number.isInteger(parsed) &&
27
- parsed >= props.min &&
28
- parsed <= props.max &&
29
- parsed !== props.value
30
- ) {
31
- props.onValueChange(parsed);
32
- }
33
- };
21
+ const { colors, fontSize } = useControlTheme();
22
+ const [open, setOpen] = useState(false);
23
+ const [draft, setDraft] = useState(props.value);
24
+ const values = Array.from({ length: props.max - props.min + 1 }, (_, index) => props.min + index);
25
+ if (!values.includes(draft)) values.push(draft);
26
+ values.sort((a, b) => a - b);
27
return (
35
- <AppTextInput
36
- className="min-h-10 w-20 rounded-xl px-3 py-2 text-center text-base"
37
- keyboardType="number-pad"
38
- returnKeyType="done"
39
- value={draft ?? String(props.value)}
40
- onChangeText={setDraft}
41
- onBlur={commit}
42
- onSubmitEditing={commit}
43
- accessibilityLabel={props.label}
44
- editable={!props.disabled}
45
- />
28
+ <NativeThemeHost matchContents>
29
+ <Popover isPresented={open} onIsPresentedChange={setOpen}>
30
+ <Popover.Trigger>
31
+ <Button
32
+ onPress={() => {
33
+ if (props.disabled) return;
34
+ setDraft(props.value);
35
+ setOpen(true);
36
+ }}
37
+ modifiers={[
38
+ buttonStyle("bordered"),
39
+ disabled(props.disabled),
40
+ accessibilityLabel(
41
+ `${props.label}: ${props.formatValue?.(props.value) ?? props.value}`,
42
+ ),
43
+ frame({ minWidth: 64, minHeight: 44 }),
44
+ foregroundStyle(colors["--color-primary-text"]),
45
+ font({ size: fontSize }),
46
+ ]}
47
+ >
48
+ <Text>{String(props.value)}</Text>
49
+ </Button>
50
+ </Popover.Trigger>
51
+ <Popover.Content>
52
+ <VStack
53
+ modifiers={[
54
+ padding({ all: 12 }),
55
+ frame({ width: 240 }),
56
+ presentationBackground(colors["--color-sheet-solid"]),
57
+ ]}
58
+ >
59
+ <Picker
60
+ label={props.label}
61
+ selection={draft}
62
+ onSelectionChange={setDraft}
63
+ modifiers={[pickerStyle("wheel"), frame({ height: 180 })]}
64
+ >
65
+ {values.map((value) => (
66
+ <Text
67
+ key={value}
68
+ modifiers={[tag(value), foregroundStyle(colors["--color-foreground"])]}
69
+ >
70
+ {props.formatValue?.(value) ?? String(value)}
71
+ </Text>
72
+ ))}
73
+ </Picker>
74
+ <HStack spacing={24}>
75
+ <Button
76
+ label="Cancel"
77
+ onPress={() => setOpen(false)}
78
+ modifiers={[foregroundStyle(colors["--color-primary-text"])]}
79
+ />
80
+ <Button
81
+ label="Done"
82
+ onPress={() => {
83
+ setOpen(false);
84
+ if (!props.disabled && draft !== props.value) props.onValueChange(draft);
85
+ }}
86
+ modifiers={[foregroundStyle(colors["--color-primary-text"])]}
87
+ />
88
+ </HStack>
89
+ </VStack>
90
+ </Popover.Content>
91
+ </Popover>
92
+ </NativeThemeHost>
93
);
94
}
95
+
96
+export type { NumberFieldProps } from "./NumberField.types";
apps/mobile/src/components/NumberField.types.ts
new
+9
@@ -0,0 +1,9 @@
1
+export interface NumberFieldProps {
2
+ readonly label: string;
3
+ readonly min: number;
4
+ readonly max: number;
5
+ readonly formatValue?: (value: number) => string;
6
+ readonly value: number;
7
+ readonly onValueChange: (value: number) => void;
8
+ readonly disabled?: boolean;
9
+}
apps/mobile/src/components/Progress.ios.tsx
deleted
-36
@@ -1,36 +0,0 @@
1
-import { ProgressView } from "@expo/ui/swift-ui";
2
-import { progressViewStyle, tint } from "@expo/ui/swift-ui/modifiers";
3
-import { View } from "react-native";
4
-import { useReducedMotion } from "react-native-reanimated";
5
-import { NativeThemeHost } from "./NativeThemeHost";
6
-import { useControlTheme } from "./useControlTheme";
7
-import { clampProgress, type ProgressProps } from "./Progress.types";
8
-
9
-export function Progress(props: ProgressProps) {
10
- const value = clampProgress(props.value);
11
- const reducedMotion = useReducedMotion();
12
- const { colors } = useControlTheme();
13
- return (
14
- <View
15
- className={props.className}
16
- accessible
17
- accessibilityRole="progressbar"
18
- accessibilityLabel={props.label}
19
- accessibilityValue={
20
- value === undefined ? undefined : { min: 0, max: 100, now: Math.round(value * 100) }
21
- }
22
- accessibilityState={{ busy: value === undefined }}
23
- >
24
- {reducedMotion && value === undefined ? (
25
- <View className="h-1 rounded-full bg-primary/30" />
26
- ) : (
27
- <NativeThemeHost matchContents={{ vertical: true }} style={{ width: "100%" }}>
28
- <ProgressView
29
- value={value}
30
- modifiers={[progressViewStyle("linear"), tint(colors["--color-primary"])]}
31
- />
32
- </NativeThemeHost>
33
- )}
34
- </View>
35
- );
36
-}
apps/mobile/src/components/Progress.tsx
+37
-1
@@ -1,2 +1,38 @@
1
-export { Progress } from "./Progress.ios";
1
+import { ProgressView } from "@expo/ui/swift-ui";
2
+import { progressViewStyle, tint } from "@expo/ui/swift-ui/modifiers";
3
+import { View } from "react-native";
4
+import { useReducedMotion } from "react-native-reanimated";
5
+import { NativeThemeHost } from "./NativeThemeHost";
6
+import { useControlTheme } from "./useControlTheme";
7
+import { clampProgress, type ProgressProps } from "./Progress.types";
8
+
9
+export function Progress(props: ProgressProps) {
10
+ const value = clampProgress(props.value);
11
+ const reducedMotion = useReducedMotion();
12
+ const { colors } = useControlTheme();
13
+ return (
14
+ <View
15
+ className={props.className}
16
+ accessible
17
+ accessibilityRole="progressbar"
18
+ accessibilityLabel={props.label}
19
+ accessibilityValue={
20
+ value === undefined ? undefined : { min: 0, max: 100, now: Math.round(value * 100) }
21
+ }
22
+ accessibilityState={{ busy: value === undefined }}
23
+ >
24
+ {reducedMotion && value === undefined ? (
25
+ <View className="h-1 rounded-full bg-primary/30" />
26
+ ) : (
27
+ <NativeThemeHost matchContents={{ vertical: true }} style={{ width: "100%" }}>
28
+ <ProgressView
29
+ value={value}
30
+ modifiers={[progressViewStyle("linear"), tint(colors["--color-primary"])]}
31
+ />
32
+ </NativeThemeHost>
33
+ )}
34
+ </View>
35
+ );
36
+}
37
+
38
export type { ProgressProps } from "./Progress.types";
apps/mobile/src/components/SliderRow.tsx
+6
-1
@@ -1,3 +1,4 @@
1
+import { MOBILE_MOTION } from "../lib/designTokens";
2
import * as Haptics from "expo-haptics";
3
import { SymbolView } from "./AppSymbol";
4
import { useCallback, useEffect, useMemo, useRef } from "react";
@@ -8,6 +9,7 @@ import Animated, {
9
useAnimatedStyle,
10
useSharedValue,
11
withTiming,
12
+ ReduceMotion,
13
} from "react-native-reanimated";
14
import type { ComponentProps } from "react";
15
@@ -17,7 +19,10 @@ type SymbolName = ComponentProps<typeof SymbolView>["name"];
19
20
const THUMB_SIZE = 26;
21
const TRACK_HEIGHT = 4;
20
-const SNAP_ANIMATION = { duration: 120 } as const;
22
+const SNAP_ANIMATION = {
23
+ duration: MOBILE_MOTION.adjust,
24
+ reduceMotion: ReduceMotion.System,
25
+} as const;
26
27
function clampFraction(value: number): number {
28
"worklet";
apps/mobile/src/lib/designTokens.ts
+5
-1
@@ -6,4 +6,8 @@ export const MOBILE_SHAPE = {
6
} as const;
7
8
/** Finite transitions only; each animation must opt into system reduced motion. */
9
-export const MOBILE_MOTION = { enter: 200, exit: 150 } as const;
9
+export const MOBILE_MOTION = {
10
+ adjust: 120,
11
+ enter: 200,
12
+ exit: 150,
13
+} as const;