rive-app / rive-app/rive-react
Rive artboard not updating when state changes.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 58
- Avg merge
- 3h 23m
- Merged PRs (30d)
- 6
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the useRive hook and reproduce the issue with the external theme prop changing after initialization. Trace how the hook handles the artboard option; done means the rendered Rive animation switches between the White and Grey artboards when that prop changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100