react-native-testing

Guide deterministic React Native component tests with RNTL queries and async patterns.

Updated Jan 8, 2026
One-click install
npx skills add https://github.com/soham2008xyz/trade-tycoon --skill react-native-testing-soham2008xyz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-native-testing
Source: https://github.com/soham2008xyz/trade-tycoon/tree/main/.agents/skills/react-native-testing
Command: npx skills add https://github.com/soham2008xyz/trade-tycoon --skill react-native-testing-soham2008xyz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill reduces flaky, slow, and hard-to-debug React Native component tests by standardizing how you query the UI, trigger interactions, and wait for async updates across RNTL versions.

Core Features & Use Cases

  • Version-aware RNTL guidance (v13 vs v14): Choose the correct render and event semantics depending on your installed @testing-library/react-native version.
  • Query strategy that matches accessibility: Use getByRole (and related queries) with clear priority rules to target the right UI element.
  • Interaction and async patterns: Prefer userEvent (async) over fireEvent, and use findBy* / correct waitFor rules to avoid race conditions.
  • Assertion best practices with RNTL matchers: Use recommended Jest matchers like visibility, enabled/disabled, text content, and accessibility name instead of brittle prop checks.
  • Anti-pattern guardrails: Avoid side effects in waitFor, unnecessary act(), destructuring render queries, manual cleanup, legacy accessibility props, and removed APIs in v14.

Quick Start

Use the react-native-testing skill to write tests for a React Native component by ensuring your queries use screen with getByRole and your assertions use RNTL matchers while awaiting async interactions appropriately.

Frequently Asked Questions about react-native-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix flaky React Native component tests using React Native Testing Library?

Fix flaky React Native component tests by standardizing screen-based queries, preferring async userEvent over fireEvent, and applying correct waitFor rules to avoid race conditions. This approach ensures deterministic UI interactions and stable async waiting across RNTL versions.

What is the correct query priority for React Native Testing Library components?

The correct query priority for React Native Testing Library components uses getByRole and related accessibility queries first. This strategy targets the right UI elements reliably, avoiding brittle prop checks and ensuring components are tested as users perceive them.

Should I use userEvent or fireEvent for React Native component interactions?

You should use async userEvent over fireEvent for React Native component interactions. userEvent provides more realistic interaction simulation and works with findBy* and correct waitFor rules to prevent race conditions during async render and event testing.

Does React Native Testing Library v14 change async render and event behavior?

Yes, React Native Testing Library v14 enforces version-specific async render and event rules. You must apply version-aware guidance to choose correct render semantics, query priority, and avoid removed APIs and legacy accessibility props when upgrading.

What are common waitFor anti-patterns in Jest React Native testing?

Common waitFor anti-patterns in Jest React Native testing include causing side effects inside waitFor, unnecessary act() wrapping, and destructuring render queries. Avoid these alongside manual cleanup and legacy accessibility props to maintain fast, reliable tests.