Sequential calls to ref.setInputState results in only the last one being updating in the animation.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react-native, typescript
- Domain
- mobile-dev
Research direction
Start by reproducing the sequential setInputState calls in the React Native example and then trace the setInputState entry point in the React Native implementation. Confirm how consecutive trigger inputs are processed during one animation update. Done means both “Many Teeth Mouth” and “Many Eyes” changes appear without setTimeout or Promise delays.
Written by the indexing model from the issue text.
Description
Description
When using Rive with React Native, setting multiple input states sequentially does not work as expected. Only the last input change is reflected in the animation, ignoring previous input changes.
Provide a Repro
Here's a minimal code snippet that reproduces the issue:
MonsterRef.current?.setInputState(stateMachineName, "Many Teeth Mouth", true);
MonsterRef.current?.setInputState(stateMachineName, "Many Eyes", true);
In this example, only the "Many Eyes" input change is reflected in the animation, while the "Many Teeth Mouth" input is ignored.
A workaround using setTimeout and Promises works:
new Promise((resolve) => {
setTimeout(() => {
MonsterRef.current?.setInputState(stateMachineName, "Many Teeth Mouth", true)
resolve(null);
}, 50)
}).then(() => {
setTimeout(() => {
MonsterRef.current?.setInputState(stateMachineName, "Many Eyes", true);
}, 50)
});
Expected behavior
When setting multiple input states sequentially, all input changes should be reflected in the animation, not just the last one.
Screenshots
N/A
Device & Versions (please complete the following information)
- Device: Google Pixel 7 API 34, ran on Android Studio Device Manager (emulator) with Windows 11.
- OS: Windows 11 Version 23H2
- NPM Version: 10.8.1
Additional context
This is functionality for part of my app where you can customize your character, using several different body parts. The state machine has an input for each bodypart, the input is of type "trigger".
I have been able to work around this will a mess of Promises and setTimeouts, ensuring none run at the same time. But as my codebase grows I will not be able to keep this up.
- Dominant language
- TypeScript
- Stars
- 783
- Forks
- 81
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 3
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.
More from rive-app/rive-react-native
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rive-app/rive-react-native#433 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
rive-app/rive-react-native#431 · 2 comments ·
-
[Android] Rive events dispatched off the UI thread can deadlock with Reanimated under Fabric (ANR) Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
rive-app/rive-react-native#444 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
rive-app/rive-react-native#441 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
rive-app/rive-react-native#440 ·
All issues in rive-app/rive-react-native
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·