✅ Solved : App crashes when loading more than 4 .riv files in the same screen (React Native)
I’m facing a crash issue when working with multiple .riv files in a single screen.
- In my React Native app, I can successfully load up to 4 .riv files
- But if I add more than 4, the app crashes as soon as I navigate to that screen.
- I’m using the official rive-react-native package.
Code setup :
const plantList = [
{ name: 'margarita_', stateMachine: 'margarita_ground' },
{ name: 'pomidoro_', stateMachine: 'pomidoro' },
{ name: 'rose_', stateMachine: 'rose' },
{ name: 'tulip_', stateMachine: 'tulip' },
{ name: 'sunflower_', stateMachine: 'sunflower' }, // Adding this crashes
];
return (
<View>
{plantList.map((plant, index) => (
<Rive
key={index}
resourceName={plant.name}
stateMachineName={plant.stateMachine}
autoplay
style={{ width: 200, height: 200 }}
/>
))}
</View>
);
Question:
Is there any known limitation on how many .riv files can be rendered on one screen in React Native?
Do you have any recommendations or best practices for handling multiple Rive files efficiently (like pooling, lazy loading, or other performance improvements)?