Skip to content

Commit ceb06de

Browse files
only21milcodex
andauthored
fix(mobile): keep source text bold for numeric font weights (#23688)
Co-authored-by: GPT-6.1 Sol <[email protected]>
1 parent 083c903 commit ceb06de

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { expect, it, vi } from "vite-plus/test";
2+
3+
import { flattenStyles } from "./util";
4+
5+
vi.mock("react-native", () => ({
6+
I18nManager: { isRTL: false },
7+
StyleSheet: {
8+
flatten: (styles: ReadonlyArray<object | undefined>) => Object.assign({}, ...styles),
9+
},
10+
}));
11+
12+
it("encodes numeric bold weights as bold source-text runs", () => {
13+
expect(flattenStyles({ fontWeight: 700 }, undefined).fontWeight).toBe("bold");
14+
expect(flattenStyles({ fontWeight: "400" }, { fontWeight: "700" }).fontWeight).toBe("bold");
15+
});

‎apps/mobile/modules/t3-source-text/src/util.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function fontWeightToNativeProp(fontWeight: TextStyle["fontWeight"]): NativeFont
6464
return "semibold";
6565
case 700:
6666
case "700":
67-
return "semibold";
67+
return "bold";
6868
case 800:
6969
case "800":
7070
return "bold";

0 commit comments

Comments
 (0)