Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3bedc78

Browse files
Ziqi Chenfacebook-github-bot
Ziqi Chen
authored andcommittedJul 19, 2018
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
1 parent 03036f7 commit 3bedc78

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
3030
private static final String PROP_ACCESSIBILITY_COMPONENT_TYPE = "accessibilityComponentType";
3131
private static final String PROP_ACCESSIBILITY_LIVE_REGION = "accessibilityLiveRegion";
3232
private static final String PROP_ACCESSIBILITY_ROLE = "accessibilityRole";
33-
private static final String PROP_CURRENT_VIEW_STATES = "currentViewStates";
33+
private static final String PROP_ACCESSIBILITY_STATES = "accessibilityStates";
3434
private static final String PROP_IMPORTANT_FOR_ACCESSIBILITY = "importantForAccessibility";
3535

3636
// DEPRECATED
@@ -124,12 +124,12 @@ public void setAccessibilityRole(T view, String accessibilityRole) {
124124
AccessibilityRoleUtil.updateAccessibilityRole(view, accessibilityRole);
125125
}
126126

127-
@ReactProp(name = PROP_CURRENT_VIEW_STATES)
128-
public void setViewStates(T view, ReadableArray currentViewStates) {
127+
@ReactProp(name = PROP_ACCESSIBILITY_STATES)
128+
public void setViewStates(T view, ReadableArray accessibilityStates) {
129129
view.setSelected(false);
130130
view.setEnabled(true);
131-
for (int i = 0; i < currentViewStates.size(); i++) {
132-
String state = currentViewStates.getString(i);
131+
for (int i = 0; i < accessibilityStates.size(); i++) {
132+
String state = accessibilityStates.getString(i);
133133
if (state.equals("selected")) {
134134
view.setSelected(true);
135135
} else if (state.equals("disabled")) {

0 commit comments

Comments
 (0)
Please sign in to comment.