Make AccessibilityInfo.setAccessibilityFocus cross platform#20229
Make AccessibilityInfo.setAccessibilityFocus cross platform#20229draperunner wants to merge 2 commits intofacebook:masterfrom
Conversation
|
Thank you for this PR @draperunner. Thank you! |
| * See http://facebook.github.io/react-native/docs/accessibilityinfo.html#setaccessibilityfocus | ||
| */ | ||
| setAccessibilityFocus: function(reactTag: number): void { | ||
| UIManager.sendAccessibilityEvent(reactTag, 8); |
There was a problem hiding this comment.
Instead of set the value 8 here, you should export a new constant in UIManagerModuleConstants.AccessibilityEventTypes:
see:
and then use that new constant from here
facebook-github-bot
left a comment
There was a problem hiding this comment.
@mdvacca has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
mdvacca
left a comment
There was a problem hiding this comment.
Great, thanks! I'm importing it.
|
Awesome, thanks! Here is the documentation PR: facebook/react-native-website#461 |
|
This pull request was closed by @draperunner in be715ec. Once this commit is added to a release, you will see the corresponding version tag below the description at be715ec. If the commit has a single |
Currently,
AccessibilityInfo.setAccessibilityFocusis only available on iOS. The same behaviour can be achieved on Android by dispatching the proper accessibility event. I implemented the same function for Android, to make life slightly more convenient for the developer.Today, developers must write something like this:
With this change, the following is enough for both Android and iOS:
Test Plan:
I made the same change in the
react-nativepackage in my project's node_modules, and checked that it worked on an Android device with TalkBack activated.Release Notes:
[ANDROID] [ENHANCEMENT] [AccessibilityInfo] - Implement AccessibilityInfo.setAccessibilityFocus for Android