Skip to content

Commit

Permalink
Return NONE accessibility role if null is passed.
Browse files Browse the repository at this point in the history
Summary:
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`

Differential Revision: D47752098

fbshipit-source-id: fd76a42493e404fe0b75f064954962635532b6e8
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Jul 25, 2023
1 parent e64756a commit 54a75de
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 54a75de

Please sign in to comment.