React Native · Mobile UI at native speed
How do you build animations in React Native?
Short answer
Use the Animated API with useNativeDriver for transform and opacity, LayoutAnimation for simple layout transitions, or Reanimated when animation must run on the UI thread with gesture-driven logic.
There are three common approaches. Animated is built in and works for many cases. Reanimated runs worklets on the UI thread and is the best fit for gesture-driven and interruptible animation. LayoutAnimation animates layout changes such as insertion or removal with very little code.
import { useEffect, useRef } from "react";
import { Animated, Pressable } from "react-native";
export function FadeIn({ children }: { children: React.ReactNode }) {
const opacity = useRef(new Animated.Value(0)).current;
useEffect(() => {
Animated.timing(opacity, {
toValue: 1,
duration: 250,
useNativeDriver: true,
}).start();
}, [opacity]);
return <Animated.View style={{ opacity }}>{children}</Animated.View>;
}Choosing the right tool
- Animated with useNativeDriver for opacity and transforms
- Animated without native driver only for properties it cannot drive, such as width or backgroundColor
- LayoutAnimation for simple layout changes on the next render
- Reanimated for gesture-driven, interruptible or complex spring animations
- The built-in Animated API is enough for simple fades, slides and sequences
The native driver cannot animate layout properties, because layout is computed by Yoga. Animating width or top forces work on the JS thread and is more likely to drop frames. Prefer transform and opacity, and use scale instead of width where the visual result is equivalent.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Which properties can use the native driver?
- 2When would you choose Reanimated over Animated?
- 3How do you respect reduce motion?
- 4Why does animating width cause jank?
Say it in the interview
I default to the built-in Animated API with useNativeDriver for opacity and transform, because those can run off the JS thread. For gesture-driven or interruptible animation I use Reanimated, and for simple layout changes LayoutAnimation is enough. I avoid animating layout properties like width, and I check the reduce-motion accessibility setting before showing non-essential motion.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live React Native mock interview and get scored feedback on depth, clarity and confidence.