Skip to content

fix(android): pass autoBind to SDK when dataBind is set (#156)#157

Open
mfazekas wants to merge 2 commits intomainfrom
fix/156-autobind-approach
Open

fix(android): pass autoBind to SDK when dataBind is set (#156)#157
mfazekas wants to merge 2 commits intomainfrom
fix/156-autobind-approach

Conversation

@mfazekas
Copy link
Collaborator

@mfazekas mfazekas commented Feb 25, 2026

PR #140 correctly removed the play() that was called even if autoplay was false, but it caused binding to break, as state machines were not initialised in rive-android. This PR implements a better workaround by passing autoBind=true to rive-android, to make sure a stateMahcines is valid. The only downside is that it set's up view model instance that we might override during configuration a bit later.

Fixes: #156

Before After
Android image image
Reproducer (not committed)

Place in example/src/reproducers/Issue156.tsx — uses quick_start.riv, sets health=25 via onInit with autoPlay={false}. Three modes: playIfNeeded() (bug path), play() (workaround), and tap graphic (user interaction). Health bar at ~25% = binding applied (PASS), ~100% = NOT applied (FAIL).

Closes #156

@mfazekas mfazekas force-pushed the fix/156-autobind-approach branch 3 times, most recently from d8963f0 to 0468d6a Compare February 25, 2026 13:58
@mfazekas mfazekas marked this pull request as ready for review February 25, 2026 14:23
HayesGordon
HayesGordon previously approved these changes Feb 25, 2026
Copy link
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 force-pushed the fix/156-autobind-approach branch 3 times, most recently from 657f76b to 849095a Compare February 25, 2026 19:20
@mfazekas mfazekas enabled auto-merge (squash) February 26, 2026 06:20
@mfazekas mfazekas force-pushed the fix/156-autobind-approach branch from 849095a to 1fcf9b4 Compare February 26, 2026 11:20
@mfazekas mfazekas requested a review from HayesGordon February 26, 2026 14:19
Verifies VMI is bound to state machine without calling play().
Also adds EventTarget polyfill for chai 6.x in Hermes.
With autoPlay={false}, the SDK doesn't create state machines until
play(). Pass autoBind=true so they're created eagerly, removing
the need for _pendingBindData deferral.
@mfazekas mfazekas force-pushed the fix/156-autobind-approach branch from 1fcf9b4 to d865bca Compare February 27, 2026 15:01
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: with autoPlay={false}, manual start + trigger can produce wrong initial data-bound state and missing events

2 participants