mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(ios): new a11y properties for managing font scale (#10260)
This commit is contained in:
committed by
GitHub
parent
2f9e5c0b84
commit
7aaa1d899d
@@ -52,10 +52,10 @@ function applyFontScaleToRootViews(): void {
|
||||
|
||||
const fontScale = getCurrentFontScale();
|
||||
|
||||
rootView.style._fontScale = fontScale;
|
||||
rootView.style.fontScaleInternal = fontScale;
|
||||
|
||||
const rootModalViews = <Array<View>>rootView._getRootModalViews();
|
||||
rootModalViews.forEach((rootModalView) => (rootModalView.style._fontScale = fontScale));
|
||||
rootModalViews.forEach((rootModalView) => (rootModalView.style.fontScaleInternal = fontScale));
|
||||
}
|
||||
|
||||
export function initAccessibilityCssHelper(): void {
|
||||
|
||||
@@ -31,6 +31,30 @@ export const accessibilityEnabledProperty = new CssProperty<Style, boolean>({
|
||||
});
|
||||
accessibilityEnabledProperty.register(Style);
|
||||
|
||||
export const iosAccessibilityAdjustsFontSizeProperty = new InheritedCssProperty<Style, boolean>({
|
||||
defaultValue: false,
|
||||
name: 'iosAccessibilityAdjustsFontSize',
|
||||
cssName: 'ios-a11y-adjusts-font-size',
|
||||
valueConverter: booleanConverter,
|
||||
});
|
||||
iosAccessibilityAdjustsFontSizeProperty.register(Style);
|
||||
|
||||
export const iosAccessibilityMinFontScaleProperty = new InheritedCssProperty<Style, number>({
|
||||
defaultValue: 0,
|
||||
name: 'iosAccessibilityMinFontScale',
|
||||
cssName: 'ios-a11y-min-font-scale',
|
||||
valueConverter: parseFloat,
|
||||
});
|
||||
iosAccessibilityMinFontScaleProperty.register(Style);
|
||||
|
||||
export const iosAccessibilityMaxFontScaleProperty = new InheritedCssProperty<Style, number>({
|
||||
defaultValue: 0,
|
||||
name: 'iosAccessibilityMaxFontScale',
|
||||
cssName: 'ios-a11y-max-font-scale',
|
||||
valueConverter: parseFloat,
|
||||
});
|
||||
iosAccessibilityMaxFontScaleProperty.register(Style);
|
||||
|
||||
export const accessibilityHiddenProperty = new (global.isIOS ? InheritedCssProperty : CssProperty)({
|
||||
name: 'accessibilityHidden',
|
||||
cssName: 'a11y-hidden',
|
||||
|
||||
Reference in New Issue
Block a user