Repository navigation
fix(ios): bind the view model at state machine creation, including DataBindMode.Auto - #420
Merged
mfazekas merged 3 commits intoOct 13, 2026
Conversation
kirgy
marked this pull request as ready for review
October 13, 2026 13:33
mfazekas
force-pushed
the
fix/ios-bind-vmi-at-state-machine-creation
branch
from
October 13, 2026 18:57
a3983ca to
d901c06
Compare
mfazekas
approved these changes
Oct 13, 2026
mfazekas
left a comment
Collaborator
There was a problem hiding this comment.
Verified on the iOS simulator: explicit instance, Auto and byName now all bind before the state machine is created, so scripts see the right instance. Rebased onto main and dropped #415's now-redundant explicit-instance block so it compiles, and added Auto and byName cases to the script data-binding harness test.
mfazekas
enabled auto-merge (squash)
October 13, 2026 19:08
Scripts run init during state machine creation and cache context:viewModel(). The new iOS backend created the state machine unbound and attached the instance afterwards through Rive(dataBind:), so scripted artboards read and wrote the authored default instance instead of the one the app binds (rive-app#414). Resolve the instance first (auto, by name or explicit) and pass it to createStateMachine(binding:). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mfazekas
force-pushed
the
fix/ios-bind-vmi-at-state-machine-creation
branch
from
October 13, 2026 19:36
d901c06 to
8a6016d
Compare
mfazekas
pushed a commit
that referenced
this pull request
Oct 13, 2026
🤖 I have created a release *beep* *boop* --- ## [0.5.5](v0.5.4...v0.5.5) (2026-10-13) ### Bug Fixes * don't call into a disposed list property when useRiveList unmounts ([#408](#408)) ([bfa7aab](bfa7aab)), closes [#407](#407) * **ios:** bind the view model at state machine creation, including DataBindMode.Auto ([#420](#420)) ([d606620](d606620)) * **ios:** bind the view model instance when creating the state machine ([#415](#415)) ([d49a09a](d49a09a)), closes [#414](#414) * **ios:** bump rive-ios to 6.28.1 ([#422](#422)) ([628e5d5](628e5d5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Collaborator
|
Thanks Kirgy! Shipped in v0.5.5. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The follow is an AI assisted summary of this change. TLDR;
Complements #415: also binds the instance at state-machine creation for
DataBindMode.Auto, which #415 leaves to #403.On the new iOS backend, artboards that use scripts read and write the wrong view model instance. The state machine is created unbound and the instance is attached afterwards, but scripts run
init(and cachecontext:viewModel()) during state machine creation. This is upstream #414..auto→ the artboard's default instance,.byName, or an explicit.instancecreateStateMachine(name, binding:)and buildRivewith that same instanceReproduction
We reproduced this with a company private Rive asset. We're happy to pass this over privately to support you with this. I've given the
.rivand.revfiles via our support Slack.Repro page against a scripted production asset (ZOE's home progress bar,
progress_bar.riv), kept inexample/src/reproducers/local/because the asset is proprietary. The bar's scripts readstartValue/newValue/trackWidthand writerenderedPercent/_fillWidth/barTransitionState. iOS 26.5 simulator, Release build.renderedPercentafternewValue = 5.8+playtrackWidth(script-computed)newValue = 100, instance bound before mountbarState = defaultbarState = complete(green, crown celebration)The stalled fill was rive-ios 6.28.0, fixed in 6.28.1
With this binding fix on RiveRuntime 6.28.0, firing
playon a running state machine left the scripted fill stuck (barTransitionState = increasing,renderedPercentfrozen). To rule out this wrapper, I ran the same sequence against RiveRuntime directly in a native Swift harness on the simulator, with no React Native involved, and headlessly on the web runtime (@rive-app/canvas2.39):playon a running state machine, instance bound at creation6.28.1's notes include "Fixed asynchronous image decodes not completing and animations stopping while script work was still pending". With this branch plus RiveRuntime 6.28.1 (via
RIVE_RUNTIME_IOS_VERSION=6.28.1and a local podspec), the RN repro behaves correctly in the app's real order (auto-bind, read the instance off the view ref, thenplay): 5.8 settles with the track meeting the end cap, 30 animates and settles, and 100 reaches thecompletestate.So the full fix needs both:
runtimeVersions.ioscan't be bumped yet.One behaviour change to flag upstream: on 6.28.1, a trigger fired on the instance before the state machine exists (bound at creation) no longer applies. The fill sits at its minimum, where on 6.28.0 it jumped straight to the target. Natively the same thing happens, so it's a runtime change, not this wrapper.