Fix announcement issue with Switch (#39298)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39298

Previously, switches were being announced using Talkback in this order: [state][role][label] but they should be announced as [state][label][role].

Reviewed By: NickGerleman

Differential Revision: D48807314

fbshipit-source-id: e827b9ca6d3b61b5bd2884f0f0ce6ddae00bb7df
This commit is contained in:
Carmen Krol
2023-09-05 10:33:01 -07:00
committed by Facebook GitHub Bot
parent a13d463a59
commit 79b293ea33
@@ -630,7 +630,7 @@ public class ReactAccessibilityDelegate extends ExploreByTouchHelper {
info.setCheckable(true);
info.setChecked(boolValue);
if (info.getClassName().equals(AccessibilityRole.getValue(AccessibilityRole.SWITCH))) {
info.setText(
info.setStateDescription(
context.getString(
boolValue ? R.string.state_on_description : R.string.state_off_description));
}