Commit 592b189
feat: add dataBind prop to RiveView (#23)
* feat: add viewModelInstance to ViewProps, so we don't need to wait for ref
* feat: getBoundViewModelInstance
* dataBind 1st gen
* fix: apply data binding changes in-place without reload
- Remove needsReload trigger from dataBind property changes
- Add in-place binding update methods for both platforms
- Fix flicker when switching between binding modes
iOS Changes:
- Add applyDataBinding() method on RiveReactNativeView
- Call applyDataBinding() in didSet instead of needsReload
- Directly call bind/enableAutoBind/disableAutoBind on existing view
Android Changes:
- Add custom setter for dataBind property
- Add configureDataBinding() method
- Directly update viewModelInstance on existing state machine
- Make riveAnimationView internal for access from HybridRiveView
Result:
- Smooth transitions between red/green/blue/none/auto modes
- No visual flicker or reload when switching binding modes
- Better performance (no view recreation)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(ios): bind view model instance to both artboard and state machine
- Add artboard.bind(viewModelInstance:) in addition to stateMachine binding
- Required for visual changes to take effect when switching binding modes
- Matches old rive-react-native implementation pattern
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(ios): play after binding to refresh view
- Add baseViewModel?.play() after binding view model instance
- Forces view to refresh and show the new binding state
- Helps ensure visual updates appear immediately
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(ios): play after none and auto binding modes
- Add baseViewModel?.play() for .none and .auto cases
- Ensures view refreshes when switching to these modes
- All binding modes now trigger play() for consistent behavior
- Fix prettier formatting in example
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(android): bind to artboard and play after binding changes
- Add artboard.viewModelInstance binding in addition to stateMachine
- Add view.play() call after all binding mode changes
- Matches iOS implementation for consistent behavior
- Ensures visual updates appear when switching modes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(android): trigger full reload on binding mode changes
- Remove in-place configureDataBinding() method
- Set needsReload = true and call afterUpdate() when dataBind changes
- Matches old rive-react-native pattern for referencedAssets changes
- Full reload via setRiveFile() with new binding configuration
- iOS keeps play() approach for smoother experience
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(android): remove manual afterUpdate call from dataBind setter
- Remove afterUpdate() call from custom setter
- React Native automatically calls afterUpdate() after all props update
- Prevents potential double-reload issues
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(android): play state machine after binding mode reload
- Add isFirstConfigure flag to track initial load
- Call play(stateMachineName, isStateMachine: true) after reload
- Only play on subsequent reloads, not on first configure
- Ensures state machine restarts with new binding
iOS note: iOS already calls baseViewModel.play() in applyDataBinding()
which handles non-first updates through the didSet mechanism
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(andorid): use ios like implementation
* fix(andorid): use ios like implementation
* removed unused files
* refator: simplify changes
* fix: make dataBind optional and default to auto
* review fixes
* renamed miklos_viewmodel to many_viewmodels
* review fixes
* fix: add logged to android
* fix: dataBindingChanged
* Apply suggestion from @mfazekas
* fix: always apply data binding on initial update
* fix(andorid): always apply data binding on initial update
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a4ed4ec commit 592b189
46 files changed
Lines changed: 1433 additions & 352 deletions
File tree
- android/src/main/java/com
- margelo/nitro/rive
- rive
- example
- assets/rive
- src/pages
- expo-example
- components
- ios
- nitrogen/generated
- android
- c++
- views
- kotlin/com/margelo/nitro/rive
- ios
- c++
- views
- swift
- src
- specs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 74 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
14 | 39 | | |
15 | | - | |
16 | 40 | | |
17 | 41 | | |
18 | 42 | | |
| |||
25 | 49 | | |
26 | 50 | | |
27 | 51 | | |
| 52 | + | |
| 53 | + | |
28 | 54 | | |
29 | 55 | | |
30 | 56 | | |
| |||
41 | 67 | | |
42 | 68 | | |
43 | 69 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 70 | | |
49 | 71 | | |
50 | 72 | | |
| |||
56 | 78 | | |
57 | 79 | | |
58 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
59 | 88 | | |
60 | 89 | | |
61 | 90 | | |
| |||
73 | 102 | | |
74 | 103 | | |
75 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
76 | 110 | | |
77 | 111 | | |
78 | 112 | | |
| |||
109 | 143 | | |
110 | 144 | | |
111 | 145 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
134 | 172 | | |
135 | 173 | | |
136 | 174 | | |
| |||
184 | 222 | | |
185 | 223 | | |
186 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
187 | 234 | | |
188 | 235 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
27 | | - | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | | - | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
37 | | - | |
| 45 | + | |
38 | 46 | | |
39 | 47 | | |
40 | 48 | | |
| |||
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
52 | | - | |
| 60 | + | |
53 | 61 | | |
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
59 | | - | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
| |||
67 | 75 | | |
68 | 76 | | |
69 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
70 | 83 | | |
71 | 84 | | |
72 | 85 | | |
| |||
77 | 90 | | |
78 | 91 | | |
79 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
80 | 145 | | |
81 | 146 | | |
82 | 147 | | |
| |||
Binary file not shown.
0 commit comments