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
Copy file name to clipboardExpand all lines: runtimes/react-native/migration-guide.mdx
+89-39Lines changed: 89 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,91 @@ title: "Migration Guide"
3
3
description: "Learn how to migrate your React Native app when upgrading between major versions of the Rive React Native runtime, including breaking changes and new features."
4
4
---
5
5
6
+
## Migrating to `v0.4.0`+
7
+
8
+
This release improves error transparency and loading semantics for hooks, preparing for the async experimental runtime.
The `error` field is now an `Error` object instead of a `string`, and `riveFile` is `undefined` while loading (was `null`). `isLoading` is kept for convenience.
`useRiveNumber`, `useRiveString`, `useRiveBoolean`, `useRiveColor`, and `useRiveEnum` no longer read `property.value` synchronously on mount. The value starts as `undefined` and arrives via the property listener.
69
+
70
+
```tsx
71
+
const { value: health } =useRiveNumber('health', instance);
72
+
73
+
// health is undefined on the first render — guard before using it
|`{error}` (in JSX, from `useRiveFile`) |`{error?.message}`|
86
+
|`riveFile === null` (loading check) |`riveFile === undefined` or use `isLoading`|
87
+
|`health` available synchronously on first render | Guard for `undefined`: `health !== undefined ? ... : ...`|
88
+
89
+
---
90
+
6
91
## Migrating to the Async API (`v0.3.2`+)
7
92
8
93
This release introduces an **async-first API** to prepare for the new experimental Rive runtime. Synchronous methods that block the JS thread are deprecated and replaced with async equivalents. State machine input and text run methods are deprecated in favor of [data binding](/runtimes/data-binding) and will be removed entirely in the experimental runtime (and therefore in upcoming `@rive-app/react-native` versions).
@@ -12,7 +97,6 @@ This release introduces an **async-first API** to prepare for the new experiment
12
97
-**Async methods** replace all synchronous ViewModel and property accessors
13
98
-**Name-based access** replaces count/index-based ViewModel and artboard lookups
14
99
-**`getValueAsync()` / `set()`** replace `property.value` for reading and writing properties
15
-
-**`useRiveNumber` and similar hooks** now start as `undefined` until the first listener emission
16
100
-**State machine inputs, text runs, and events** are deprecated and will be removed in the experimental runtime — use [data binding](/runtimes/data-binding) instead
17
101
18
102
### Migration Steps
@@ -139,49 +223,15 @@ This release introduces an **async-first API** to prepare for the new experiment
139
223
</Tab>
140
224
</Tabs>
141
225
142
-
#### 7. Hook Value Guarding
143
-
144
-
Property hooks (`useRiveNumber`, `useRiveString`, `useRiveBoolean`, `useRiveColor`, `useRiveEnum`) now return `undefined` as their initial value until the first listener emission.
0 commit comments