diff --git a/src/ios/Accessibility.ts b/src/ios/Accessibility.ts index d790e593..ebd42d1d 100644 --- a/src/ios/Accessibility.ts +++ b/src/ios/Accessibility.ts @@ -28,7 +28,7 @@ export class Accessibility extends NativeAccessibility { constructor() { super(); // Subscribe to an event to get notified when an announcement will finish. - RN.Accessibility.addEventListener('announcementFinished', this._recalcAnnouncement); + RN.AccessibilityInfo.addEventListener('announcementFinished', this._recalcAnnouncement); } protected _updateScreenReaderStatus(isEnabled: boolean) { @@ -57,7 +57,7 @@ export class Accessibility extends NativeAccessibility { if (resetTimestamp) { this._retryTimestamp = Date.now(); } - RN.Accessibility.announceForAccessibility(announcement); + RN.AccessibilityInfo.announceForAccessibility(announcement); } private _recalcAnnouncement = (payload: AnnouncementFinishedPayload) => { diff --git a/src/native-common/Accessibility.ts b/src/native-common/Accessibility.ts index 8c4f8b37..4cedbf05 100644 --- a/src/native-common/Accessibility.ts +++ b/src/native-common/Accessibility.ts @@ -22,13 +22,13 @@ export class Accessibility extends CommonAccessibility { let initialStateChanged = false; // Subscribe to an event to get notified when screen reader is enabled or disabled. - RN.Accessibility.addEventListener('change', isEnabled => { + RN.AccessibilityInfo.addEventListener('change', isEnabled => { initialStateChanged = true; this._updateScreenReaderStatus(isEnabled); }); // Fetch initial state. - RN.Accessibility.fetch().then(isEnabled => { + RN.AccessibilityInfo.fetch().then(isEnabled => { if (!initialStateChanged) { this._updateScreenReaderStatus(isEnabled); } diff --git a/src/typings/react-native.d.ts b/src/typings/react-native.d.ts index baa6c545..10366017 100644 --- a/src/typings/react-native.d.ts +++ b/src/typings/react-native.d.ts @@ -689,7 +689,7 @@ declare module 'react-native' { static removeEventListener(type: string, handler: (event: any) => void): void; } - class Accessibility { + class AccessibilityInfo { static fetch: () => Promise; static addEventListener(type: string, handler: (event: any) => void): void; static removeEventListener(type: string, handler: (event: any) => void): void;