How to select an element by accessibility role and label in React Native Testing Library

Viewed 494

I have multiple buttons on my screen with different accessibilityLabel.

<Button accessibilityLabel="First label">First</Button>
<Button accessibilityLabel="Second label">Second</Button>

Querying with getByRole ignores the second argument specifying the accessibility label (which works ok in non-native Testing Library).

getByRole('button', { name: 'First label' })

How can I query an element by both a role and a label?

0 Answers
Related