mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix accessibilityRole value lookup
Summary: Accessibility roles are enums that are looked up by matching a string accessibility role from JS to the enum's name using .toUpperCase(). .toUpperCase() causes issues in certain languages such as Turkish because the "i"s translate to "?". D9402330 tried to address this by forcing the .toUpperCase to use Locale.US, but now it sometimes translates to "?" Use .equalsIgnoreCase() instead to avoid translations. Reviewed By: mdvacca, mmmulani Differential Revision: D9497494 fbshipit-source-id: 0f8b7f2071b08ccb86655fee7bfd2d009ddde8eb
This commit is contained in:
1 parent
47dc31d464
commit
1f96ff62cf
4 files changed
+61
-25
No files matched your search
@@ -11,6 +11,7 @@ import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
import com.facebook.react.R;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.uimanager.AccessibilityDelegateUtil.AccessibilityRole;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.util.ReactFindViewUtil;
|
||||
import java.util.Locale;
|
||||
@@ -131,14 +132,8 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
if (accessibilityRole == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
AccessibilityDelegateUtil.AccessibilityRole.valueOf(accessibilityRole.toUpperCase(Locale.US));
|
||||
} catch (NullPointerException e) {
|
||||
throw new IllegalArgumentException("Invalid Role " + accessibilityRole + " Passed In");
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IllegalArgumentException("Invalid Role " + accessibilityRole + " Passed In");
|
||||
}
|
||||
view.setTag(R.id.accessibility_role, accessibilityRole);
|
||||
|
||||
view.setTag(R.id.accessibility_role, AccessibilityRole.fromValue(accessibilityRole));
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_ACCESSIBILITY_STATES)
|
||||
|
||||
Reference in new issue
Block a user