You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
React 19 introduced full support for React Suspense, [`React.use()`](https://react.dev/reference/react/use), and other async rendering features to React Native [0.78.0](https://github.com/facebook/react-native/releases/tag/v0.78.0). These new capabilities enable more sophisticated async patterns in your React Native apps, but they also require updates to your testing approach.
3
+
React 19 introduced full support for React Suspense, [`React.use()`](https://react.dev/reference/react/use), and other async rendering features to React Native [0.78.0](https://github.com/facebook/react-native/releases/tag/v0.78.0).
4
4
5
-
## Why New Testing APIs Are Needed
5
+
When testing components that use these features, React requires the [`async act`](https://react.dev/reference/react/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.
6
6
7
-
React 19's async rendering features (like Suspense and `React.use()`) make React's rendering process inherently asynchronous. When testing components that use these features, React requires the [`async act`](https://react.dev/reference/react/act) helper to properly handle async state updates.
8
-
9
-
This need for async handling led to the creation of new async versions of RNTL's core APIs. These async APIs work with both React 18 and React 19, making them forward-compatible choices for your test suite.
10
-
11
-
## New Async APIs in RNTL 13.3
7
+
## New async APIs
12
8
13
9
RNTL 13.3 introduces async versions of the core testing APIs to handle React 19's async rendering:
14
10
15
11
**Rendering APIs:**
16
-
-**[`renderAsync`](docs/api/render#render-async)** - async version of [`render`](docs/api/render)
17
-
-**[`screen.rerenderAsync`](docs/api/screen#rerender-async)** - async version of [`screen.rerender`](docs/api/screen#rerender)
18
-
-**[`screen.unmountAsync`](docs/api/screen#unmount-async)** - async version of [`screen.unmount`](docs/api/screen#unmount)
12
+
-**[`renderAsync`](docs/api/render#render-async)** - async version of `render`
13
+
-**[`screen.rerenderAsync`](docs/api/screen#rerender-async)** - async version of `screen.rerender`
14
+
-**[`screen.unmountAsync`](docs/api/screen#unmount-async)** - async version of `screen.unmount`
19
15
20
16
**Event APIs:**
21
-
-**[`fireEventAsync`](docs/api/fire-event#fire-event-async)** - async version of [`fireEvent`](docs/api/fire-event#fire-event)
17
+
-**[`fireEventAsync`](docs/api/fire-event#fire-event-async)** - async version of `fireEvent`
22
18
23
-
## APIs That Remain Unchanged
19
+
## APIs that remain unchanged
24
20
25
21
Many existing APIs continue to work without modification:
26
22
27
-
-**Query methods** - `screen.getBy*`, `screen.queryBy*`, `screen.findBy*` all work the same
28
-
-**[`userEvent`](docs/api/user-event)** - already async, so no API changes needed
29
-
-**Jest matchers** - work with already-rendered output, so no changes required
23
+
-**[Query methods](docs/api/queries)**: `screen.getBy*`, `screen.queryBy*`, `screen.findBy*` - all work the same
24
+
-**[User Event API](docs/api/events/user-event)** - already async, so no API changes needed
25
+
-**[Jest matchers](docs/api/jest-matchers)** - work with already-rendered output, so no changes required
30
26
31
-
## What Changes in Your Tests
27
+
## What changes in your tests
32
28
33
-
### Making Tests Async
29
+
### Making tests async
34
30
35
31
The main change is using [`renderAsync`](docs/api/render#renderasync) instead of `render`, which requires:
0 commit comments