mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[react-native] update/add new accessibility properties (#36636)
* add new accessibilitystate and role values * add accessibleState property * Update ver to 0.60, use @depreacted in comments
This commit is contained in:
parent
29ca96dcfe
commit
3c784e7f76
63
types/react-native/index.d.ts
vendored
63
types/react-native/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for react-native 0.57
|
||||
// Type definitions for react-native 0.60
|
||||
// Project: https://github.com/facebook/react-native
|
||||
// Definitions by: Eloy Durán <https://github.com/alloy>
|
||||
// HuHuanming <https://github.com/huhuanming>
|
||||
@ -2033,16 +2033,52 @@ export interface AccessibilityProps extends AccessibilityPropsAndroid, Accessibi
|
||||
accessibilityRole?: AccessibilityRole;
|
||||
/**
|
||||
* Accessibility State tells a person using either VoiceOver on iOS or TalkBack on Android the state of the element currently focused on.
|
||||
* @deprecated: accessibilityState available in 0.60+
|
||||
*/
|
||||
accessibilityStates?: AccessibilityState[];
|
||||
|
||||
accessibilityStates?: AccessibilityStates[];
|
||||
/**
|
||||
* Accessibility State tells a person using either VoiceOver on iOS or TalkBack on Android the state of the element currently focused on.
|
||||
*/
|
||||
accessibilityState?: AccessibilityState;
|
||||
/**
|
||||
* An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not obvious from the accessibility label.
|
||||
*/
|
||||
accessibilityHint?: string;
|
||||
}
|
||||
|
||||
export type AccessibilityState = "selected" | "disabled";
|
||||
// @deprecated: use AccessibilityState available in 0.60+
|
||||
export type AccessibilityStates =
|
||||
| "disabled"
|
||||
| "selected"
|
||||
| "checked"
|
||||
| "unchecked"
|
||||
| "busy"
|
||||
| "expanded"
|
||||
| "collapsed"
|
||||
| "hasPopup";
|
||||
|
||||
export interface AccessibilityState {
|
||||
/**
|
||||
* When true, informs accessible tools if the element is disabled
|
||||
*/
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* When true, informs accessible tools if the element is selected
|
||||
*/
|
||||
selected?: boolean;
|
||||
/**
|
||||
* For items like Checkboxes and Toggle switches, reports their state to accessible tools
|
||||
*/
|
||||
checked?: boolean | "mixed";
|
||||
/**
|
||||
* When present, informs accessible tools if the element is busy
|
||||
*/
|
||||
busy?: boolean;
|
||||
/**
|
||||
* When present, informs accessible tools the element is expanded or collapsed
|
||||
*/
|
||||
expanded?: boolean;
|
||||
}
|
||||
|
||||
export type AccessibilityRole =
|
||||
| "none"
|
||||
@ -2053,9 +2089,26 @@ export type AccessibilityRole =
|
||||
| "keyboardkey"
|
||||
| "text"
|
||||
| "adjustable"
|
||||
| "imagebutton"
|
||||
| "header"
|
||||
| "summary"
|
||||
| "imagebutton";
|
||||
| "alert"
|
||||
| "checkbox"
|
||||
| "combobox"
|
||||
| "menu"
|
||||
| "menubar"
|
||||
| "menuitem"
|
||||
| "progressbar"
|
||||
| "radio"
|
||||
| "radiogroup"
|
||||
| "scrollbar"
|
||||
| "spinbutton"
|
||||
| "switch"
|
||||
| "tab"
|
||||
| "tablist"
|
||||
| "timer"
|
||||
| "toolbar";
|
||||
|
||||
|
||||
export interface AccessibilityPropsAndroid {
|
||||
/**
|
||||
|
||||
@ -778,6 +778,7 @@ class AccessibilityTest extends React.Component {
|
||||
onAccessibilityTap={() => {}}
|
||||
accessibilityRole="header"
|
||||
accessibilityStates={["selected"]}
|
||||
accessibilityState={{checked: true}}
|
||||
accessibilityHint="Very importent header"
|
||||
>
|
||||
<Text accessibilityTraits={["key", "text"]} accessibilityIgnoresInvertColors>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user