Skip to content

Commit

Permalink
Return NONE accessibility role if null is passed. (#38613)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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: e32eb5620dc097a8ba6eda2539ce3e97e39bb373
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Jul 25, 2023
1 parent e64756a commit 9ad1bc7
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 9ad1bc7

Please sign in to comment.