Skip to content

Commit

Permalink
Minor: Rename AccessibilityInfo.sendAccessibilityEvent_unstable to se…
Browse files Browse the repository at this point in the history
…ndAccessibilityEvent

Summary:
Changelog:
[Internal] Rename AccessibilityInfo.sendAccessibilityEvent_unstable to sendAccessibilityEvent

In Fabric, we want people to use `AccessibilityInfo.sendAccessibilityEvent` instead of `UIManager.sendAccessibilityEvent` for Android. The API is not unstable. There is a test in [AccessibilityExample.js](https://github.com/facebook/react-native/blob/c940eb0c49518b82a3999dcac3027aa70018c763/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js#L959) in RNTester to confirm that it works.

A search for [`AccessibilityInfo.sendAccessibilityEvent_unstable` in Github](https://github.com/search?q=AccessibilityInfo.sendAccessibilityEvent_unstable&type=Code) shows that it's not being used yet, which makes sense because it's an Fabric API. Therefore it's safe to rename it.

Reviewed By: sammy-SC

Differential Revision: D37901006

fbshipit-source-id: 73f35b09ca8f9337f4d66a431f0a3f815da38249
  • Loading branch information
p-sun authored and facebook-github-bot committed Jul 18, 2022
1 parent 663dd91 commit 639daf8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const AccessibilityInfo = {
/**
* Send a named accessibility event to a HostComponent.
*/
sendAccessibilityEvent_unstable(
sendAccessibilityEvent(
handle: ElementRef<HostComponent<mixed>>,
eventType: AccessibilityEventTypes,
) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactNative/BridgelessUIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ module.exports = {
errorMessageForMethod('setLayoutAnimationEnabledExperimental'),
);
},
// Please use AccessibilityInfo.sendAccessibilityEvent_unstable instead.
// Please use AccessibilityInfo.sendAccessibilityEvent instead.
// See SetAccessibilityFocusExample in AccessibilityExample.js for a migration example.
sendAccessibilityEvent: (reactTag: ?number, eventType: number): void =>
console.error(errorMessageForMethod('sendAccessibilityEvent')),
Expand Down
2 changes: 1 addition & 1 deletion jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jest
isScreenReaderEnabled: jest.fn(() => Promise.resolve(false)),
removeEventListener: jest.fn(),
setAccessibilityFocus: jest.fn(),
sendAccessibilityEvent_unstable: jest.fn(),
sendAccessibilityEvent: jest.fn(),
getRecommendedTimeoutMillis: jest.fn(),
},
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ function SetAccessibilityFocusExample(props: {}): React.Node {

const onPress = () => {
if (myRef && myRef.current) {
AccessibilityInfo.sendAccessibilityEvent_unstable(myRef.current, 'focus');
AccessibilityInfo.sendAccessibilityEvent(myRef.current, 'focus');
}
};

Expand Down

0 comments on commit 639daf8

Please sign in to comment.