When a screen transition or animation starts, any synchronous JavaScript work can block the UI thread, causing jank. React Native's InteractionManager lets you schedule heavy tasks to run after all ongoing interactions finish. This is perfect for things like data parsing, image processing, or heavy state updates that aren't needed until the user can actually see the result.
import { InteractionManager, useEffect, useState } from 'react';
import { View, Text, ActivityIndicator } from 'react-native';
export default function ProfileScreen() {
const [profile, setProfile] = useState(null);
useEffect(() => {
const task = InteractionManager.runAfterInteractions(() => {
// Simulate expensive parsing
const data = JSON.parse(largeJsonString);
setProfile(data);
});
return () => task.cancel();
}, []);
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
{profile ? <Text>{profile.name}</Text> : <ActivityIndicator />}
</View>
);
}Wrap non‑essential, CPU‑intensive work in InteractionManager.runAfterInteractions to let animations finish first. This tiny change can turn a jittery transition into a seamless experience without changing your app's architecture.