feat(core): first class a11y support (#8909)

This commit is contained in:
Morten Sjøgren
2021-01-29 20:51:51 +01:00
committed by Nathan Walker
parent ef9c3b1f5f
commit c46da3fad9
43 changed files with 2938 additions and 47 deletions

View File

@ -0,0 +1,15 @@
export const VALID_FONT_SCALES = global.isIOS // iOS supports a wider number of font scales than Android does.
? [0.5, 0.7, 0.85, 1, 1.15, 1.3, 1.5, 2, 2.5, 3, 3.5, 4]
: [0.85, 1, 1.15, 1.3];
export function getClosestValidFontScale(fontScale: number): number {
fontScale = Number(fontScale) || 1;
return VALID_FONT_SCALES.sort((a, b) => Math.abs(fontScale - a) - Math.abs(fontScale - b)).shift();
}
export enum FontScaleCategory {
ExtraSmall = 'extra-small',
Medium = 'medium',
ExtraLarge = 'extra-large',
}