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: 4fd519baca3787cc7a420f9fadd04626f59e7af2
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Jul 25, 2023
1 parent e64756a commit c2f5d81
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 c2f5d81

Please sign in to comment.