mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Mark setAccessibilityFocus as deprecated (#54968)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54968 The `AccessibilityInfo.setAccessibilityFocus` API is unsupported in the new architecture and a perfectly valid alternative exists that *is* supported: `AccessibilityInfo.sendAccessibilityEvent`. This change marks the prior as deprecated with a code comment pointing to the new API and adds a missing type to the `AccessibilityEventTypes` type signature for `windowStateChange` Changelog: [General][Deprecated] - Deprecated `AccessibilityInfo.setAccessibilityFocus` in favor of `AccessibilityInfo.sendAccessibilityEvent` Reviewed By: mdvacca Differential Revision: D89729103 fbshipit-source-id: 4e55adb9a7ae7ba773e1e258359e67106488bee3
This commit is contained in:
1 parent
dfcb56dfea
commit
36a0d9ef63
2 files changed
+14
-4
No files matched your search
+7
-1
@@ -42,7 +42,11 @@ type AccessibilityEventDefinitions = {
|
||||
screenReaderChanged: [boolean],
|
||||
};
|
||||
|
||||
type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
|
||||
type AccessibilityEventTypes =
|
||||
| 'click'
|
||||
| 'focus'
|
||||
| 'viewHoverEnter'
|
||||
| 'windowStateChange';
|
||||
|
||||
// Mapping of public event names to platform-specific event names.
|
||||
const EventNames: Map<
|
||||
@@ -438,6 +442,8 @@ const AccessibilityInfo = {
|
||||
* Set accessibility focus to a React component.
|
||||
*
|
||||
* See https://reactnative.dev/docs/accessibilityinfo#setaccessibilityfocus
|
||||
*
|
||||
* @deprecated Use `sendAccessibilityEvent` with eventType `focus` instead.
|
||||
*/
|
||||
setAccessibilityFocus(reactTag: number): void {
|
||||
legacySendAccessibilityEvent(reactTag, 'focus');
|
||||
|
||||
+7
-3
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<bffba0612c645ddb6166e1f5bb1187f2>>
|
||||
* @generated SignedSource<<9504863966549f8efbbe4e13d7f74eaf>>
|
||||
*
|
||||
* This file was generated by scripts/js-api/build-types/index.js.
|
||||
*/
|
||||
@@ -1076,7 +1076,11 @@ declare type AccessibilityEventDefinitionsIOS = {
|
||||
invertColorsChanged: [boolean]
|
||||
reduceTransparencyChanged: [boolean]
|
||||
}
|
||||
declare type AccessibilityEventTypes = "click" | "focus" | "viewHoverEnter"
|
||||
declare type AccessibilityEventTypes =
|
||||
| "click"
|
||||
| "focus"
|
||||
| "viewHoverEnter"
|
||||
| "windowStateChange"
|
||||
declare type AccessibilityInfo = typeof AccessibilityInfo
|
||||
declare type AccessibilityProps = Readonly<
|
||||
AccessibilityPropsAndroid &
|
||||
@@ -5954,7 +5958,7 @@ declare type WrapperComponentProvider = (
|
||||
) => React.ComponentType<any>
|
||||
export {
|
||||
AccessibilityActionEvent, // f6181a2c
|
||||
AccessibilityInfo, // ce4850e1
|
||||
AccessibilityInfo, // 3e373fdc
|
||||
AccessibilityProps, // 5a2836fc
|
||||
AccessibilityRole, // f2f2e066
|
||||
AccessibilityState, // b0c2b3f7
|
||||
|
||||
Reference in new issue
Block a user