Issue with Dynamic Data for Plant Animation in React Native
I’m trying to implement a garden flow animation in my React Native app using the Rive package. The animation includes multiple plants, each with inputs for growth, flowers, and other states.
I’ve tried the following:
Using setInputState for dynamic and static values
Accessing nested inputs using chain notation
Issue:
The animation does not update with dynamic data.
Even static values are not reflected in the animation.
React Native does not support nested chain notation, so I tried path notation as suggested in the documentation, but I’m still facing the same issue.
Goal:
I need to control multiple plants’ growth, flowers, and other states dynamically using inputs from React Native.
Ideally, I want to use a single Rive file with inputs for each plant, rather than adding each plant as a separate file.
code :
Object.entries(inputs).forEach(([inputName, value]) => {
try {
console.log(
`🌱 Attempting: setInputStateAtPath("${inputName}", ${value}, "${plantName}")`,
);
riveRef.current?.setInputStateAtPath(inputName, value, plantName);
console.log(`✅ Success: ${plantName}.${inputName} = ${value}`);
} catch (e) {
console.error(`❌ Failed: ${plantName}.${inputName} = ${value}`, e);
}
});in this I got success log also
🌱 Attempting: setInputStateAtPath("grow", 71.43, "pomidoro")
✅ Success: pomidoro.grow = 71.43
🌱 Attempting: setInputStateAtPath("flower01", false, "pomidoro")
✅ Success: pomidoro.flower01 = false
🌱 Attempting: setInputStateAtPath("flower02", false, "pomidoro")
✅ Success: pomidoro.flower02 = false
🌱 Attempting: setInputStateAtPath("flower03", true, "pomidoro")
✅ Success: pomidoro.flower03 = true
🌱 Attempting: setInputStateAtPath("flowers", true, "pomidoro")
✅ Success: pomidoro.flowers = true
🌱 Attempting: setInputStateAtPath("fruits", false, "pomidoro")
✅ Success: pomidoro.fruits = false
🌱 Attempting: setInputStateAtPath("water", true, "pomidoro")
✅ Success: pomidoro.water = true
🌱 Attempting: setInputStateAtPath("pot", true, "pomidoro")Success: pomidoro.pot = true
Rive state machine tree
garden (state machine)
├── day/night (boolean)
├── margarita_pot
├── grow (number)
├── flower01 (boolean)
├── flower02 (boolean)
├── flower03 (boolean)
├── flowers (boolean)
├── fruits (boolean)
├── fresh_dry (boolean)
├── water (boolean)
└── pot (boolean)
├── margarita_branch
├── ...
so pls help me if anyone know how to update this nested inputs 🙏🏻