Skip to content

feat: add data binding lists support#71

Merged
mfazekas merged 10 commits into
mainfrom
mfazekas/data-binding-lists
Dec 15, 2025
Merged

feat: add data binding lists support#71
mfazekas merged 10 commits into
mainfrom
mfazekas/data-binding-lists

Conversation

@mfazekas
Copy link
Copy Markdown
Collaborator

@mfazekas mfazekas commented Dec 9, 2025

Summary

Adds ViewModelListProperty for dynamic list management at runtime, aligned with rive-react API.

API

  • length - get list size
  • getInstanceAt(index) - get ViewModelInstance at index
  • addInstance(instance) - add to end of list
  • addInstanceAt(instance, index) - insert at position
  • removeInstance(instance) - remove by reference
  • removeInstanceAt(index) - remove at index
  • swap(index1, index2) - swap items
  • addListener(callback) - observe changes

Example

const listProperty = instance.listProperty('items');

// Add new item
const newItem = viewModel.createInstance();
listProperty.addInstance(newItem);

// Remove item
listProperty.removeInstanceAt(0);

// Swap items
listProperty.swap(0, 1);

Test plan

  • Added example page with list.riv test file
  • iOS implementation
  • Android implementation

Closes #11

@mfazekas mfazekas force-pushed the mfazekas/data-binding-lists branch 5 times, most recently from 6712d5b to 1eb2f26 Compare December 9, 2025 11:48
@mfazekas mfazekas marked this pull request as ready for review December 9, 2025 12:06
Comment thread src/specs/ViewModel.nitro.ts
HayesGordon
HayesGordon previously approved these changes Dec 11, 2025
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! Just need to decide if these methods names will be most familiar for RN

@HayesGordon
Copy link
Copy Markdown
Contributor

Oh and all of the abstraction and Nitro is really paying off here 🙌 . This is really minimal code for a large feature.

@mfazekas mfazekas force-pushed the mfazekas/data-binding-lists branch from b10e49c to adbaae6 Compare December 12, 2025 20:13
@mfazekas mfazekas enabled auto-merge (squash) December 15, 2025 14:05
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 b790796 into main Dec 15, 2025
7 checks passed
@mfazekas mfazekas deleted the mfazekas/data-binding-lists branch December 15, 2025 15:35
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.

Add data binding lists support

2 participants