Write and review React Native component tests using Testing Library v13 and v14.
Works with
Covers render patterns, screen queries (getBy/getAllBy/queryBy/findBy variants), Jest matchers, userEvent interactions, fireEvent, and async patterns with version-specific behavior
Automatically detects your project's RNTL version (v13 for React 18, v14 for React 19+) and applies correct API signatures and sync/async rules
Provides query priority guidance (getByRole first), interaction best practices (us
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionreact-native-testingExecute the skills CLI command in your project's root directory to begin installation:
Fetches react-native-testing from callstack/react-native-testing-library and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate react-native-testing. Access via /react-native-testing in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
1
total installs
1
this week
3.4K
GitHub stars
0
upvotes
Run in your terminal
1
installs
1
this week
3.4K
stars
IMPORTANT: Your training data about @testing-library/react-native may be outdated or incorrect — API signatures, sync/async behavior, and available functions differ between v13 and v14. Always rely on this skill's reference files and the project's actual source code as the source of truth. Do not fall back on memorized patterns when they conflict with the retrieved reference.
Check @testing-library/react-native version in the user's package.json:
test-renderer)react-test-renderer)Use the version-specific reference for render patterns, fireEvent sync/async behavior, screen API, configuration, and dependencies.
Use in this order: getByRole > getByLabelText > getByPlaceholderText > getByText > getByDisplayValue > getByTestId (last resort).
| Variant | Use case | Returns | Async |
|---|---|---|---|
getBy* |
Element must exist | element instance (throws) | No |
getAllBy* |
Multiple must exist | element instance[] (throws) | No |
queryBy* |
Check non-existence ONLY | element instance | null | No |
queryAllBy* |
Count elements | element instance[] | No |
findBy* |
Wait for element | Promise<element instance> |
Yes |
findAllBy* |
Wait for multiple | Promise<element instance[]> |
Yes |
Prefer userEvent over fireEvent. userEvent is always async.
const user = userEvent.setup();
await user.press(element); // full press sequence
await user.longPress(element, { duration: 800 }); // long press
await user.type(textInput, 'Hello'); // char-by-char typing
await user.clear(textInput); // clear TextInput
await user.paste(textInput, 'pasted text'); // paste into TextInput
await user.scrollTo(scrollView, { y: 100 }); // scroll
fireEvent — use only when userEvent doesn't support the event. See version-specific reference for sync/async behavior:
fireEvent.press(element);
fireEvent.changeText(textInput, 'new text');
fireEvent(element, 'blur');
Available automatically with any @testing-library/react-native import.
| Matcher | Use for |
|---|---|
toBeOnTheScreen() |
Element exists in tree |
toBeVisible() |
Element visible (not hidden/display:none) |
toBeEnabled() / toBeDisabled() |
Disabled state via aria-disabled |
toBeChecked() / toBePartiallyChecked() |
Checked state |
toBeSelected() |
Selected state |
toBeExpanded() / toBeCollapsed() |
Expanded state |
toBeBusy() |
Busy state |
toHaveTextContent(text) |
Text content match |
toHaveDisplayValue(value) |
TextInput display value |
toHaveAccessibleName(name) |
Accessible name |
toHaveAccessibilityValue(val) |
Accessibility value |
toHaveStyle(style) |
Style match |
toHaveProp(name, value?) |
Prop check (last resort) |
toContainElement(el) |
Contains child element |
toBeEmptyElement() |
No children |
screen for queries, not destructuring from render()getByRole first with { name: '...' } optionqueryBy* ONLY for .not.toBeOnTheScreen() checksfindBy* for async elements, NOT waitFor + getBy*waitFor (no fireEvent/userEvent inside)waitForwaitForact() - render, fireEvent, userEvent handle itcleanup() - automatic after each testrole, aria-label, aria-disabled) over legacy accessibility* props*ByRole Quick ReferenceCommon roles: button, text, heading (alias: header), searchbox, switch, checkbox, radio, img, link, alert, menu, menuitem, tab, tablist, progressbar, slider, spinbutton, timer, toolbar.
getByRole options: { name, disabled, selected, checked, busy, expanded, value: { min, max, now, text } }.
For *ByRole to match, the element must be an accessibility element:
Text, TextInput, Switch are by defaultView needs accessible={true} (or use Pressable/TouchableOpacity)// Correct: action first, then wait for result
fireEvent.press(button);
await waitFor(() => {
expect(screen.getByText('Result')).toBeOnTheScreen();
});
// Better: use findBy* instead
fireEvent.press(button);
expect(await screen.findByText('Result')).toBeOnTheScreen();
Options: waitFor(cb, { timeout: 1000, interval: 50 }). Works with Jest fake timers automatically.
Recommended with userEvent (press/longPress involve real durations):
jest.useFakeTimers();
test('with fake timers', async () => {
const user = userEvent.setup();
render(<Component />);
await user.press(screen.getByRole('button'));
// ...
});
Wrap providers using wrapper option:
function renderWithProviders(ui: React.ReactElement) {
return render(ui, {
wrapper: ({ children }) => (
<ThemeProvider>
<AuthProvider>{children}</AuthProvider>
</ThemeProvider>
),
});
}
Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
asyrafhussin/agent-skills
anthropics/claude-code
mblode/agent-skills
github/awesome-copilot
sickn33/antigravity-awesome-skills
leonxlnx/taste-skill
react-native-testing is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
react-native-testing fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
Registry listing for react-native-testing matched our evaluation — installs cleanly and behaves as described in the markdown.
We added react-native-testing from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
Solid pick for teams standardizing on skills: react-native-testing is focused, and the summary matches what you get after install.
react-native-testing reduced setup friction for our internal harness; good balance of opinion and flexibility.
Keeps context tight: react-native-testing is the kind of skill you can hand to a new teammate without a long onboarding doc.
I recommend react-native-testing for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
react-native-testing is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Solid pick for teams standardizing on skills: react-native-testing is focused, and the summary matches what you get after install.
showing 1-10 of 55