Reanimated Driver
Advanced off-thread animations with Reanimated
Reanimated is an animation library that targets React Native and React Native Web. It runs animations off-thread and provides smooth spring and timing animations.
Installation
yarn
npm
bun
pnpm
yarn add @tamagui/animations-reanimated react-native-reanimated
Follow the Reanimated installation guide to complete setup for your platform.
Configuration
Add your animations to your Tamagui config:
import { createAnimations } from '@tamagui/animations-reanimated'import { createTamagui } from 'tamagui'export default createTamagui({animations: createAnimations({fast: {type: 'spring',damping: 20,mass: 1.2,stiffness: 250,},medium: {type: 'spring',damping: 10,mass: 0.9,stiffness: 100,},slow: {type: 'spring',damping: 20,stiffness: 60,},}),// ...})
How it Works
At runtime, this driver parses animatable style properties and hands them over to Reanimated using worklets. Animations run on the UI thread for smooth 60fps performance.
Animation Configuration
Reanimated animations support both spring and timing (tween) animations:
Spring Animations
{type: 'spring',damping: 10, // Higher = less bouncymass: 0.9, // Higher = more inertiastiffness: 100, // Higher = faster}
Timing Animations
{type: 'timing',duration: 300, // Duration in milliseconds}
Delay
You can add animation delays using the array syntax:
<Square transition={['bouncy', { delay: 200 }]} />
The delay is specified in milliseconds.
When to Use
Advantages:
- Off-thread animations - Runs on UI thread for 60fps performance
- Cross-platform - Works on web and React Native
- Advanced features - Worklets, gesture integration, shared values
- React Native optimized - Best performance on native platforms
- Powerful - Most feature-rich animation driver
Considerations:
- Larger bundle size
- Requires Reanimated setup and configuration
- More complex than simpler drivers
- Web-only apps might prefer Motion or CSS drivers
Platform-Specific Configuration
You can use Reanimated on native and a lighter driver on web:
// animations.native.tsimport { createAnimations } from '@tamagui/animations-reanimated'export const animations = createAnimations({bouncy: {type: 'spring',damping: 10,stiffness: 100,},})
// animations.ts (web)import { createAnimations } from '@tamagui/animations-motion'export const animations = createAnimations({bouncy: {type: 'spring',damping: 10,stiffness: 100,},})
Then import without the extension:
import { animations } from './animations'
Example
import { createAnimations } from '@tamagui/animations-reanimated'import { YStack, createTamagui } from 'tamagui'const animations = createAnimations({bouncy: {type: 'spring',damping: 10,mass: 0.9,stiffness: 100,},quick: {type: 'spring',damping: 20,mass: 1.2,stiffness: 250,},})export default createTamagui({animations,// ... rest of config})// Usage in componentsexport const MyComponent = () => (<YStack transition="bouncy" enterStyle={{ opacity: 0, scale: 0.9, }} />)
Zero Re-renders
The Reanimated driver now works with Tamagui to bypasses all internal style changes to instead directly hand off to Reanimated worklets.
Advanced Features
Reanimated provides advanced features:
- Gesture integration - Animate based on gesture values
- Shared values - Share animated values between components
- Worklets - JavaScript functions that run on the UI thread
- Custom animations - Full control over animation curves
See the Reanimated documentation for more details.