Skip to content

Commit

Permalink
Fix accessibility role crash
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Haseeb Saeed authored and facebook-github-bot committed Aug 20, 2018
1 parent 7062e5b commit 139559f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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}.
Expand Down Expand Up @@ -131,7 +132,7 @@ public void setAccessibilityRole(T view, String accessibilityRole) {
return;
}
try {
AccessibilityDelegateUtil.AccessibilityRole.valueOf(accessibilityRole.toUpperCase());
AccessibilityDelegateUtil.AccessibilityRole.valueOf(accessibilityRole.toUpperCase(Locale.US));

This comment has been minimized.

Copy link
@vovkasm

vovkasm Aug 20, 2018

Contributor

Hmm... may be somewhere in project other calls similar to this... (

} catch (NullPointerException e) {
throw new IllegalArgumentException("Invalid Role " + accessibilityRole + " Passed In");
} catch (IllegalArgumentException e) {
Expand Down

0 comments on commit 139559f

Please sign in to comment.