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: e8a44bdd8874e996d8127cb2ee29e5135210b196
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Jul 26, 2023
1 parent c1eec4c commit 0f48e86
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 0f48e86

Please sign in to comment.