Fixed regression from previous check in.

This commit is contained in:
ericptraut 2017-04-05 21:30:56 -07:00
Родитель c0a99c2843
Коммит 58fa622611
3 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -28,7 +28,7 @@ export class Accessibility extends NativeAccessibility {
constructor() { constructor() {
super(); super();
// Subscribe to an event to get notified when an announcement will finish. // 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) { protected _updateScreenReaderStatus(isEnabled: boolean) {
@ -57,7 +57,7 @@ export class Accessibility extends NativeAccessibility {
if (resetTimestamp) { if (resetTimestamp) {
this._retryTimestamp = Date.now(); this._retryTimestamp = Date.now();
} }
RN.Accessibility.announceForAccessibility(announcement); RN.AccessibilityInfo.announceForAccessibility(announcement);
} }
private _recalcAnnouncement = (payload: AnnouncementFinishedPayload) => { private _recalcAnnouncement = (payload: AnnouncementFinishedPayload) => {

Просмотреть файл

@ -22,13 +22,13 @@ export class Accessibility extends CommonAccessibility {
let initialStateChanged = false; let initialStateChanged = false;
// Subscribe to an event to get notified when screen reader is enabled or disabled. // 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; initialStateChanged = true;
this._updateScreenReaderStatus(isEnabled); this._updateScreenReaderStatus(isEnabled);
}); });
// Fetch initial state. // Fetch initial state.
RN.Accessibility.fetch().then(isEnabled => { RN.AccessibilityInfo.fetch().then(isEnabled => {
if (!initialStateChanged) { if (!initialStateChanged) {
this._updateScreenReaderStatus(isEnabled); this._updateScreenReaderStatus(isEnabled);
} }

2
src/typings/react-native.d.ts поставляемый
Просмотреть файл

@ -689,7 +689,7 @@ declare module 'react-native' {
static removeEventListener(type: string, handler: (event: any) => void): void; static removeEventListener(type: string, handler: (event: any) => void): void;
} }
class Accessibility { class AccessibilityInfo {
static fetch: () => Promise<boolean>; static fetch: () => Promise<boolean>;
static addEventListener(type: string, handler: (event: any) => void): void; static addEventListener(type: string, handler: (event: any) => void): void;
static removeEventListener(type: string, handler: (event: any) => void): void; static removeEventListener(type: string, handler: (event: any) => void): void;