React Native Reanimated 4: The Practical Guide for 2026 (CSS Animations, Gestures, Shared Element Transitions)

React Native Reanimated 4 guide for 2026: install, shared values, CSS transitions, layout animations, gestures and shared element transitions.

React Native Reanimated 4: The Practical Guide for 2026 (CSS Animations, Gestures, Shared Element Transitions)

React Native Reanimated is the animation library almost every serious React Native app ends up installing, usually because something else depends on it and then because nothing else is as smooth. It runs your animations on the UI thread, so a busy JavaScript thread cannot make them stutter. This guide covers Reanimated 4 as it stands at version 4.8.0: installation, the mental model, shared values, the CSS-style transitions and animations added in 4.0, layout animations, gestures, and the shared element transitions that became the default in November 2026.

Versions checked on npm on November 30, 2026: react-native-reanimated 4.8.0 (November 19, about 14 million downloads a week, MIT) with react-native-worklets 0.14.0 and react-native-gesture-handler 3.5.0. Reanimated 4.8 supports React Native 0.87 to 0.89.

The short answer: which API for which job

  • A style changes when state changes (a button grows when pressed, a card changes colour): CSS transitions. No hooks.
  • Something loops or plays by itself (a skeleton shimmer, a pulsing dot): CSS animations with keyframes.
  • A component appears, disappears or moves in a list: layout animations (entering, exiting, layout).
  • The animation follows a finger or a scroll position: shared values with useAnimatedStyle, driven by Gesture Handler.
  • An element travels between two screens: shared element transitions (4.8 and later).

Most apps need the first three far more often than the fourth. If you learned Reanimated 2 or 3, your reflex is to reach for useSharedValue for everything. In version 4 that is usually more code than the job needs.

Install React Native Reanimated 4

Reanimated 4 works only on the New Architecture. That stopped being a real constraint when React Native 0.82 made it the only architecture, but if you maintain an older app, Reanimated 3 is your ceiling and it is no longer actively maintained.

# Expo: installs the pair your SDK selects
npx expo install react-native-reanimated react-native-worklets

# React Native Community CLI
npm install react-native-reanimated react-native-worklets
cd ios && pod install

The worklets engine was split into its own package in 4.0, and the two versions are locked together. Get the pair wrong and the app fails at startup with a version mismatch error.

Reanimated react-native-worklets React Native
4.8.x 0.14.x 0.87 to 0.89
4.7.x 0.13.x 0.86 to 0.88
4.6.x 0.12.x 0.83 to 0.87

With the Community CLI, add the Babel plugin, and keep it last in the list:

// babel.config.js
module.exports = {
  presets: ['module:@react-native/babel-preset'],
  plugins: ['react-native-worklets/plugin'], // must be last
};

Expo’s template already includes it. After changing the Babel config, clear the Metro cache once with npm start -- --reset-cache. An Expo SDK can select a Reanimated version older than 4.8, so check what npx expo install actually installed before you look for a 4.8 feature.

The mental model: two runtimes

A React Native app has a JavaScript runtime that runs React, and a UI thread that draws frames. Reanimated adds a second, small JavaScript runtime on the UI thread. Three ideas follow from that:

  • A shared value is a value both runtimes can read and write. Changing it does not re-render your component.
  • A worklet is a function the Babel plugin copies to the UI runtime. The callbacks you pass to useAnimatedStyle and to gesture handlers are worklets automatically.
  • An animated style is a worklet that returns a style object. When a shared value it reads changes, it reruns on the UI thread and the view updates without React.

If you want the layers underneath (Fabric, JSI, why there is a UI thread at all), our architecture explainer covers them.

Shared values and useAnimatedStyle

import { Pressable } from 'react-native';
import Animated, {
  useSharedValue,
  useAnimatedStyle,
  withSpring,
} from 'react-native-reanimated';

export function LikeButton() {
  const scale = useSharedValue(1);

  const style = useAnimatedStyle(() => ({
    transform: [{ scale: scale.value }],
  }));

  return (
    <Pressable
      onPressIn={() => (scale.value = withSpring(0.9))}
      onPressOut={() => (scale.value = withSpring(1))}
    >
      <Animated.View style={[{ width: 64, height: 64, borderRadius: 32, backgroundColor: '#e5484d' }, style]} />
    </Pressable>
  );
}

Assigning withSpring(0.9) to scale.value does not set it to 0.9. It starts an animation toward 0.9 on the UI thread. The other modifiers work the same way: withTiming for a fixed duration, withDecay for momentum, and withSequence, withDelay and withRepeat to compose them. Use useDerivedValue when one shared value should be computed from another.

CSS transitions: the least code for the most common case

Since 4.0, an Animated component accepts CSS-style transition properties directly in style. Change the style from React state and Reanimated animates the difference:

import { useState } from 'react';
import { Pressable } from 'react-native';
import Animated from 'react-native-reanimated';

