Commit 21c71fd
authored
fix(android): animation freezes when file has ViewModels but no artboard default (#196)
Fixes #189.
In Auto dataBind mode, Android passed `autoBind=true` to `setRiveFile`
whenever `viewModelCount > 0`. If the artboard had no default ViewModel
assigned, the Rive SDK threw `"No default ViewModel found for
artboard"`, freezing the animation.
Fix: always pass `autoBind=false` for Auto mode and let
`bindToStateMachine` handle binding — it already catches
`ViewModelException` gracefully when no default ViewModel exists.
> **Note on the error log:** The artboard name in the error (`"iPhone 16
Pro - 3"`) is just how Rive names artboards in responsive layout files —
it's not iOS code. The bug is Android-only.
<details>
<summary>Reproducer</summary>
`.riv` file:
https://rive.app/community/files/27026-50856-no-default-vm-for-artboard/
```tsx
import { RiveView, useRiveFile } from '@rive-app/react-native';
export default function Reproducer() {
const { riveFile } = useRiveFile(require('./nodefaultbouncing.riv'));
return riveFile ? (
<RiveView
file={riveFile}
autoPlay={true}
// No dataBind prop — defaults to Auto. On Android (unfixed) this
// triggers "No default ViewModel found for artboard" and freezes.
style={{ flex: 1 }}
/>
) : null;
}
```
**Expected:** animation plays normally on both platforms.
**Actual (Android, unfixed):** animation freezes,
`ViewModelInstanceNotFound` error fired via `onError`.
</details>1 parent bad9c60 commit 21c71fd
File tree
3 files changed
+80
-1
lines changed- android/src/main/java/com/rive
- example
- __tests__
- assets/rive
3 files changed
+80
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
264 | 268 | | |
265 | 269 | | |
266 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
Binary file not shown.
0 commit comments