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:
Haseeb Saeed 2018-08-20 12:02:18 -07:00 committed by Facebook Github Bot
parent 7062e5bdb5
commit 139559fc07
1 changed files with 2 additions and 1 deletions

View File

@ -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) {