Skip to content

Commit 03036f7

Browse files
Ziqi Chenfacebook-github-bot
authored andcommitted
Changed prop name "currentViewStates" to "accessibilityStates" in js (1/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. Also, 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. Changes in this Diff: Changed the prop name `currentViewStates` to `accessibilityStates` in js files Reviewed By: PeteTheHeat Differential Revision: D8896223 fbshipit-source-id: dfdb48dce69303a347dfccd194af2fef9beb776c
1 parent 709e3bc commit 03036f7

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Libraries/Components/View/ViewAccessibility.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ export type AccessibilityRole =
5252
| 'header'
5353
| 'summary';
5454

55-
export type CurrentViewState = 'selected' | 'disabled';
55+
export type AccessibilityState = 'selected' | 'disabled';
5656

57-
export type CurrentViewStates =
58-
| CurrentViewState
59-
| $ReadOnlyArray<CurrentViewState>;
57+
export type AccessibilityStates =
58+
| AccessibilityState
59+
| $ReadOnlyArray<AccessibilityState>;
6060

6161
module.exports = {
6262
AccessibilityTraits: [
@@ -97,5 +97,5 @@ module.exports = {
9797
'header',
9898
'summary',
9999
],
100-
CurrentViewStates: ['selected', 'disabled'],
100+
AccessibilityStates: ['selected', 'disabled'],
101101
};

Libraries/Components/View/ViewPropTypes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ const {
2121
AccessibilityComponentTypes,
2222
AccessibilityTraits,
2323
AccessibilityRoles,
24-
CurrentViewStates,
24+
AccessibilityStates,
2525
} = require('ViewAccessibility');
2626

2727
import type {
2828
AccessibilityComponentType,
2929
AccessibilityTrait,
3030
AccessibilityRole,
31-
CurrentViewState,
31+
AccessibilityState,
3232
} from 'ViewAccessibility';
3333
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
3434
import type {TVViewProps} from 'TVViewPropTypes';
@@ -94,7 +94,7 @@ export type ViewProps = $ReadOnly<{|
9494
accessibilityIgnoresInvertColors?: boolean,
9595
accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
9696
accessibilityRole?: AccessibilityRole,
97-
currentViewStates?: Array<CurrentViewState>,
97+
accessibilityStates?: Array<AccessibilityState>,
9898
accessibilityViewIsModal?: boolean,
9999
accessibilityElementsHidden?: boolean,
100100
children?: ?React.Node,
@@ -153,7 +153,7 @@ module.exports = {
153153
/**
154154
* Indicates to accessibility services that UI Component is in a specific State.
155155
*/
156-
currentViewStates: PropTypes.arrayOf(PropTypes.oneOf(CurrentViewStates)),
156+
accessibilityStates: PropTypes.arrayOf(PropTypes.oneOf(AccessibilityStates)),
157157
/**
158158
* Indicates to accessibility services whether the user should be notified
159159
* when this view changes. Works for Android API >= 19 only.

0 commit comments

Comments
 (0)