Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/mobile/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 3 additions & 5 deletions apps/mobile/src/ui/primitives/row-icon.tsx
Original file line number Diff line number Diff line change
@@ -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' },
Expand Down Expand Up @@ -36,12 +36,10 @@ export function RowIcon({
}) {
const theme = useDesignTheme();
return (
<SymbolView
<SystemSymbol
name={ROW_ICONS[name]}
size={size ?? theme.type.title.line}
tintColor={color ?? theme.color.fg}
accessible={false}
importantForAccessibility="no"
color={color ?? theme.color.fg}
/>
);
}
18 changes: 18 additions & 0 deletions apps/mobile/src/ui/primitives/system-symbol.android.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<SymbolView
name={name}
size={size / theme.fontScale}
tintColor={color}
accessible={false}
importantForAccessibility="no"
style={{ width: size, height: size, alignItems: 'center', justifyContent: 'center' }}
/>
);
}
20 changes: 20 additions & 0 deletions apps/mobile/src/ui/primitives/system-symbol.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<SymbolView
name={name}
size={size}
tintColor={color}
accessible={false}
importantForAccessibility="no"
/>
);
}
2 changes: 1 addition & 1 deletion apps/mobile/src/ui/shell/environment-pager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
<HostGlyph icon={route.hostIcon} size={size} color={tint} />
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/ui/shell/host-look-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function Preview({ hostName, look }: { hostName: string; look: HostLook }) {
true,
<HostGlyph
icon={look.icon}
size={theme.type.meta.line}
size={theme.type.meta.line * theme.fontScale}
color={look.color === undefined ? theme.color.fg : ink}
/>,
)}
Expand Down
12 changes: 2 additions & 10 deletions apps/mobile/src/ui/shell/host-tile.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 (
<SymbolView
name={HOST_SYMBOLS[icon.id]}
size={size}
tintColor={color}
accessible={false}
importantForAccessibility="no"
/>
);
return <SystemSymbol name={HOST_SYMBOLS[icon.id]} size={size} color={color} />;
return (
<Text
allowFontScaling={false}
Expand Down
43 changes: 43 additions & 0 deletions apps/mobile/test/system-symbol-android.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// @vitest-environment jsdom
import { act, createElement } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { afterEach, expect, it, vi } from 'vitest';

const screen = vi.hoisted(() => ({ 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(
<SystemSymbol
name={{ ios: 'desktopcomputer', android: 'computer' }}
size={32}
color="#000"
/>,
),
);
const symbol = host.querySelector('i')!;
expect(Number(symbol.dataset['glyph']) * screen.fontScale).toBe(32);
expect(symbol.dataset['box']).toBe('32x32');
});
11 changes: 11 additions & 0 deletions changes/2507-mobile-android-large-text-tab-icons.md
Original file line number Diff line number Diff line change
@@ -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 ([#2507](https://github.com/BotHarness/DeepSeekBot/pull/2507)).

## zh

- 移动端:安卓系统字体放大后,「聊天」顶部标签里的电脑图标、自定义电脑的预览和设置行图标会跟随文字一起放大,不再被裁切([#2507](https://github.com/BotHarness/DeepSeekBot/pull/2507))。
Loading