From c06709b7cb33a16a8d6b6fa5fe8e0306a0e88e6d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 13:45:45 +0000 Subject: [PATCH 1/2] fix(mobile): keep Android tab icons sized with their labels under large text Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_014UiRXqKRSQS39KzeJJnLcA --- apps/mobile/DESIGN.md | 1 + apps/mobile/src/ui/primitives/row-icon.tsx | 8 ++-- .../ui/primitives/system-symbol.android.tsx | 18 +++++++++ .../src/ui/primitives/system-symbol.tsx | 20 ++++++++++ .../mobile/src/ui/shell/environment-pager.tsx | 2 +- apps/mobile/src/ui/shell/host-look-editor.tsx | 2 +- apps/mobile/src/ui/shell/host-tile.tsx | 12 +----- .../test/system-symbol-android.test.tsx | 39 +++++++++++++++++++ .../mobile-android-large-text-tab-icons.md | 11 ++++++ 9 files changed, 96 insertions(+), 17 deletions(-) create mode 100644 apps/mobile/src/ui/primitives/system-symbol.android.tsx create mode 100644 apps/mobile/src/ui/primitives/system-symbol.tsx create mode 100644 apps/mobile/test/system-symbol-android.test.tsx create mode 100644 changes/mobile-android-large-text-tab-icons.md diff --git a/apps/mobile/DESIGN.md b/apps/mobile/DESIGN.md index 7cabb8946c..1854471eec 100644 --- a/apps/mobile/DESIGN.md +++ b/apps/mobile/DESIGN.md @@ -319,6 +319,7 @@ Each layer has `fill`, `pressed`, `selected` (neutral, such as the current tab), - `test/style-guard.test.ts` enforces this for `app/` and `src/ui/`. - Files written before the rule are listed in it and leave the list once migrated; the test fails if a migrated file stays listed. 2. **Text goes through `primitives/text`.** Icons will go through `Icon` (`expo-symbols`). + - Native symbols go through `primitives/system-symbol`. On Android `expo-symbols` draws Material Symbols as font text that follows system text size inside a fixed box, so the primitive keeps the glyph at the requested size. An icon that sits beside a label sizes from the label's role times `theme.fontScale`, so it grows with the label instead of clipping or staying small. - All user-facing text and visible inputs follow the live system text size, without a global maximum or shrink-to-fit. Use `primitives/system-text` for inputs and legacy styled text. Decorative avatar initials may remain unscaled because the containing control exposes the full accessible label; remote Browser/Computer hidden keyboard capture fields remain native. - iOS uses native `dynamicTypeRamp`/UIFontMetrics: body, headline, footnote and title1 for body/title/meta/display. Legacy explicit sizes map to the matching semantic ramp. Android retains native nonlinear scaling; never multiply text metrics by a global font scale. RN 0.86 can reuse stale paragraph measurements after a live size change, so only noneditable root Text nodes renew at a new iOS font scale. This may end text selection during that system change; TextInput nodes never remount. Native TextInput supports the body ramp through its native view attributes even though its TypeScript interface omits the prop. Keep this adapter covered by native resize and subsequent-update checks. Base tokens remain unscaled for icons/layout. - Let controls grow with padding/minimum sizes; wrap essential button/form labels. Use `theme.largeText` to stack crowded metadata and choices. Composer measures its native body line, bounds the field to one fifth of the viewport (at least one complete line), and preserves the input node, draft and selection. Long drafts scroll inside the field and can expand into a full-screen editor that shares the same draft, mention suggestions and send path. Filter headings scroll with choices; large-text Usage summaries keep their amount semantic role and move the chart to the existing detail screen. Native navigation chrome and Markdown keep their platform scaling owners. diff --git a/apps/mobile/src/ui/primitives/row-icon.tsx b/apps/mobile/src/ui/primitives/row-icon.tsx index 52870f2aaf..b68ded35cb 100644 --- a/apps/mobile/src/ui/primitives/row-icon.tsx +++ b/apps/mobile/src/ui/primitives/row-icon.tsx @@ -1,7 +1,7 @@ -import { SymbolView } from 'expo-symbols'; import type { ColorValue } from 'react-native'; import { useDesignTheme } from '../design/theme'; +import { SystemSymbol } from './system-symbol'; const ROW_ICONS = { model: { ios: 'cpu', android: 'memory' }, @@ -36,12 +36,10 @@ export function RowIcon({ }) { const theme = useDesignTheme(); return ( - ); } diff --git a/apps/mobile/src/ui/primitives/system-symbol.android.tsx b/apps/mobile/src/ui/primitives/system-symbol.android.tsx new file mode 100644 index 0000000000..caabfac3af --- /dev/null +++ b/apps/mobile/src/ui/primitives/system-symbol.android.tsx @@ -0,0 +1,18 @@ +import { SymbolView } from 'expo-symbols'; + +import { useDesignTheme } from '../design/theme'; +import type { SystemSymbolProps } from './system-symbol'; + +export function SystemSymbol({ name, size, color }: SystemSymbolProps) { + const theme = useDesignTheme(); + return ( + + ); +} diff --git a/apps/mobile/src/ui/primitives/system-symbol.tsx b/apps/mobile/src/ui/primitives/system-symbol.tsx new file mode 100644 index 0000000000..c72622ab1d --- /dev/null +++ b/apps/mobile/src/ui/primitives/system-symbol.tsx @@ -0,0 +1,20 @@ +import { SymbolView, type SymbolViewProps } from 'expo-symbols'; +import type { ColorValue } from 'react-native'; + +export type SystemSymbolProps = { + name: SymbolViewProps['name']; + size: number; + color: ColorValue; +}; + +export function SystemSymbol({ name, size, color }: SystemSymbolProps) { + return ( + + ); +} diff --git a/apps/mobile/src/ui/shell/environment-pager.tsx b/apps/mobile/src/ui/shell/environment-pager.tsx index e7233f201e..d1a22e3ece 100644 --- a/apps/mobile/src/ui/shell/environment-pager.tsx +++ b/apps/mobile/src/ui/shell/environment-pager.tsx @@ -42,7 +42,7 @@ export function EnvironmentPager({ : route.hostColor === undefined ? theme.color.fg : hostColorInk(theme.scheme, theme.color, route.hostColor); - const size = theme.type.meta.line; + const size = theme.type.meta.line * theme.fontScale; const leading = route.hostIcon !== undefined ? ( diff --git a/apps/mobile/src/ui/shell/host-look-editor.tsx b/apps/mobile/src/ui/shell/host-look-editor.tsx index 3cbe868d6e..966ca894a7 100644 --- a/apps/mobile/src/ui/shell/host-look-editor.tsx +++ b/apps/mobile/src/ui/shell/host-look-editor.tsx @@ -97,7 +97,7 @@ function Preview({ hostName, look }: { hostName: string; look: HostLook }) { true, , )} diff --git a/apps/mobile/src/ui/shell/host-tile.tsx b/apps/mobile/src/ui/shell/host-tile.tsx index c31b46d5e0..ae28af3910 100644 --- a/apps/mobile/src/ui/shell/host-tile.tsx +++ b/apps/mobile/src/ui/shell/host-tile.tsx @@ -1,8 +1,8 @@ -import { SymbolView } from 'expo-symbols'; import { View } from 'react-native'; import { HOST_SYMBOLS, type HostIcon } from '../design/host-look'; import { radius } from '../design/tokens'; +import { SystemSymbol } from '../primitives/system-symbol'; import { Text } from '../primitives/text'; export function hostInitial(hostName: string): string { @@ -11,15 +11,7 @@ export function hostInitial(hostName: string): string { export function HostGlyph({ icon, size, color }: { icon: HostIcon; size: number; color: string }) { if (icon.kind === 'symbol') - return ( - - ); + return ; return ( ({ width: 411, height: 914, scale: 3, fontScale: 2 })); +vi.mock('react-native', async () => ({ + ...(await import('./react-native-shim')), + useWindowDimensions: () => screen, +})); +vi.mock('expo-symbols', () => ({ + SymbolView: ({ size, style }: { size: number; style: { width: number; height: number } }) => + createElement('i', { 'data-glyph': size, 'data-box': `${style.width}x${style.height}` }), +})); + +import { SystemSymbol } from '../src/ui/primitives/system-symbol.android'; + +Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true }); + +let root: Root | undefined; +let host: HTMLElement | undefined; +afterEach(() => { + act(() => root?.unmount()); + host?.remove(); +}); + +it('keeps an Android system symbol inside its box under large text', async () => { + host = document.createElement('div'); + document.body.append(host); + root = createRoot(host); + await act(async () => + root!.render( + , + ), + ); + const symbol = host.querySelector('i')!; + expect(Number(symbol.dataset['glyph']) * screen.fontScale).toBe(32); + expect(symbol.dataset['box']).toBe('32x32'); +}); diff --git a/changes/mobile-android-large-text-tab-icons.md b/changes/mobile-android-large-text-tab-icons.md new file mode 100644 index 0000000000..e4a94ede46 --- /dev/null +++ b/changes/mobile-android-large-text-tab-icons.md @@ -0,0 +1,11 @@ +--- +section: Fixed +--- + +## en + +- Mobile: with large system text on Android, the computer icon in the Chats tabs, the Customize computer preview and settings row icons now grow with their labels instead of being clipped. + +## zh + +- 移动端:安卓系统字体放大后,「聊天」顶部标签里的电脑图标、自定义电脑的预览和设置行图标会跟随文字一起放大,不再被裁切。 From 7645fdf0ebda058ea184178c16dace3d208aecac Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 13:46:26 +0000 Subject: [PATCH 2/2] docs(changes): link the Android tab icon fix to its PR Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_014UiRXqKRSQS39KzeJJnLcA --- apps/mobile/test/system-symbol-android.test.tsx | 6 +++++- ...icons.md => 2507-mobile-android-large-text-tab-icons.md} | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) rename changes/{mobile-android-large-text-tab-icons.md => 2507-mobile-android-large-text-tab-icons.md} (54%) diff --git a/apps/mobile/test/system-symbol-android.test.tsx b/apps/mobile/test/system-symbol-android.test.tsx index 71c7b85e24..de5be6894d 100644 --- a/apps/mobile/test/system-symbol-android.test.tsx +++ b/apps/mobile/test/system-symbol-android.test.tsx @@ -30,7 +30,11 @@ it('keeps an Android system symbol inside its box under large text', async () => root = createRoot(host); await act(async () => root!.render( - , + , ), ); const symbol = host.querySelector('i')!; diff --git a/changes/mobile-android-large-text-tab-icons.md b/changes/2507-mobile-android-large-text-tab-icons.md similarity index 54% rename from changes/mobile-android-large-text-tab-icons.md rename to changes/2507-mobile-android-large-text-tab-icons.md index e4a94ede46..3ff6403df7 100644 --- a/changes/mobile-android-large-text-tab-icons.md +++ b/changes/2507-mobile-android-large-text-tab-icons.md @@ -4,8 +4,8 @@ section: Fixed ## en -- Mobile: with large system text on Android, the computer icon in the Chats tabs, the Customize computer preview and settings row icons now grow with their labels instead of being clipped. +- Mobile: with large system text on Android, the computer icon in the Chats tabs, the Customize computer preview and settings row icons now grow with their labels instead of being clipped ([#2507](https://github.com/BotHarness/DeepSeekBot/pull/2507)). ## zh -- 移动端:安卓系统字体放大后,「聊天」顶部标签里的电脑图标、自定义电脑的预览和设置行图标会跟随文字一起放大,不再被裁切。 +- 移动端:安卓系统字体放大后,「聊天」顶部标签里的电脑图标、自定义电脑的预览和设置行图标会跟随文字一起放大,不再被裁切([#2507](https://github.com/BotHarness/DeepSeekBot/pull/2507))。