Fix accessibility role crash
Summary: We were using a locale-specific `toUpperCase()` for accessibility roles. In the Turkish locale, `"image".toUpperCase()` does not become `"IMAGE"`; it becomes some weird turkish alphabet word, and we throw an error. This diff uses US-locale to avoid the error. Reviewed By: YaoPersonal Differential Revision: D9402330 fbshipit-source-id: a3fd7c54eec4b313c7e9df9236adb7ae42854ed8
This commit is contained in:
parent
7062e5bdb5
commit
139559fc07
|
@ -13,6 +13,7 @@ import com.facebook.react.R;
|
|||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.util.ReactFindViewUtil;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Base class that should be suitable for the majority of subclasses of {@link ViewManager}.
|
||||
|
@ -131,7 +132,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
|||
return;
|
||||
}
|
||||
try {
|
||||
AccessibilityDelegateUtil.AccessibilityRole.valueOf(accessibilityRole.toUpperCase());
|
||||
AccessibilityDelegateUtil.AccessibilityRole.valueOf(accessibilityRole.toUpperCase(Locale.US));
|
||||
} catch (NullPointerException e) {
|
||||
throw new IllegalArgumentException("Invalid Role " + accessibilityRole + " Passed In");
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
|
Loading…
Reference in New Issue