react-native-ui-lib icon indicating copy to clipboard operation
react-native-ui-lib copied to clipboard

fix: android font weight not matching

Open hjick opened this issue 2 years ago • 1 comments

fix: https://github.com/wix/react-native-ui-lib/issues/2696#issue-1835247503

Description

I switched to weightKey -> weightValue. The fontWeight BO, H, and BL were not applied to Android.

Changelog

typographyPresets.ts

Additional info

const weightsMap = { THIN: 'T', LIGHT: 'L', REGULAR: 'R', MEDIUM: 'M', BOLD: 'BO', HEAVY: 'H', BLACK: 'BL' };

_.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 }; }); });

In this codes, weightKey can never be included in ['BO', 'H', 'BL']. It can be only 'THIN', 'LIGHT', 'REGULAR' .... weightValue must to be there.

hjick avatar Oct 03 '23 05:10 hjick

@M-i-k-e-l hello, Can you check this PR? I think this PR fixed it. I know you're busy, but could you please take a look?

hjick avatar Mar 22 '24 03:03 hjick