Skip to content

Commit 139559f

Browse files
Haseeb Saeedfacebook-github-bot
Haseeb Saeed
authored andcommitted
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
1 parent 7062e5b commit 139559f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.facebook.react.bridge.ReadableArray;
1414
import com.facebook.react.uimanager.annotations.ReactProp;
1515
import com.facebook.react.uimanager.util.ReactFindViewUtil;
16+
import java.util.Locale;
1617

1718
/**
1819
* Base class that should be suitable for the majority of subclasses of {@link ViewManager}.
@@ -131,7 +132,7 @@ public void setAccessibilityRole(T view, String accessibilityRole) {
131132
return;
132133
}
133134
try {
134-
AccessibilityDelegateUtil.AccessibilityRole.valueOf(accessibilityRole.toUpperCase());
135+
AccessibilityDelegateUtil.AccessibilityRole.valueOf(accessibilityRole.toUpperCase(Locale.US));
135136
} catch (NullPointerException e) {
136137
throw new IllegalArgumentException("Invalid Role " + accessibilityRole + " Passed In");
137138
} catch (IllegalArgumentException e) {

0 commit comments

Comments
 (0)