mirror of
https://github.com/status-im/react-native.git
synced 2025-02-27 00:20:31 +00:00
Added in Prop for CurrentViewState
Summary: Added in a prop for CurrentViewState that is used to set the state of the current view for both accessibility and regular view settings.. Ex: AccessibilityRole = "button" CurrentViewState = ['selected'] This will trigger talk back/voiceover to announce both the role and the state. Unlike Accessibility Role, Accessibility States can take on more than one form, and are passed in an array. Ex: AccessibilityState = ['selected', 'disabled'] Currently, two options are available: selected and disabled Reviewed By: PeteTheHeat Differential Revision: D8837848 fbshipit-source-id: ca30c950a2aa713813be8577ea4fa9ba9bfc698a
This commit is contained in:
parent
d9eeae91a0
commit
3cfa7ae698
@ -50,6 +50,12 @@ export type AccessibilityRole =
|
|||||||
| 'adjustable'
|
| 'adjustable'
|
||||||
| 'imagebutton';
|
| 'imagebutton';
|
||||||
|
|
||||||
|
export type CurrentViewState = 'selected' | 'disabled';
|
||||||
|
|
||||||
|
export type CurrentViewStates =
|
||||||
|
| CurrentViewState
|
||||||
|
| $ReadOnlyArray<CurrentViewState>;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
AccessibilityTraits: [
|
AccessibilityTraits: [
|
||||||
'none',
|
'none',
|
||||||
@ -87,4 +93,5 @@ module.exports = {
|
|||||||
'adjustable',
|
'adjustable',
|
||||||
'imagebutton',
|
'imagebutton',
|
||||||
],
|
],
|
||||||
|
CurrentViewStates: ['selected', 'disabled'],
|
||||||
};
|
};
|
||||||
|
@ -21,12 +21,14 @@ const {
|
|||||||
AccessibilityComponentTypes,
|
AccessibilityComponentTypes,
|
||||||
AccessibilityTraits,
|
AccessibilityTraits,
|
||||||
AccessibilityRoles,
|
AccessibilityRoles,
|
||||||
|
CurrentViewStates,
|
||||||
} = require('ViewAccessibility');
|
} = require('ViewAccessibility');
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
AccessibilityComponentType,
|
AccessibilityComponentType,
|
||||||
AccessibilityTrait,
|
AccessibilityTrait,
|
||||||
AccessibilityRole,
|
AccessibilityRole,
|
||||||
|
CurrentViewState,
|
||||||
} from 'ViewAccessibility';
|
} from 'ViewAccessibility';
|
||||||
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
|
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
|
||||||
import type {TVViewProps} from 'TVViewPropTypes';
|
import type {TVViewProps} from 'TVViewPropTypes';
|
||||||
@ -92,6 +94,7 @@ export type ViewProps = $ReadOnly<{|
|
|||||||
accessibilityIgnoresInvertColors?: boolean,
|
accessibilityIgnoresInvertColors?: boolean,
|
||||||
accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
|
accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
|
||||||
accessibilityRole?: AccessibilityRole,
|
accessibilityRole?: AccessibilityRole,
|
||||||
|
currentViewStates?: Array<CurrentViewState>,
|
||||||
accessibilityViewIsModal?: boolean,
|
accessibilityViewIsModal?: boolean,
|
||||||
accessibilityElementsHidden?: boolean,
|
accessibilityElementsHidden?: boolean,
|
||||||
children?: ?React.Node,
|
children?: ?React.Node,
|
||||||
@ -144,10 +147,13 @@ module.exports = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates to accessibility services to treat UI component like a
|
* Indicates to accessibility services to treat UI component like a
|
||||||
* native one. Merging accessibilityComponentType and accessibilityTraits.
|
|
||||||
*/
|
*/
|
||||||
accessibilityRole: PropTypes.oneOf(AccessibilityRoles),
|
accessibilityRole: PropTypes.oneOf(AccessibilityRoles),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates to accessibility services that UI Component is in a specific State.
|
||||||
|
*/
|
||||||
|
currentViewStates: PropTypes.arrayOf(PropTypes.oneOf(CurrentViewStates)),
|
||||||
/**
|
/**
|
||||||
* Indicates to accessibility services whether the user should be notified
|
* Indicates to accessibility services whether the user should be notified
|
||||||
* when this view changes. Works for Android API >= 19 only.
|
* when this view changes. Works for Android API >= 19 only.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user