export function ExpandingCard() {
  const [open, setOpen] = useState(false);

  return (
    <Pressable onPress={() => setOpen((v) => !v)}>
      <Animated.View
        style={{
          height: open ? 220 : 80,
          backgroundColor: open ? '#3e63dd' : '#8da4ef',
          borderRadius: open ? 24 : 12,
          transitionProperty: ['height', 'backgroundColor', 'borderRadius'],
          transitionDuration: 300,
          transitionTimingFunction: 'ease-out',
        }}
      />
    </Pressable>
  );
}

No shared value, no hook, no worklet. Two rules from the docs: transitionDuration is required, and transitionProperty: 'all' is discouraged for performance, so list the properties. Discrete properties such as flexDirection or justifyContent cannot transition; use a layout animation for those.

CSS animations: keyframes for things that run by themselves

import Animated, { type CSSAnimationKeyframes } from 'react-native-reanimated';

const pulse: CSSAnimationKeyframes = {
  from: { transform: [{ scale: 0.9 }], opacity: 0.6 },
  to: { transform: [{ scale: 1.1 }], opacity: 1 },
};

export function LiveDot() {
  return (
    <Animated.View
      style={{
        width: 12, height: 12, borderRadius: 6, backgroundColor: '#30a46c',
        animationName: pulse,
        animationDuration: '800ms',
        animationIterationCount: 'infinite',
        animationDirection: 'alternate',
        animationTimingFunction: 'ease-in-out',
      }}
    />
  );
}

Keyframe keys can be from, to, percentages or numbers between 0 and 1. Since 4.8, transitions and animations can also animate backgroundImage gradients, which makes a shimmering skeleton a few lines of style.

Layout animations: entering, exiting and reordering

import Animated, { FadeInDown, FadeOutUp, LinearTransition } from 'react-native-reanimated';

function Row({ item }: { item: Todo }) {
  return (
    <Animated.View
      entering={FadeInDown.duration(250)}
      exiting={FadeOutUp.duration(200)}
      layout={LinearTransition.springify()}
    >
      <TodoCard item={item} />
    </Animated.View>
  );
}

entering runs when the component mounts, exiting when it unmounts (Reanimated keeps the native view alive until the animation ends), and layout whenever its position or size changes, for example when a sibling is removed. Define customised builders outside the component or in useMemo. One trap on the New Architecture: Reanimated uses nativeID internally for entering animations, so a component that sets its own nativeID will not run one. Wrap it in a plain View that carries the id.

Version 4.7 made a new layout animations engine the default, and 4.8 fixed crashes and invisible entering views on Android. If you parked a layout animation bug a year ago, try again.

Gestures: Reanimated plus Gesture Handler 3

Reanimated animates; react-native-gesture-handler recognises touches natively and calls your worklets on the UI thread. Gesture Handler 3 uses hooks:

