Skip to content

Commit

Permalink
fix(a11y): add missing application event for fontScaleChanged (#9396)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjuan027 authored May 13, 2021
1 parent 7a92c16 commit dac36c6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/accessibility/font-scale.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function fontScaleChanged(origFontScale: number) {
Application.notify({
eventName: Application.fontScaleChangedEvent,
object: Application,
newValue: currentFontScale,
});
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/accessibility/font-scale.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function fontScaleChanged(origFontScale: number) {
Application.notify({
eventName: Application.fontScaleChangedEvent,
object: Application,
newValue: currentFontScale,
});
}
}
Expand Down
12 changes: 12 additions & 0 deletions packages/core/application/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ export interface SystemAppearanceChangedEventData extends ApplicationEventData {
newValue: 'light' | 'dark';
}

/**
* Event data containing information for font scale changed event.
*/
export interface FontScaleChangedEventData extends ApplicationEventData {
/**
* New font scale value.
*/
newValue: number;
}

/**
* Event data containing information about unhandled application errors.
*/
Expand Down Expand Up @@ -328,6 +338,8 @@ export function on(event: 'orientationChanged', callback: (args: OrientationChan
*/
export function on(event: 'systemAppearanceChanged', callback: (args: SystemAppearanceChangedEventData) => void, thisArg?: any);

export function on(event: 'fontScaleChanged', callback: (args: FontScaleChangedEventData) => void, thisArg?: any);

/**
* Gets the orientation of the application.
* Available values: "portrait", "landscape", "unknown".
Expand Down
1 change: 1 addition & 0 deletions packages/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export declare const Application: {
lowMemoryEvent: string;
orientationChangedEvent: string;
systemAppearanceChangedEvent: string;
fontScaleChangedEvent: string;
systemAppearanceChanged: typeof systemAppearanceChanged;
getMainEntry: typeof getMainEntry;
getRootView: typeof getRootView;
Expand Down
3 changes: 2 additions & 1 deletion packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import './globals';
export { iOSApplication, AndroidApplication } from './application';
export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application';

import { launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance } from './application';
import { fontScaleChangedEvent, launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance } from './application';
export const Application = {
launchEvent,
displayedEvent,
Expand All @@ -18,6 +18,7 @@ export const Application = {
orientationChangedEvent,
systemAppearanceChangedEvent,
systemAppearanceChanged,
fontScaleChangedEvent,

getMainEntry,
getRootView,
Expand Down

0 comments on commit dac36c6

Please sign in to comment.