Bug: Native crash on mount when using dataBind with ViewModel state machine value-change actions
Description
Binding a ViewModel instance to RiveView via dataBind causes a native crash on mount whenever the loaded .riv file contains state machine ViewModel value-change actions.
The crash happens during file initialization regardless of whether those actions are reachable from the initial state, and cannot be caught by a React error boundary.
Provide a repro
Minimal code reproduction
function RivePreview() {
const { riveFile } =
useRiveFile(require('./vm_value_change_test.riv'));
const [instance, setInstance] = useState(null);
useEffect(() => {
if (!riveFile) return;
let cancelled = false;
(async () => {
const vm = await riveFile.viewModelByNameAsync("TextModel");
const inst = await vm?.createDefaultInstanceAsync();
if (!cancelled) setInstance(inst ?? null);
})();
return () => {
cancelled = true;
};
}, [riveFile]);
if (!riveFile || !instance) return null;
// Crashes on mount if .riv contains state machine ViewModel value-change actions
return <RiveView file={riveFile} dataBind={instance} />;
}
Steps to reproduce
- Load a
.riv file whose state machine contains ViewModel value-change actions.
- Create a ViewModel instance via the async API and pass it via
dataBind.
- Native crash occurs during mount. No JS exception is thrown.
Expected behavior
When a ViewModel instance is bound via dataBind, state machine ViewModel value-change actions should apply to the bound instance without causing a native crash.
Actual behavior
- App crashes natively during mount
- No JavaScript error is thrown
- React ErrorBoundary does not catch the crash
Things confirmed NOT to prevent the crash
autoPlay={false}
- Moving the action to a state disconnected from the initial state
- Using async API (
viewModelByNameAsync / createDefaultInstanceAsync) instead of useViewModelInstance
- Wrapping in a React ErrorBoundary
- Not calling any JS-side setters
Removing the ViewModel value-change actions from the state machine in the Rive editor eliminates the crash entirely.
Source .riv / .rev files
A ZIP containing both the runtime .riv and the editor .rev file will be attached.
vm_value_change_test.zip
Device & versions
- Device: iPhone 13 Pro Max (physical device)
- OS: iOS 26.3.1
- React Native: 0.83.6
- Expo: 55.0.17
- @rive-app/react-native: 0.4.6
Additional context
The JavaScript side completes successfully: the .riv file loads, the ViewModel instance is created, and RiveView mounts before the native crash occurs.
Bug: Native crash on mount when using
dataBindwith ViewModel state machine value-change actionsDescription
Binding a ViewModel instance to
RiveViewviadataBindcauses a native crash on mount whenever the loaded.rivfile contains state machine ViewModel value-change actions.The crash happens during file initialization regardless of whether those actions are reachable from the initial state, and cannot be caught by a React error boundary.
Provide a repro
Minimal code reproduction
Steps to reproduce
.rivfile whose state machine contains ViewModel value-change actions.dataBind.Expected behavior
When a ViewModel instance is bound via
dataBind, state machine ViewModel value-change actions should apply to the bound instance without causing a native crash.Actual behavior
Things confirmed NOT to prevent the crash
autoPlay={false}viewModelByNameAsync/createDefaultInstanceAsync) instead ofuseViewModelInstanceRemoving the ViewModel value-change actions from the state machine in the Rive editor eliminates the crash entirely.
Source
.riv/.revfilesA ZIP containing both the runtime
.rivand the editor.revfile will be attached.vm_value_change_test.zip
Device & versions
Additional context
The JavaScript side completes successfully: the
.rivfile loads, the ViewModel instance is created, andRiveViewmounts before the native crash occurs.