From df8d7e69c3b1efda48eebb2c706b799b8a915e1a Mon Sep 17 00:00:00 2001 From: hjick Date: Tue, 3 Oct 2023 14:33:46 +0900 Subject: [PATCH] fix: android font weight not matching --- src/style/typographyPresets.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/style/typographyPresets.ts b/src/style/typographyPresets.ts index 47818bdd2b..24713c6379 100644 --- a/src/style/typographyPresets.ts +++ b/src/style/typographyPresets.ts @@ -6,10 +6,7 @@ export const WEIGHT_TYPES: {[key: string]: TextStyle['fontWeight']} = { THIN: '200' as const, LIGHT: '300' as const, REGULAR: '400' as const, - MEDIUM: - parseFloat(Platform.Version as string) >= 11.2 - ? '600' - : ('500' as '500' | '600'), + MEDIUM: parseFloat(Platform.Version as string) >= 11.2 ? '600' : ('500' as '500' | '600'), BOLD: '700' as const, HEAVY: '800' as const, BLACK: '900' as const @@ -219,13 +216,17 @@ const weightsMap = { BLACK: 'BL' }; -_.forEach(keys, (key) => { +_.forEach(keys, key => { _.forEach(weightsMap, (weightValue, weightKey) => { const fontKey = `text${key}` as keyof TypographyKeys; const fontWeightKey = `${fontKey}${weightValue}` as keyof TypographyKeys; Typography[fontWeightKey] = { ...Typography[fontKey], - fontWeight: Constants.isIOS ? WEIGHT_TYPES[weightKey] : ['BO', 'H', 'BL'].includes(weightKey) ? 'bold' : undefined + fontWeight: Constants.isIOS + ? WEIGHT_TYPES[weightKey] + : ['BO', 'H', 'BL'].includes(weightValue) + ? 'bold' + : undefined }; }); });