Skip to content

Commit

Permalink
fix: allow pass-through of accessibilityRole prop on Button.tsx (#4092)
Browse files Browse the repository at this point in the history
  • Loading branch information
meatnordrink committed Jan 8, 2024
1 parent 4d57fe2 commit 220ae16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion scripts/typescript-output-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const output = path.join(root, 'lib', 'typescript');
const unusedViewProps = [
'nativeID',
'accessibilityActions',
'accessibilityRole',
'accessibilityValue',
'onAccessibilityAction',
'accessibilityLabelledBy',
Expand Down
8 changes: 7 additions & 1 deletion src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import {
AccessibilityRole,
Animated,
ColorValue,
GestureResponderEvent,
Expand Down Expand Up @@ -90,6 +91,10 @@ export type Props = $Omit<React.ComponentProps<typeof Surface>, 'mode'> & {
* Accessibility hint for the button. This is read by the screen reader when the user taps the button.
*/
accessibilityHint?: string;
/**
* Accessibility role for the button. The "button" role is set by default.
*/
accessibilityRole?: AccessibilityRole;
/**
* Function to execute on press.
*/
Expand Down Expand Up @@ -165,6 +170,7 @@ const Button = (
children,
accessibilityLabel,
accessibilityHint,
accessibilityRole = 'button',
onPress,
onPressIn,
onPressOut,
Expand Down Expand Up @@ -326,7 +332,7 @@ const Button = (
delayLongPress={delayLongPress}
accessibilityLabel={accessibilityLabel}
accessibilityHint={accessibilityHint}
accessibilityRole="button"
accessibilityRole={accessibilityRole}
accessibilityState={{ disabled }}
accessible={accessible}
disabled={disabled}
Expand Down

0 comments on commit 220ae16

Please sign in to comment.