Permalink
Browse files

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
  • Loading branch information...
ziqichen6 authored and facebook-github-bot committed Jul 19, 2018
1 parent 709e3bc commit 03036f79f7b062ae11015b33cca3dd7e4e67dda6
Showing with 9 additions and 9 deletions.
  1. +5 −5 Libraries/Components/View/ViewAccessibility.js
  2. +4 −4 Libraries/Components/View/ViewPropTypes.js
@@ -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: [
@@ -97,5 +97,5 @@ module.exports = {
'header',
'summary',
],
CurrentViewStates: ['selected', 'disabled'],
AccessibilityStates: ['selected', 'disabled'],
};
@@ -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';
@@ -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,
@@ -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.

0 comments on commit 03036f7

Please sign in to comment.