diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index 20b6f90fecb2e7..76ec6975c7c150 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -29,15 +29,95 @@ const View: React.AbstractComponent< React.ElementRef, > = React.forwardRef( ( - {tabIndex, focusable, style, pointerEvents, ...otherProps}: ViewProps, + { + tabIndex, + focusable, + role, + accessibilityRole, + pointerEvents, + style, + ...otherProps + }: ViewProps, forwardedRef, ) => { + // Map role values to AccessibilityRole values + const roleToAccessibilityRoleMapping = { + alert: 'alert', + alertdialog: undefined, + application: undefined, + article: undefined, + banner: undefined, + button: 'button', + cell: undefined, + checkbox: 'checkbox', + columnheader: undefined, + combobox: 'combobox', + complementary: undefined, + contentinfo: undefined, + definition: undefined, + dialog: undefined, + directory: undefined, + document: undefined, + feed: undefined, + figure: undefined, + form: undefined, + grid: 'grid', + group: undefined, + heading: 'header', + img: 'image', + link: 'link', + list: 'list', + listitem: undefined, + log: undefined, + main: undefined, + marquee: undefined, + math: undefined, + menu: 'menu', + menubar: 'menubar', + menuitem: 'menuitem', + meter: undefined, + navigation: undefined, + none: 'none', + note: undefined, + presentation: 'none', + progressbar: 'progressbar', + radio: 'radio', + radiogroup: 'radiogroup', + region: undefined, + row: undefined, + rowgroup: undefined, + rowheader: undefined, + scrollbar: 'scrollbar', + searchbox: 'search', + separator: undefined, + slider: 'adjustable', + spinbutton: 'spinbutton', + status: undefined, + summary: 'summary', + switch: 'switch', + tab: 'tab', + table: undefined, + tablist: 'tablist', + tabpanel: undefined, + term: undefined, + timer: 'timer', + toolbar: 'toolbar', + tooltip: undefined, + tree: undefined, + treegrid: undefined, + treeitem: undefined, + }; + const flattendStyle = flattenStyle(style); const newPointerEvents = pointerEvents || flattendStyle?.pointerEvents; + return (