Skip to content

Commit 2469f1e

Browse files
committed
feat: add accessibilityLabel to DrawerItem
1 parent 87f15b5 commit 2469f1e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/Drawer/DrawerItem.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ type Props = {
2424
* Function to execute on press.
2525
*/
2626
onPress?: () => void;
27+
/**
28+
* Accessibility label for the button. This is read by the screen reader when the user taps the button.
29+
*/
30+
accessibilityLabel?: string;
2731
style?: StyleProp<ViewStyle>;
2832
/**
2933
* @optional
@@ -50,7 +54,7 @@ class DrawerItem extends React.Component<Props> {
5054
static displayName = 'Drawer.Item';
5155

5256
render() {
53-
const { icon, label, active, theme, style, onPress, ...rest } = this.props;
57+
const { icon, label, active, theme, style, onPress, accessibilityLabel, ...rest } = this.props;
5458
const { colors, roundness } = theme;
5559
const backgroundColor = active
5660
? color(colors.primary)
@@ -85,6 +89,7 @@ class DrawerItem extends React.Component<Props> {
8589
accessibilityComponentType="button"
8690
accessibilityRole="button"
8791
accessibilityStates={active ? ['selected'] : []}
92+
accessibilityLabel={accessibilityLabel}
8893
>
8994
<View style={styles.wrapper}>
9095
{icon ? (

0 commit comments

Comments
 (0)