Skip to content

Commit f120c51

Browse files
fix(mobile): list bullets keep a gap before their text at every text size (#26268)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8947f3e commit f120c51

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

‎apps/mobile/src/native/EnrichedMarkdownText.tsx‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
markdownWithTableBreaks,
1313
} from "../lib/markdownDocument";
1414
import { isValidElement, useMemo, useState, type ReactNode } from "react";
15-
import { Platform, Share, StyleSheet, View } from "react-native";
15+
import { Platform, Share, StyleSheet, useWindowDimensions, View } from "react-native";
1616
import {
1717
EnrichedMarkdownText,
1818
type MarkdownImageBlock,
@@ -35,6 +35,7 @@ import {
3535
function enrichedStyle(
3636
style: SelectableMarkdownTextProps["textStyle"],
3737
dark: boolean,
38+
fontScale: number,
3839
): MarkdownStyle {
3940
const monospace = Platform.OS === "ios" ? "Menlo" : "monospace";
4041
// Keep the radius modest: iOS clips square table-cell borders without stroking the corner arcs.
@@ -132,7 +133,13 @@ function enrichedStyle(
132133
borderWidth: 2,
133134
gapWidth: 12,
134135
},
135-
list: { ...body, bulletColor: style.mutedColor, markerColor: style.mutedColor, gapWidth: 6 },
136+
list: {
137+
...body,
138+
bulletColor: style.mutedColor,
139+
markerColor: style.mutedColor,
140+
// The bullet is centred on the gap's edge and scales with the system text size; the gap must too.
141+
gapWidth: 12 * fontScale,
142+
},
136143
thematicBreak: { color: style.dividerColor, height: 1, marginTop: 8, marginBottom: 8 },
137144
table: {
138145
...body,
@@ -256,9 +263,13 @@ export function MobileEnrichedMarkdownText(props: SelectableMarkdownTextProps) {
256263
mimeTypes: { "app.t3.context-fragment": props.contextClipboardFragment! },
257264
};
258265
}, [props.contextClipboardFragment, props.markdown]);
266+
const { fontScale } = useWindowDimensions();
259267
const markdownStyle = useMemo(
260-
() => ({ ...enrichedStyle(props.textStyle, themeAppearance === "dark"), linkVariants }),
261-
[props.textStyle, themeAppearance, linkVariants],
268+
() => ({
269+
...enrichedStyle(props.textStyle, themeAppearance === "dark", fontScale),
270+
linkVariants,
271+
}),
272+
[props.textStyle, themeAppearance, fontScale, linkVariants],
262273
);
263274
const renderers = renderImage
264275
? {

0 commit comments

Comments
 (0)