Skip to content

Commit

Permalink
Changed prop name "currentViewStates" to "accessibilityStates" in js …
Browse files Browse the repository at this point in the history
…(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
  • Loading branch information
Ziqi Chen authored and facebook-github-bot committed Jul 19, 2018
1 parent 709e3bc commit 03036f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Libraries/Components/View/ViewAccessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export type AccessibilityRole =
| 'header'
| 'summary';

export type CurrentViewState = 'selected' | 'disabled';
export type AccessibilityState = 'selected' | 'disabled';

export type CurrentViewStates =
| CurrentViewState
| $ReadOnlyArray<CurrentViewState>;
export type AccessibilityStates =
| AccessibilityState
| $ReadOnlyArray<AccessibilityState>;

module.exports = {
AccessibilityTraits: [
Expand Down Expand Up @@ -97,5 +97,5 @@ module.exports = {
'header',
'summary',
],
CurrentViewStates: ['selected', 'disabled'],
AccessibilityStates: ['selected', 'disabled'],
};
8 changes: 4 additions & 4 deletions Libraries/Components/View/ViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ const {
AccessibilityComponentTypes,
AccessibilityTraits,
AccessibilityRoles,
CurrentViewStates,
AccessibilityStates,
} = require('ViewAccessibility');

import type {
AccessibilityComponentType,
AccessibilityTrait,
AccessibilityRole,
CurrentViewState,
AccessibilityState,
} from 'ViewAccessibility';
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
import type {TVViewProps} from 'TVViewPropTypes';
Expand Down Expand Up @@ -94,7 +94,7 @@ export type ViewProps = $ReadOnly<{|
accessibilityIgnoresInvertColors?: boolean,
accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
accessibilityRole?: AccessibilityRole,
currentViewStates?: Array<CurrentViewState>,
accessibilityStates?: Array<AccessibilityState>,
accessibilityViewIsModal?: boolean,
accessibilityElementsHidden?: boolean,
children?: ?React.Node,
Expand Down Expand Up @@ -153,7 +153,7 @@ module.exports = {
/**
* Indicates to accessibility services that UI Component is in a specific State.
*/
currentViewStates: PropTypes.arrayOf(PropTypes.oneOf(CurrentViewStates)),
accessibilityStates: PropTypes.arrayOf(PropTypes.oneOf(AccessibilityStates)),
/**
* Indicates to accessibility services whether the user should be notified
* when this view changes. Works for Android API >= 19 only.
Expand Down

0 comments on commit 03036f7

Please sign in to comment.