From b417e6fb7ccdae5f2a34ac28802442b8630c2f2c Mon Sep 17 00:00:00 2001 From: jiangpeng Date: Sun, 14 Oct 2018 21:17:31 +0800 Subject: [PATCH] fix 0.57.3 use button is error! this issues(java.lang.String cannot be cast to com.facebook.react.uimanager.AccessibilityDelegateUtil$AccessibilityRole - on 0.57.3 #21754) --- .../react/uimanager/AccessibilityDelegateUtil.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/AccessibilityDelegateUtil.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/AccessibilityDelegateUtil.java index 617773b24eb0fc..20aa3780c7a932 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/AccessibilityDelegateUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/AccessibilityDelegateUtil.java @@ -86,7 +86,12 @@ private AccessibilityDelegateUtil() { public static void setDelegate(final View view) { final String accessibilityHint = (String) view.getTag(R.id.accessibility_hint); - final AccessibilityRole accessibilityRole = (AccessibilityRole) view.getTag(R.id.accessibility_role); + AccessibilityRole ar = null; + Object tag = view.getTag(R.id.accessibility_role); + if(tag != null){ + ar = AccessibilityRole.fromValue(tag.toString()); + } + final AccessibilityRole accessibilityRole = ar; // if a view already has an accessibility delegate, replacing it could cause problems, // so leave it alone. if (!ViewCompat.hasAccessibilityDelegate(view) &&