Mobile and desktop apps · Skill
Check React Native components with RNTL
test-react-native-components
Writes a React Native component check with React Native Testing Library, picking v13 or v14 from package.json and querying by role. Use when the user wants an RNTL component check, getByRole, or userEvent.
Works with: Any AI Not yet model-tested; testing Jan 2027
Paste it into ChatGPT, Claude, Gemini or any AI chat, then tell it about your project. How it works
Install in Claude Code, Cursor or Codex (optional)
Only for AI coding tools that read skill folders. Run one line in a terminal, in your project folder. It downloads this skill's text files from TheSkillVault and nothing else; you can read them first with “View raw SKILL.md”.
Claude Code (all your projects)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/test-react-native-components/raw' -o ~/'.claude/skills/test-react-native-components/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/test-react-native-components/files/LICENSE.txt' -o ~/'.claude/skills/test-react-native-components/LICENSE.txt'Cursor (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/test-react-native-components/raw' -o '.cursor/skills/test-react-native-components/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/test-react-native-components/files/LICENSE.txt' -o '.cursor/skills/test-react-native-components/LICENSE.txt'Codex and other Agent Skills tools (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/test-react-native-components/raw' -o '.agents/skills/test-react-native-components/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/test-react-native-components/files/LICENSE.txt' -o '.agents/skills/test-react-native-components/LICENSE.txt'
Or connect the whole library over MCP
Add TheSkillVault to Cursor or add this to your app's MCP settings (read-only; help):
{
"mcpServers": {
"theskillvault": {
"url": "https://theskillvault.ai/mcp"
}
}
}React Native Testing Library renders a component and queries it the way a person would, by role and name. Match the major version in package.json. v13 and v14 do not behave the same.
When to use
- A React Native component needs a render-and-query check.
- The file imports
@testing-library/react-native. - A press or a text change should go through userEvent.
When not to use
- The need is a release-to-release diff. That is a separate skill.
- The need is a CI artifact. That is a separate skill.
- The need is a web page check in a browser. That is a separate skill.
- The project does not use this library.
Steps
- Read the
@testing-library/react-nativeversion. v14 is async render on React 19 and later. v13 is sync render on React 18. Do not mix their habits. - Query from
screen. Do not destructure queries offrender. - Prefer
getByRolewith a name. UsequeryByonly to assert absence. UsefindBywhen the element appears later. Do not pairwaitForwithgetByfor that case. - Prefer
userEventfor presses. It is async. UsefireEventonly when userEvent has no equivalent. - Keep side effects outside
waitFor. Do not pass an empty callback. The library already wrapsrenderand the event helpers, so do not add another wrapper. - This library did not run a component check, a simulator, or a device.
Gotchas
- Do not include passwords, tokens, or private text in sample components.
- A
Viewis not an accessibility element until it is marked accessible.Text,TextInput, andSwitchalready are. Prefer role and aria-label over older accessibility props. - Training memory of this library is often stale. Trust the version in package.json, and do not guess a prop type from memory.
- This is an independent how-to adapted from a Callstack and Rally Health skill. It is not official Testing Library documentation, and no check was run for this library.
Portability
If you use the web testing library, the same role-first query order still holds. If you use a bare assertion helper without this library, this skill does not cover that file. v13 and v14 stay different even inside React Native.
Done when
- The skill followed v13 or v14 as package.json says.
- Queries go through
screen, withgetByRolefirst. - Presses go through
userEventunless it cannot express the event.
Example prompt
"Write an RNTL check for this React Native button. Use getByRole, userEvent, and the v14 async render if package.json says v14."
---
Adapted from "react-native-testing" by Callstack and Rally Health in callstack/react-native-testing-library (MIT, Copyright (c) 2018 Callstack and Rally Health). See LICENSE.txt.
Bundled files
Licence
Adapted from Callstack and Rally Health (callstack/react-native-testing-library, react-native-testing) (Copyright (c) 2018 Callstack and Rally Health), MIT License. Adapted by TheSkillVault: rewritten as a short RNTL pass (v13 vs v14, role queries, userEvent, findBy); dropped the matcher tables and version reference files. Independent how-to, not official Testing Library documentation. No component check was run for this library.
Licence: MIT License. Attribution when you reuse it: Based on work by Callstack and Rally Health (callstack/react-native-testing-library, react-native-testing) (Copyright (c) 2018 Callstack and Rally Health, MIT License), https://github.com/callstack/react-native-testing-library/tree/0ecb9c9c0cef163e01abdeae1b4b7c82af40d0b1/skills/react-native-testing; adapted by TheSkillVault, https://theskillvault.ai