Skip to content

setInputStateAtPath crashes and appears ignoring path on Android #360

@jimpala

Description

@jimpala

Description

I have a .riv file with nested artboards in it. The nested artboards are exported and their inputs exposed, and they're wired up to a state machine, and I'd like to set an input on them.

I'm calling riveRef.current?.setInputStateAtPath('WAVE', true, 'BRAIN') in the React (WAVE is the boolean input and BRAIN is the exported nested artboard name.

This is all working fine on iOS, but the app crashes on Android.

logcat shows the following:

08-20 18:59:57.443 29234 29460 E AndroidRuntime: FATAL EXCEPTION: Thread-11
08-20 18:59:57.443 29234 29460 E AndroidRuntime: Process: com.xxx.xxx, PID: 29234
08-20 18:59:57.443 29234 29460 E AndroidRuntime: java.lang.Throwable:
08-20 18:59:57.443 29234 29460 E AndroidRuntime: app.rive.runtime.kotlin.core.errors.StateMachineInputException: No StateMachineInput found with name WAVE.
08-20 18:59:57.443 29234 29460 E AndroidRuntime:     app.rive.runtime.kotlin.core.StateMachineInstance.input(StateMachineInstance.kt:143)
08-20 18:59:57.443 29234 29460 E AndroidRuntime:     app.rive.runtime.kotlin.controllers.RiveFileController.processAllInputs(RiveFileController.kt:652)
08-20 18:59:57.443 29234 29460 E AndroidRuntime:     app.rive.runtime.kotlin.controllers.RiveFileController.advance(RiveFileController.kt:317)
08-20 18:59:57.443 29234 29460 E AndroidRuntime:     app.rive.runtime.kotlin.renderers.RiveArtboardRenderer.advance(RiveArtboardRenderer.kt:70)

Looking at the rive-android code here, I can see that we are not getting the form of StateMachineInputException associated with a nested artboard

If I amend the .riv to have an input in the main artboard called WAVE, we no longer get a crash.

It appears as if there's an issue with the path being sent through to the runtime.

Provide a Repro

See above with the setInputStateAtPath call.

Source .riv/.rev file

rive_source.zip
Artboard name: C-Ba
State Machine name: SM1
Nested boolean input name: WAVE
Nested boolean input path: BRAIN

Expected behavior

The nested input to be set and the app not to crash.

Additional context

Expo 53 (new architecture). Rive React Native at 9.5.0.

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