feat: add viewModel and replaceViewModel for nested ViewModel access#96
Merged
Conversation
mfazekas
force-pushed
the
feat/viewmodel-instance-property
branch
from
December 23, 2025 08:39
65196b5 to
474ce91
Compare
mfazekas
force-pushed
the
feat/viewmodel-instance-property
branch
from
January 7, 2026 07:25
474ce91 to
b68b299
Compare
mfazekas
force-pushed
the
feat/viewmodel-instance-property
branch
from
January 7, 2026 08:09
b68b299 to
b3fca2d
Compare
mfazekas
marked this pull request as ready for review
January 7, 2026 08:23
mfazekas
enabled auto-merge (squash)
January 7, 2026 08:25
This was referenced Jan 8, 2026
mfazekas
added a commit
that referenced
this pull request
Jan 8, 2026
## Summary Add missing `import NitroModules` to `HybridViewModelInstance.swift`. This import is required for `RuntimeError` which is used in the `replaceViewModel` method added in #96. ## Note on CI The iOS build in #96 passed because CI may have cached the build or the error only surfaces in clean builds. This fix resolves the build error.
mfazekas
pushed a commit
that referenced
this pull request
Jan 9, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.4](v0.1.3...v0.1.4) (2026-01-09) ### Features * add data binding artboards support ([#95](#95)) ([515070e](515070e)) * add release-please for automated releases ([#109](#109)) ([6403bd4](6403bd4)) * add viewModel and replaceViewModel for nested ViewModel access ([#96](#96)) ([3f61c98](3f61c98)) ### Bug Fixes * read initial value in useRiveProperty hooks ([#97](#97)) ([26223f2](26223f2)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
mfazekas
added a commit
that referenced
this pull request
Jan 12, 2026
## Summary - Add in-app test runner using react-native-harness for assertions - Add Tests page to example app for running tests on device - Initial tests for `viewModel()` and `replaceViewModel()` from #96 ## Test plan - Run example app and navigate to "Tests" page - Tap "Run All Tests" to verify both tests pass <img height="800" alt="image" src="https://github.com/user-attachments/assets/630354c3-1295-49d7-b26b-c9e9d8af469d" />
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.
Summary
Adds two methods to
ViewModelInstancefor accessing and replacing nested ViewModel instances:viewModel(path)- get a nested ViewModelInstance by pathreplaceViewModel(path, instance)- replace a nested instance with anotherAPI naming follows the Web SDK conventions (
@rive-app/canvas).Example
Test file
Includes
viewmodelproperty.riv- a custom test file with nested ViewModels (vm1,vm2) to demonstrate the feature.https://rive.app/community/files/25668-47939-demo-file-for-runtime-replaceviewmodel