rive-react icon indicating copy to clipboard operation
rive-react copied to clipboard

Rive artboard not updating when state changes.

Open mihael998 opened this issue 2 years ago • 1 comments

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?

mihael998 avatar Jul 11 '22 14:07 mihael998

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!

zplata avatar Jul 14 '22 14:07 zplata