Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 54 additions & 7 deletions types/react-native/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6926,7 +6926,15 @@ export interface ShareStatic {
dismissedAction: "dismissedAction";
}

type AccessibilityEventName = "change" | "announcementFinished";
type AccessibilityEventName =
"change" | // deprecated, maps to screenReaderChanged
"boldTextChanged" | // iOS-only Event
"grayscaleChanged" | // iOS-only Event
"invertColorsChanged" | // iOS-only Event
"reduceMotionChanged" |
"screenReaderChanged" |
"reduceTransparencyChanged" | // iOS-only Event
"announcementFinished"; // iOS-only Event

type AccessibilityChangeEvent = boolean;

Expand All @@ -6941,22 +6949,61 @@ type AccessibilityEvent = AccessibilityChangeEvent | AccessibilityAnnoucementFin
* @see https://facebook.github.io/react-native/docs/accessibilityinfo.html
*/
export interface AccessibilityInfoStatic {
/**
* Query whether bold text is currently enabled.
*
* @platform ios
*/
isBoldTextEnabled: () => Promise<boolean>;

/**
* Query whether grayscale is currently enabled.
*
* @platform ios
*/
isGrayscaleEnabled: () => Promise<boolean>;

/**
* Query whether invert colors is currently enabled.
*
* @platform ios
*/
isInvertColorsEnabled: () => Promise<boolean>;

/**
* Query whether reduce motion is currently enabled.
*/
isReduceMotionEnabled: () => Promise<boolean>;

/**
* Query whether reduce transparency is currently enabled.
*
* @platform ios
*/
isReduceTransparencyEnabled: () => Promise<boolean>;

/**
* 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>;
isScreenReaderEnabled: () => 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.
* Query whether a screen reader is currently enabled.
*
* @deprecated use isScreenReaderChanged instead
*/
fetch(): () => Promise<boolean>;

/**
* Add an event handler. Supported events:
* - 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.
* - AccessibilityEventName constants other than announcementFinished: Fires on accessibility feature change.
* The argument to the event handler is a boolean.
* The boolean is true when the related event's feature is enabled and false otherwise.
*
*/
addEventListener: (eventName: AccessibilityEventName, handler: (event: AccessibilityEvent) => void) => void;

Expand Down