mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
fix: align AccessibilityRole TypeScript definitions (#56863)
Summary: - Align `ViewAccessibility.d.ts`'s `AccessibilityRole` union with the roles already supported by the Flow type and generated API snapshot. - Add TypeScript type coverage for `grid` and `pager`, which are among the roles missing from this declaration. ## Changelog: [General] [Fixed] - Align TypeScript accessibility role definitions with supported React Native accessibility roles Pull Request resolved: https://github.com/facebook/react-native/pull/56863 Test Plan: - `npx prettier --check packages/react-native/Libraries/Components/View/ViewAccessibility.d.ts packages/react-native/types/__typetests__/index.tsx` - `npm run test-typescript -- --pretty false` - `npm run test-generated-typescript -- --pretty false` Reviewed By: huntie Differential Revision: D105592939 Pulled By: Abbondanzo fbshipit-source-id: 9b88c22091dc4051cc1c1c45a7424f078bc4dc54
This commit is contained in:
1 parent
949b8049df
commit
75e1f06b66
2 files changed
+13
-1
No files matched your search
@@ -188,6 +188,7 @@ export interface AccessibilityValue {
|
||||
export type AccessibilityRole =
|
||||
| 'none'
|
||||
| 'button'
|
||||
| 'dropdownlist'
|
||||
| 'togglebutton'
|
||||
| 'link'
|
||||
| 'search'
|
||||
@@ -215,7 +216,16 @@ export type AccessibilityRole =
|
||||
| 'tablist'
|
||||
| 'timer'
|
||||
| 'list'
|
||||
| 'toolbar';
|
||||
| 'toolbar'
|
||||
| 'grid'
|
||||
| 'pager'
|
||||
| 'scrollview'
|
||||
| 'horizontalscrollview'
|
||||
| 'viewgroup'
|
||||
| 'webview'
|
||||
| 'drawerlayout'
|
||||
| 'slidingdrawer'
|
||||
| 'iconmenu';
|
||||
|
||||
export interface AccessibilityPropsAndroid {
|
||||
/**
|
||||
|
||||
@@ -543,6 +543,8 @@ export class TouchableOpacityTest extends React.Component {
|
||||
accessibilityLabelledBy="my-label-text"
|
||||
aria-labelledby="my-label-text"
|
||||
/>
|
||||
<TouchableOpacity accessibilityRole="grid" />
|
||||
<TouchableOpacity accessibilityRole="pager" />
|
||||
<TouchableOpacity
|
||||
// @ts-expect-error - expected boolean value
|
||||
focusable={1}
|
||||
|
||||
Reference in new issue
Block a user