import Animated, { useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated';
import { GestureDetector, usePanGesture } from 'react-native-gesture-handler';

export function DraggableCard() {
  const x = useSharedValue(0);
  const y = useSharedValue(0);

  const pan = usePanGesture({
    onUpdate: (e) => {
      x.value = e.translationX;
      y.value = e.translationY;
    },
    onDeactivate: () => {
      x.value = withSpring(0);
      y.value = withSpring(0);
    },
  });

  const style = useAnimatedStyle(() => ({
    transform: [{ translateX: x.value }, { translateY: y.value }],
  }));

  return (
    <GestureDetector gesture={pan}>
      <Animated.View style={[{ width: 160, height: 100, borderRadius: 16, backgroundColor: '#3e63dd' }, style]} />
    </GestureDetector>
  );
}

The app root must be wrapped in GestureHandlerRootView. If you are still on Gesture Handler 2, the same gesture is written with the builder API (Gesture.Pan().onUpdate(...)); the Reanimated side is identical. Sheets are the classic use of this pair, and our bottom sheet guide shows what a production one involves.

Calling React from a worklet

Worklets run on the UI runtime, so they cannot call setState directly. Schedule the call on the React Native runtime:

import { scheduleOnRN } from 'react-native-worklets';

const pan = usePanGesture({
  onDeactivate: (e) => {
    if (e.translationX > 120) scheduleOnRN(onDismiss, item.id);
  },
});

The function you pass must be defined in the component body or at module scope, not inside the worklet. If you are coming from Reanimated 3, this is the job runOnJS used to do.

Shared element transitions (4.8 and later)

This is the feature of the release. Give the same tag to a view on each screen, wrap each screen in a boundary, and Reanimated moves the view from one to the other during navigation:

import { useIsFocused } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import Animated, { SharedTransitionBoundary } from 'react-native-reanimated';

const Stack = createNativeStackNavigator();

function ScreenBoundary({ children }: { children: React.ReactNode }) {
  const isFocused = useIsFocused();
  return <SharedTransitionBoundary isActive={isFocused}>{children}</SharedTransitionBoundary>;
}

// List screen
<Animated.Image sharedTransitionTag={`photo-${id}`} source={src} style={{ width: 100, height: 100 }} />

// Details screen
<Animated.Image sharedTransitionTag={`photo-${id}`} source={src} style={{ width: '100%', height: 300 }} />

// Navigator: wrap every screen once
<Stack.Navigator screenLayout={({ children }) => <ScreenBoundary>{children}</ScreenBoundary>}>
  <Stack.Screen name="List" component={ListScreen} />
  <Stack.Screen name="Details" component={DetailsScreen} />
</Stack.Navigator>

By default the transition is a 500 ms timing animation of everything that differs between the two views: position, size, opacity, background colour, border radius and width, transforms and shadows. Since 4.8 the library moves the real view instead of a copy, so a playing video keeps playing while it travels. When the two views have different children, SharedTransition.fadeContent() fades one set out and the other in.

What to know before you ship it:

  • On Android, use react-native-screens 4.28 or newer. Older versions can crash at startup. Background on that library is in our react-native-screens explainer.
  • Reanimated 4.2 to 4.7 had an experimental version behind the ENABLE_SHARED_ELEMENT_TRANSITIONS flag. In 4.8 it is on, and you set the same static feature flag to false to turn it off.
  • Keep each tag unique within a screen. In a list, build the tag from the item id.
  • Expo Go only contains the native code of the versions its SDK selects, so test this in a development build.

Performance rules that actually matter

  1. Animate transform and opacity where you can. Animating width, height or margin forces a layout pass on every frame. It works; it is just the expensive way.
  2. Do not read .value during render. A shared value read in the component body is a snapshot and will not update. Read it inside useAnimatedStyle or useDerivedValue.
  3. Keep worklets small. They run inside a frame. Sixteen milliseconds, or eight on a 120 Hz screen, shared with everything else.
  4. Animate numbers in text with Animated.Text. Since 4.8 it takes a shared value as a child: <Animated.Text>{progress}%</Animated.Text>. No re-render per frame.
  5. Respect reduced motion. useReducedMotion() tells you the system setting, and the animation helpers accept a reduceMotion option. An app that ignores it makes some people feel ill.

4.8 also stops running its mappers when nothing is animating, so an idle app is actually idle. That one is free with the upgrade.

Reanimated vs the alternatives

Option Good at Limits
React Native Animated (built in) Simple fades and slides with useNativeDriver, no dependency. The React Native 0.89 release candidates promote its C++ native implementation to stable No gesture-driven worklets, no layout or shared element animations
Reanimated 4.8.0 Everything in this guide, on the UI thread New Architecture only; version pairing with worklets
Moti 0.30.0 Declarative API on top of Reanimated Last release in January 2025; CSS transitions now cover most of what it was used for
React Native Skia Custom drawing, shaders, charts, canvas effects Not for animating ordinary views. It pairs with Reanimated instead of replacing it

For the canvas side, see our React Native Skia guide.

Troubleshooting

  • Version mismatch error at startup: the worklets package does not match Reanimated. Check the table above, reinstall, rebuild the native app.
  • “Tried to synchronously call a non-worklet function”: a regular function was called from a worklet. Use scheduleOnRN, or mark the function with the 'worklet' directive if it should run on the UI thread.
  • Nothing animates after an upgrade: stale Metro cache or the Babel plugin is not last. Reset the cache.
  • Entering animation does not run: the component has its own nativeID, or it is not an Animated component.
  • Jest fails on shared values: use the library’s Jest setup. In 4.8 the mocks of useSharedValue and useDerivedValue behave like the real hooks.
  • Upgrading React Native breaks the build: Reanimated supports a limited window of React Native versions (three in 4.8). Upgrade it in the same pull request, as described in our Upgrade Helper guide.

FAQ

What is React Native Reanimated?

An open-source animation library by Software Mansion that runs animations and gesture responses on the UI thread instead of the JavaScript thread, so they stay smooth while React is busy.

Does Reanimated 4 work with the old architecture?

No. Reanimated 4 requires the New Architecture. Apps on the old architecture can use Reanimated 3, which is no longer actively maintained.

Do I need react-native-worklets?

Yes, with Reanimated 4. The worklets runtime was moved into its own package, and each Reanimated minor version pairs with one worklets minor version.

Should I use CSS transitions or shared values?

Use CSS transitions and animations when the animation is driven by React state or runs by itself. Use shared values when it follows a gesture, a scroll position or another continuously changing value.

Does Reanimated work with Expo?

Yes. Install it with npx expo install react-native-reanimated react-native-worklets. The Babel plugin is already part of Expo’s preset.

Leave a Reply 0

Your email address will not be published. Required fields are marked *