rive-react
rive-react copied to clipboard
Rive artboard not updating when state changes.
I have a React component where I use a Rive animation with useRive
hook.
In the beggining i set the artboard parameter conditionally based on an external prop like so:
const { RiveComponent, rive } = useRive({ src: "/animations/hamburger_menu.riv", stateMachines: "stateMachine", autoplay: true, artboard: theme === NavbarComponentTheme.Orange ? "White" : "Grey", });
The problem is that when the prop changes the artboard doesn't change.
How should I manage this problem?
Hi @mihael998 , we currently aren't listening to these parameter changes, but we definitely should. There's a bit of work under the hood to coordinate this. We'll work on adding support for this. In the mean time, you might try two different components for this bit. We'll update on this issue when we get support for this!