Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add testID and accessibilityLabel to DrawerItem #11168

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/drawer/src/views/DrawerItem.tsx
Expand Up @@ -81,6 +81,15 @@ type Props = {
* Whether label font should scale to respect Text Size accessibility settings.
*/
allowFontScaling?: boolean;

/**
* Accessibility label for drawer item.
*/
accessibilityLabel?: string;
/**
* ID to locate this drawer item in tests.
*/
testID?: string;
};

const LinkPressable = ({
Expand Down Expand Up @@ -160,6 +169,8 @@ export default function DrawerItem(props: Props) {
onPress,
pressColor,
pressOpacity,
testID,
accessibilityLabel,
...rest
} = props;

Expand All @@ -178,8 +189,10 @@ export default function DrawerItem(props: Props) {
style={[styles.container, { borderRadius, backgroundColor }, style]}
>
<LinkPressable
testID={testID}
onPress={onPress}
style={[styles.wrapper, { borderRadius }]}
accessibilityLabel={accessibilityLabel}
accessibilityRole="button"
accessibilityState={{ selected: focused }}
pressColor={pressColor}
Expand Down