Skip to content

Commit

Permalink
Return NONE accessibility role if null is passed. (facebook#38613)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#38613

The `value` string of the ReactAccessibilityDelegate's `fromValue` method is marked as `Nullable`, however the `null` case is not handled.

This change handle the `null` case setting the accesssibility role to NONE.

## Changelog:
[Android][Fixed] - Set the accessibility role to `NONE` when a `null` string is passed to `fromValue`

Reviewed By: cortinico

Differential Revision: D47752098

fbshipit-source-id: e8a44bdd8874e996d8127cb2ee29e5135210b196
  • Loading branch information
cipolleschi authored and billnbell3 committed Jul 29, 2023
1 parent ab0ce82 commit c42b84c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ public static String getValue(AccessibilityRole role) {
}

public static AccessibilityRole fromValue(@Nullable String value) {
if (value == null) {
return NONE;
}

for (AccessibilityRole role : AccessibilityRole.values()) {
if (role.name().equalsIgnoreCase(value)) {
return role;
Expand Down

0 comments on commit c42b84c

Please sign in to comment.