mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge pull request #21495 from Fitzpasd/react_native_accessibility_info
react-native: Add AccessibilityInfo API
This commit is contained in:
commit
84197d2a64
48
types/react-native/index.d.ts
vendored
48
types/react-native/index.d.ts
vendored
@ -6262,6 +6262,51 @@ export interface ShareStatic {
|
||||
dismissedAction: string
|
||||
}
|
||||
|
||||
type AccessibilityChangeEventName = 'change' | 'announcementFinished';
|
||||
|
||||
/**
|
||||
* @see https://facebook.github.io/react-native/docs/accessibilityinfo.html
|
||||
*/
|
||||
export interface AccessibilityInfoStatic {
|
||||
/**
|
||||
* Query whether a screen reader is currently enabled.
|
||||
* Returns a promise which resolves to a boolean. The result is true when a screen reader is enabled and false otherwise.
|
||||
*/
|
||||
fetch: () => Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Add an event handler. Supported events:
|
||||
* - change: Fires when the state of the screen reader changes.
|
||||
* The argument to the event handler is a boolean.
|
||||
* The boolean is true when a screen reader is enabled and false otherwise.
|
||||
*
|
||||
* - announcementFinished: iOS-only event. Fires when the screen reader has finished making an announcement.
|
||||
* The argument to the event handler is a dictionary with these keys:
|
||||
* - announcement: The string announced by the screen reader.
|
||||
* - success: A boolean indicating whether the announcement was successfully made.
|
||||
*/
|
||||
addEventListener: (eventName: AccessibilityChangeEventName, handler: () => void) => void;
|
||||
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*/
|
||||
removeEventListener: (eventName: AccessibilityChangeEventName, handler: () => void) => void;
|
||||
|
||||
/**
|
||||
* Set acessibility focus to a react component.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
setAccessibilityFocus: (reactTag: number) => void;
|
||||
|
||||
/**
|
||||
* Post a string to be announced by the screen reader.
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
announceForAccessibility: (announcement: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://facebook.github.io/react-native/docs/alert.html#content
|
||||
*/
|
||||
@ -8416,6 +8461,9 @@ export type Share = ShareStatic
|
||||
export var AdSupportIOS: AdSupportIOSStatic
|
||||
export type AdSupportIOS = AdSupportIOSStatic
|
||||
|
||||
export var AccessibilityInfo: AccessibilityInfoStatic
|
||||
export type AccessibilityInfo = AccessibilityInfoStatic
|
||||
|
||||
export var Alert: AlertStatic
|
||||
export type Alert = AlertStatic
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user