Skip to content

data binding not trigger state machine until press artboard #348

@CacaoRick

Description

@CacaoRick

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

.riv
.rev

Image Image Image

Expected behavior

When the useRiveBoolean set function is called, the view model property changes and triggers the condition timeline to animate.

Screen record

Image
https://youtu.be/SWtxUgL3QRI

  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();
        }} />

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions