Skip to content

fix(android): animation freezes when file has ViewModels but no artboard default#196

Merged
mfazekas merged 3 commits intomainfrom
fix/android-auto-databind-no-default-viewmodel-v2
Mar 26, 2026
Merged

fix(android): animation freezes when file has ViewModels but no artboard default#196
mfazekas merged 3 commits intomainfrom
fix/android-auto-databind-no-default-viewmodel-v2

Conversation

@mfazekas
Copy link
Copy Markdown
Collaborator

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.

Reproducer

.riv file: https://rive.app/community/files/27026-50856-no-default-vm-for-artboard/

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.

@mfazekas mfazekas force-pushed the fix/android-auto-databind-no-default-viewmodel-v2 branch 2 times, most recently from 234ef61 to cf680f2 Compare March 26, 2026 13:19
@mfazekas mfazekas requested a review from HayesGordon March 26, 2026 13:22
@mfazekas mfazekas enabled auto-merge (squash) March 26, 2026 13:23
@mfazekas mfazekas force-pushed the fix/android-auto-databind-no-default-viewmodel-v2 branch from cf680f2 to f53aa05 Compare March 26, 2026 16:03
Copy link
Copy Markdown
Contributor

@HayesGordon HayesGordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mfazekas mfazekas merged commit 21c71fd into main Mar 26, 2026
9 checks passed
@mfazekas mfazekas deleted the fix/android-auto-databind-no-default-viewmodel-v2 branch March 26, 2026 18:14
mfazekas pushed a commit that referenced this pull request Mar 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.3.3](v0.3.2...v0.3.3)
(2026-03-26)


### Features

* bump rive-ios to 6.18.0 and rive-android to 11.3.1
([#193](#193))
([bad9c60](bad9c60))


### Bug Fixes

* **android:** animation freezes when file has ViewModels but no
artboard default
([#196](#196))
([21c71fd](21c71fd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android [RIVE] HybridRiveView afterUpdate No default ViewModel found for artboard error

2 participants