Unable to set/ update viewmodel input in runtime
Setup:
Created a theme switcher animation using Rive state machine:
stateMachineName: "State Machine 1"
artboardName: "Final"
viewModelName: "ThemeSwitch"
input (Boolean) name inside view model: "isDark"
State machine has 2 trigger inputs: dark, light. (I trigger them with external CTAs built in the app)
isDark reads previously set value, and open animation in the respective state. isDark = true, Default as Dark (state) isDark = false, Default as Light (state)
Now based on trigger inputs, the states change between 'Switch to Light' and 'Switch to Dark'.
the 2 states 'Switch to Light' and 'Switch to Dark' report events 'EnterLight' and 'EnterDark' respectively
StateMachine listeners listen for event report to switch ViewModel boolean input 'isDark' value
Video (it was working perfectlt before)
themeSwitcher working.MOV
Issue
While fixing other bugs, some packages updated and now the rive asset isn’t able to update/ sync the viewModel input. In runtime, It always opens in the default state of the VM input as set in original .riv asset instead of reading the theme value of the app
The setup works fine in Rive. Not able to get it to work on code.
implementation details: React native + expo SDK. Built with cursor