Changed prop name "currentViewStates" to "accessibilityStates" in Android (2/3)

Summary:
Context:
After discussing with @[1038750002:yungsters], `currentViewStates` is a very ambiguous name for a prop, especially because there are only two possible values. From a developer's perspective, it makes more sense to just call them `accessibilityStates` because the main use for them is to add states to Talkback and Voiceover.
Defense for changing name in Android: The actual implementation of what we're changing under the hood in Native Code is abstracted away from developers using React Native, so as long as behavior is as they would expect, it makes more sense to change the name into a clear one regardless of how it is implemented.

Changes:
changed the Prop name from `currentViewStates` to `accessibilityStates` in the BaseViewManager file where the view property is being exposed.

Reviewed By: PeteTheHeat

Differential Revision: D8896389

fbshipit-source-id: 35dcd9239fae016b790e528947994681684bd654
This commit is contained in:
Ziqi Chen 2018-07-19 13:47:41 -07:00 committed by Facebook Github Bot
parent 03036f79f7
commit 3bedc78a35
1 changed files with 5 additions and 5 deletions

View File

@ -30,7 +30,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
private static final String PROP_ACCESSIBILITY_COMPONENT_TYPE = "accessibilityComponentType";
private static final String PROP_ACCESSIBILITY_LIVE_REGION = "accessibilityLiveRegion";
private static final String PROP_ACCESSIBILITY_ROLE = "accessibilityRole";
private static final String PROP_CURRENT_VIEW_STATES = "currentViewStates";
private static final String PROP_ACCESSIBILITY_STATES = "accessibilityStates";
private static final String PROP_IMPORTANT_FOR_ACCESSIBILITY = "importantForAccessibility";
// DEPRECATED
@ -124,12 +124,12 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
AccessibilityRoleUtil.updateAccessibilityRole(view, accessibilityRole);
}
@ReactProp(name = PROP_CURRENT_VIEW_STATES)
public void setViewStates(T view, ReadableArray currentViewStates) {
@ReactProp(name = PROP_ACCESSIBILITY_STATES)
public void setViewStates(T view, ReadableArray accessibilityStates) {
view.setSelected(false);
view.setEnabled(true);
for (int i = 0; i < currentViewStates.size(); i++) {
String state = currentViewStates.getString(i);
for (int i = 0; i < accessibilityStates.size(); i++) {
String state = accessibilityStates.getString(i);
if (state.equals("selected")) {
view.setSelected(true);
} else if (state.equals("disabled")) {