зеркало из https://github.com/microsoft/reactxp.git
Fixed regression from previous check in.
This commit is contained in:
Родитель
c0a99c2843
Коммит
58fa622611
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче