网页 综合 更新时间 2026-10-27 14:17:24

AccessibilityInfo · React Native

自动蜘蛛 reactnative.dev 正文约 3411 字
AccessibilityInfo · React Native
Sometimes it's useful to know whether or not the device has a screen reader that is currently active. The AccessibilityInfo API is designed for this purpose. You can use it to query the current state of the screen reader as well as to register to be notified when the state of the screen reader changes.
Add an event handler. Supported events:
Post a string to be announced by the screen reader.
Post a string to be announced by the screen reader with modification options. By default announcements will interrupt any existing speech, but on iOS they can be queued behind existing speech by setting queue to true in the options object. An optional priority can also be specified on iOS.
Gets the timeout in millisecond that the user needs. This value is set in "Time to take action (Accessibility timeout)" of "Accessibility" settings.
Check whether any accessibility service is enabled. This includes TalkBack but also any third-party accessibility app that may be installed. To only check whether TalkBack is enabled, use isScreenReaderEnabled. Returns a promise which resolves to a boolean. The result is true when some accessibility services is enabled and false otherwise.
Please use isScreenReaderEnabled if you only want to check the status of TalkBack.
Query whether a bold text is currently enabled. Returns a promise which resolves to a boolean. The result is true when bold text is enabled and false otherwise.
Query whether grayscale is currently enabled. Returns a promise which resolves to a boolean. The result is true when grayscale is enabled and false otherwise.
Query whether invert colors is currently enabled. Returns a promise which resolves to a boolean. The result is true when invert colors is enabled and false otherwise.
Query whether reduce motion is currently enabled. Returns a promise which resolves to a boolean. The result is true when reduce motion is enabled and false otherwise.
Query whether reduce transparency is currently enabled. Returns a promise which resolves to a boolean. The result is true when a reduce transparency is enabled and false otherwise.
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.
Query whether high text contrast is currently enabled. Returns a promise which resolves to a boolean. The result is true when high text contrast is enabled and false otherwise.
Query whether dark system colors is currently enabled. Returns a promise which resolves to a boolean. The result is true when dark system colors is enabled and false otherwise.
Query whether reduce motion and prefer cross-fade transitions settings are currently enabled. Returns a promise which resolves to a boolean. The result is true when prefer cross-fade transitions is enabled and false otherwise.
Prefer using sendAccessibilityEvent with eventType focus instead.
Set accessibility focus to a React component.
On Android, this calls UIManager.sendAccessibilityEvent method with passed reactTag and UIManager.AccessibilityEventTypes.typeViewFocused arguments.
Make sure that any View you want to receive the accessibility focus has accessible={true}.
Imperatively trigger an accessibility event on a React component, like changing the focused element for a screen reader.
Make sure that any View you want to receive the accessibility focus has accessible={true}.
访问原文 返回搜索 https://reactnative.dev/docs/accessibilityinfo
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。