Skip to content

Commit 75e1f06

Browse files
ya-nshmeta-codesync[bot]
authored andcommitted
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: #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
1 parent 949b804 commit 75e1f06

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

packages/react-native/Libraries/Components/View/ViewAccessibility.d.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export interface AccessibilityValue {
188188
export type AccessibilityRole =
189189
| 'none'
190190
| 'button'
191+
| 'dropdownlist'
191192
| 'togglebutton'
192193
| 'link'
193194
| 'search'
@@ -215,7 +216,16 @@ export type AccessibilityRole =
215216
| 'tablist'
216217
| 'timer'
217218
| 'list'
218-
| 'toolbar';
219+
| 'toolbar'
220+
| 'grid'
221+
| 'pager'
222+
| 'scrollview'
223+
| 'horizontalscrollview'
224+
| 'viewgroup'
225+
| 'webview'
226+
| 'drawerlayout'
227+
| 'slidingdrawer'
228+
| 'iconmenu';
219229

220230
export interface AccessibilityPropsAndroid {
221231
/**

packages/react-native/types/__typetests__/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,8 @@ export class TouchableOpacityTest extends React.Component {
543543
accessibilityLabelledBy="my-label-text"
544544
aria-labelledby="my-label-text"
545545
/>
546+
<TouchableOpacity accessibilityRole="grid" />
547+
<TouchableOpacity accessibilityRole="pager" />
546548
<TouchableOpacity
547549
// @ts-expect-error - expected boolean value
548550
focusable={1}

0 commit comments

Comments
 (0)