fix: android font weight not matching
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.
@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?