React 19 introduced full support for React Suspense, React.use()
, and other async rendering features to React Native 0.78.0.
When testing components that use these features, React requires the async act
helper to handle async state updates. This means React Native Testing Library needs new async versions of its core APIs. These async APIs work with both React 18 and React 19.
RNTL 13.3 introduces async versions of the core testing APIs to handle React 19's async rendering:
Rendering APIs:
renderAsync
- async version of render
screen.rerenderAsync
- async version of screen.rerender
screen.unmountAsync
- async version of screen.unmount
Event APIs:
fireEventAsync
- async version of fireEvent
Many existing APIs continue to work without modification:
screen.getBy*
, screen.queryBy*
, screen.findBy*
- all work the sameThe main change is using renderAsync
instead of render
, which requires:
async
await
before renderAsync
Use the async APIs when your components:
React.use()
for reading promises or contextact()
handlingUse the async-ready APIs (renderAsync
, User Event, Jest Matchers, etc.) from the start. They work with both React 18 and React 19.
You can migrate gradually:
render
, etc.)React.use()
must use async APIsAsync APIs will become the default recommendation as React 19 adoption grows. Starting with them now saves migration effort later.