-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Description
Use a data-binding boolean to trigger the state machine timeline.
Android:
After calling the useRiveBoolean set function, the view model property value changes, but the animation doesn't start until the user presses the Rive artboard.
iOS:
The useRiveBoolean set function is called, but the view model property value doesn't change until the user presses the Rive artboard.
Provide a Repro
https://github.com/CacaoRick/rive-click-issue/tree/data-binding
Source .riv/.rev file
Expected behavior
When the useRiveBoolean set function is called, the view model property changes and triggers the condition timeline to animate.
Screen record
const [setRiveRef, riveRef] = useRive();
const [isTrue, setIsTrue] = useRiveBoolean(riveRef, 'is-true');Toggle button call setIsTrue when press, display the isTrue value on the right.
Device & Versions
- Device:
- Android Emulator, Android 15
- iOS simulator, iOS 18.5
- NPM Version: 11.4.2
- React Native: 0.79.4
- expo: 53.0.12
- rive-react-native: 9.3.4
Additional context
The current temporary solution is to call riveRef.play() after setting the view model value each time, which can successfully trigger the timeline animation.
<Button title="Toggle" onPress={() => {
setIsTrue(!isTrue);
riveRef?.play();
}} />