Return NONE accessibility role if null is passed. (#38613)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Riccardo Cipolleschi
2023-07-26 00:49:08 -07:00
committed by Facebook GitHub Bot
parent c1eec4cc51
commit 0f48e86fed
@@ -295,6 +295,10 @@ public class ReactAccessibilityDelegate extends ExploreByTouchHelper {
}
public static AccessibilityRole fromValue(@Nullable String value) {
if (value == null) {
return NONE;
}
for (AccessibilityRole role : AccessibilityRole.values()) {
if (role.name().equalsIgnoreCase(value)) {
return role;