mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Reset the contentDescription when accessibility text is empty to revoke stale state
Summary: This diff fixes accessibility value setter in BaseViewManager.java when the accessibility value is null. This is needed when we reset the value and would like to make sure the content description reflects the expected state, instead of the stale state when the value is set last time. Changelog: [Android][Fixed] - Reset accessibility value when it gets a null value Reviewed By: NickGerleman Differential Revision: D42160904 fbshipit-source-id: a8115a268461c8340d38350ab6fd3f21e4b14959
This commit is contained in:
1 parent
ac5cf32915
commit
aacf28778e
1 file changed
+7
-6
@@ -366,12 +366,13 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
@ReactProp(name = ViewProps.ACCESSIBILITY_VALUE)
|
||||
public void setAccessibilityValue(T view, ReadableMap accessibilityValue) {
|
||||
if (accessibilityValue == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
view.setTag(R.id.accessibility_value, accessibilityValue);
|
||||
if (accessibilityValue.hasKey("text")) {
|
||||
updateViewContentDescription(view);
|
||||
view.setTag(R.id.accessibility_value, null);
|
||||
view.setContentDescription(null);
|
||||
} else {
|
||||
view.setTag(R.id.accessibility_value, accessibilityValue);
|
||||
if (accessibilityValue.hasKey("text")) {
|
||||
updateViewContentDescription(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user