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): adopt shared text shape and motion tokens (#19953)
Julius Marminge committed
Oct 15, 2026 at 15:46 UTC
68eb28dce020485ef06aeece696bf3b49ba59790
10 files changed
+95
-38
apps/mobile/src/components/AppText.tsx
+12
-3
@@ -7,18 +7,27 @@ import {
7
type TextProps as RNTextProps,
8
} from "react-native";
9
10
+import { MOBILE_TEXT_CLASSES } from "../lib/typography";
11
+
12
import { cn } from "../lib/cn";
13
12
-export type AppTextProps = RNTextProps & { readonly className?: string };
14
+export type AppTextProps = RNTextProps & {
15
+ readonly className?: string;
16
+ readonly textRole?: keyof typeof MOBILE_TEXT_CLASSES;
17
+};
18
19
/**
20
* Thin wrapper around RN Text with default font-family and foreground color.
21
* Uses Uniwind className — no manual style parsing.
22
*/
18
-export function AppText({ className, ...props }: AppTextProps) {
23
+export function AppText({ className, textRole, ...props }: AppTextProps) {
24
return (
25
<RNText
21
- className={cn("font-sans text-foreground", className)}
26
+ className={cn(
27
+ "font-sans text-foreground",
28
+ textRole && MOBILE_TEXT_CLASSES[textRole],
29
+ className,
30
+ )}
31
selectionColorClassName={Platform.OS === "android" ? "accent-focus/32" : undefined}
32
{...props}
33
/>
apps/mobile/src/components/GlassSurface.tsx
+2
-1
@@ -10,6 +10,7 @@ import {
10
} from "react-native";
11
import { withUniwind } from "uniwind";
12
13
+import { MOBILE_SHAPE } from "../lib/designTokens";
14
import { cn } from "../lib/cn";
15
import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
16
import { GlassBackdrop } from "./GlassBackdrop";
@@ -51,7 +52,7 @@ export function GlassSurface({
52
const supportsGlass = Platform.OS === "ios" && isGlassEffectAPIAvailable();
53
const hasShadow = chrome !== "none" && Platform.OS !== "android";
54
const surfaceStyle: ViewStyle = {
54
- borderRadius: 32,
55
+ borderRadius: MOBILE_SHAPE.glass,
56
overflow: "hidden",
57
shadowColor: hasShadow ? "#000000" : "transparent",
58
shadowOpacity: hasShadow ? (isDarkMode ? 0.22 : 0.08) : 0,
apps/mobile/src/components/ListRowLayout.tsx
+10
-6
@@ -47,22 +47,26 @@ export function ListRowLayout({
47
) : null}
48
<View className="min-w-0 flex-1 gap-1">
49
<AppText
50
- className={
51
- tone === "danger" ? "text-base text-danger-foreground" : "text-base text-foreground"
52
- }
50
+ textRole="body"
51
+ className={tone === "danger" ? "text-danger-foreground" : "text-foreground"}
52
>
53
{label}
54
</AppText>
55
{description ? (
57
- <AppText className="text-sm text-foreground-muted">{description}</AppText>
56
+ <AppText textRole="footnote" className="text-foreground-muted">
57
+ {description}
58
+ </AppText>
59
) : null}
60
{detail && stackDetail ? (
60
- <AppText className="text-sm text-foreground-muted">{detail}</AppText>
61
+ <AppText textRole="footnote" className="text-foreground-muted">
62
+ {detail}
63
+ </AppText>
64
) : null}
65
</View>
66
{detail && !stackDetail ? (
67
<AppText
65
- className="max-w-[40%] shrink text-right text-sm text-foreground-muted"
68
+ textRole="footnote"
69
+ className="max-w-[40%] shrink text-right text-foreground-muted"
70
numberOfLines={1}
71
ellipsizeMode="middle"
72
>
apps/mobile/src/components/ListSection.tsx
+10
-7
@@ -1,3 +1,4 @@
1
+import { MOBILE_SHAPE } from "../lib/designTokens";
2
import type { ReactNode } from "react";
3
import { Platform, View } from "react-native";
4
@@ -22,7 +23,7 @@ export function ListSection(props: {
23
}
24
>
25
{props.titleIcon}
25
- <Text className="shrink text-sm font-t3-medium text-foreground-muted">
26
+ <Text textRole="footnote" className="shrink font-t3-medium text-foreground-muted">
27
{props.title}
28
</Text>
29
</View>
@@ -30,16 +31,18 @@ export function ListSection(props: {
31
</View>
32
) : null}
33
<View
33
- className={
34
- Platform.OS === "android"
35
- ? "overflow-hidden rounded-[28px] bg-grouped-card"
36
- : "overflow-hidden rounded-[24px] border-continuous bg-grouped-card"
37
- }
34
+ className="overflow-hidden border-continuous bg-grouped-card"
35
+ style={{
36
+ borderRadius:
37
+ Platform.OS === "android" ? MOBILE_SHAPE.group.android : MOBILE_SHAPE.group.ios,
38
+ }}
39
>
40
{props.children}
41
</View>
42
{props.footer ? (
42
- <Text className="px-4 text-sm text-foreground-muted">{props.footer}</Text>
43
+ <Text textRole="footnote" className="px-4 text-foreground-muted">
44
+ {props.footer}
45
+ </Text>
46
) : null}
47
</View>
48
);
apps/mobile/src/components/Progress.android.tsx
+16
-10
@@ -1,12 +1,14 @@
1
import { LinearProgressIndicator } from "@expo/ui/jetpack-compose";
2
import { fillMaxWidth } from "@expo/ui/jetpack-compose/modifiers";
3
import { View } from "react-native";
4
+import { useReducedMotion } from "react-native-reanimated";
5
import { NativeThemeHost } from "./NativeThemeHost.android";
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
@@ -19,16 +21,20 @@ export function Progress(props: ProgressProps) {
21
}
22
accessibilityState={{ busy: value === undefined }}
23
>
22
- <View importantForAccessibility="no-hide-descendants">
23
- <NativeThemeHost matchContents={{ vertical: true }} style={{ width: "100%" }}>
24
- <LinearProgressIndicator
25
- progress={value}
26
- color={colors["--color-primary"]}
27
- trackColor={colors["--color-subtle"]}
28
- modifiers={[fillMaxWidth()]}
29
- />
30
- </NativeThemeHost>
31
- </View>
24
+ {reducedMotion && value === undefined ? (
25
+ <View className="h-1 rounded-full bg-primary/30" />
26
+ ) : (
27
+ <View importantForAccessibility="no-hide-descendants">
28
+ <NativeThemeHost matchContents={{ vertical: true }} style={{ width: "100%" }}>
29
+ <LinearProgressIndicator
30
+ progress={value}
31
+ color={colors["--color-primary"]}
32
+ trackColor={colors["--color-subtle"]}
33
+ modifiers={[fillMaxWidth()]}
34
+ />
35
+ </NativeThemeHost>
36
+ </View>
37
+ )}
38
</View>
39
);
40
}
apps/mobile/src/components/Progress.ios.tsx
+12
-6
@@ -1,12 +1,14 @@
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
@@ -19,12 +21,16 @@ export function Progress(props: ProgressProps) {
21
}
22
accessibilityState={{ busy: value === undefined }}
23
>
22
- <NativeThemeHost matchContents={{ vertical: true }} style={{ width: "100%" }}>
23
- <ProgressView
24
- value={value}
25
- modifiers={[progressViewStyle("linear"), tint(colors["--color-primary"])]}
26
- />
27
- </NativeThemeHost>
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/Toast.tsx
+8
-3
@@ -1,3 +1,4 @@
1
+import { MOBILE_SHAPE } from "../lib/designTokens";
2
import { useEffect } from "react";
3
import { AccessibilityInfo, Platform, View } from "react-native";
4
@@ -23,7 +24,7 @@ export function Toast(props: ToastProps) {
24
if (Platform.OS === "ios") AccessibilityInfo.announceForAccessibility(props.message);
25
}, [props.message]);
26
return (
26
- <GlassSurface className="p-3">
27
+ <GlassSurface className="p-3" style={{ borderRadius: MOBILE_SHAPE.toast }}>
28
<View className="flex-row items-center gap-3">
29
{props.busy ? (
30
<AppActivityIndicator />
@@ -37,9 +38,13 @@ export function Toast(props: ToastProps) {
38
/>
39
)}
40
<View className="min-w-0 flex-1" accessibilityLiveRegion="polite">
40
- <AppText className="text-sm font-t3-semibold">{props.message}</AppText>
41
+ <AppText textRole="footnote" className="font-t3-semibold">
42
+ {props.message}
43
+ </AppText>
44
{props.description ? (
42
- <AppText className="text-xs text-foreground-muted">{props.description}</AppText>
45
+ <AppText textRole="label" className="text-foreground-muted">
46
+ {props.description}
47
+ </AppText>
48
) : null}
49
</View>
50
{props.onDismiss ? (
apps/mobile/src/features/threads/GitActionProgressOverlay.tsx
+3
-2
@@ -4,6 +4,7 @@ import { useEffect, useRef } from "react";
4
import Animated, { FadeIn, FadeOut, ReduceMotion } from "react-native-reanimated";
5
import { useSafeAreaInsets } from "react-native-safe-area-context";
6
import { Toast } from "../../components/Toast";
7
+import { MOBILE_MOTION } from "../../lib/designTokens";
8
import { APP_BAR_HEIGHT } from "../../lib/layoutMetrics";
9
import type { GitActionProgress } from "../../state/use-vcs-action-state";
10
@@ -46,8 +47,8 @@ export function GitActionProgressOverlay(props: {
47
48
return (
49
<Animated.View
49
- entering={FadeIn.duration(200).reduceMotion(ReduceMotion.System)}
50
- exiting={FadeOut.duration(150).reduceMotion(ReduceMotion.System)}
50
+ entering={FadeIn.duration(MOBILE_MOTION.enter).reduceMotion(ReduceMotion.System)}
51
+ exiting={FadeOut.duration(MOBILE_MOTION.exit).reduceMotion(ReduceMotion.System)}
52
className="absolute inset-x-3 z-[100]"
53
style={{ top: insets.top + APP_BAR_HEIGHT + 8 }}
54
pointerEvents="box-none"
apps/mobile/src/lib/designTokens.ts
new
+9
@@ -0,0 +1,9 @@
1
+/** Named shapes belong to components; native controls retain platform geometry. */
2
+export const MOBILE_SHAPE = {
3
+ group: { ios: 24, android: 28 },
4
+ toast: 26,
5
+ glass: 32,
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;
apps/mobile/src/lib/typography.ts
+13
@@ -19,3 +19,16 @@ export const MOBILE_CODE_SURFACE = {
19
fontSize: MOBILE_TYPOGRAPHY.caption.fontSize,
20
lineNumberFontSize: MOBILE_TYPOGRAPHY.micro.fontSize,
21
} as const;
22
+
23
+/** Class names share the same scaled CSS variables as native text roles. */
24
+export const MOBILE_TEXT_CLASSES = {
25
+ micro: "text-3xs",
26
+ caption: "text-2xs",
27
+ label: "text-xs",
28
+ footnote: "text-sm",
29
+ body: "text-base",
30
+ headline: "text-lg",
31
+ title: "text-xl",
32
+ largeTitle: "text-2xl",
33
+ display: "text-3xl",
34
+} as const satisfies Record<keyof typeof MOBILE_TYPOGRAPHY, string>;