AccessibilityInfo
The AccessibilityInfo
API provides functionalty that allows you to query the current state of the screen reader and to register to be notified when the state of the screen reader changes.
Kepler Support
To properly use this module, you app must request the com.amazon.devconf.privilege.accessibility
privilege in the manifest.toml
file.
Implemented Methods
addEventListener
Use the AccessibilityInfo.addEventListener
to listen for accessibility events, such as when a screen reader is turned on or off. This helps make your apps more accessible by responding dynamically to user settings.
Supported events
Event | Description |
---|---|
screenReaderChanged |
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. |
Example usage
//Method signature
static addEventListener(
eventName: AccessibilityChangeEventName | AccessibilityAnnouncementEventName,
handler: (
event: AccessibilityChangeEvent | AccessibilityAnnouncementFinishedEvent,
) => void,
): EmitterSubscription;
// Usage
//here enabled is a state variable
const subscription = AccessibilityInfo.addEventListener(
'screenReaderChanged',
(enabled) => {
setIsScreenReaderEnabled(enabled);
}
);
announceForAccessibility
Trigger an accessibility announcement for the screen reader. It programmatically announces the specified message to notify users of important changes in the app's UI, such as status updates or alerts. The announcement isn't associated with a specific UI element and is best for general notifications.
Example usage
AccessibilityInfo.announceForAccessibility('Your changes have been saved.');
announceForAccessibilityWithOptions
The announceForAccessibilityWithOptions
method extends the functionality of announceForAccessibility
by allowing developers to customize the behavior of announcements such as waiting for existing announcements to complete before announcing a new message.
Example usage
AccessibilityInfo.announceForAccessibilityWithOptions( 'Form submitted successfully.', { queue: false } /* Interrupt ongoing announcements*/ );
Accepted values
Name | Type | Description |
---|---|---|
announcement | string | The string to announce. |
options | object | queue - Queue the announcement behind existing speech. |
Post a string to be announced by the screen reader with modification options. By default, announcements interrupt any existing speech. However, on Kepler, you can queue them behind existing speech by setting queue to true
in the options object.
isScreenReaderEnabled
Use the isScreenReaderEnabled
method to 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.
Example usage
static isScreenReaderEnabled(): Promise<boolean>;
Related topics
Last updated: Sep 30, 2025