diff --git a/packages/core/accessibility/font-scale.android.ts b/packages/core/accessibility/font-scale.android.ts index 0adec6c75..c8112ba25 100644 --- a/packages/core/accessibility/font-scale.android.ts +++ b/packages/core/accessibility/font-scale.android.ts @@ -11,6 +11,7 @@ function fontScaleChanged(origFontScale: number) { Application.notify({ eventName: Application.fontScaleChangedEvent, object: Application, + newValue: currentFontScale, }); } } diff --git a/packages/core/accessibility/font-scale.ios.ts b/packages/core/accessibility/font-scale.ios.ts index 2b9c6f56e..5de596810 100644 --- a/packages/core/accessibility/font-scale.ios.ts +++ b/packages/core/accessibility/font-scale.ios.ts @@ -11,6 +11,7 @@ function fontScaleChanged(origFontScale: number) { Application.notify({ eventName: Application.fontScaleChangedEvent, object: Application, + newValue: currentFontScale, }); } } diff --git a/packages/core/application/index.d.ts b/packages/core/application/index.d.ts index 3b3000dd4..f95a9c477 100644 --- a/packages/core/application/index.d.ts +++ b/packages/core/application/index.d.ts @@ -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. */ @@ -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". diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts index 2c202d540..53789a113 100644 --- a/packages/core/index.d.ts +++ b/packages/core/index.d.ts @@ -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; diff --git a/packages/core/index.ts b/packages/core/index.ts index 709ba7fc6..d40e172b2 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -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, @@ -18,6 +18,7 @@ export const Application = { orientationChangedEvent, systemAppearanceChangedEvent, systemAppearanceChanged, + fontScaleChangedEvent, getMainEntry, getRootView,