Back to Blog
RNTutorials

How to Add Animation in Navigation with React Navigation

Master navigation animations in React Native. Learn default transitions, custom animations, animated headers, tab bars, and gesture-based interactions.

Creating Smooth Navigation Experiences

Navigation animations are crucial for creating polished, professional mobile applications. Smooth transitions between screens enhance user experience and make your app feel native and responsive. React Navigation provides powerful animation APIs that let you create everything from simple fade effects to complex custom transitions.

This comprehensive guide covers default transitions, custom animations, animated headers and tab bars, gesture-based swipeable cards, and performance optimization techniques.

Default Transitions

React Navigation provides platform-specific default transitions that feel native:

  • iOS - Slide from right with parallax effect
  • Android - Fade and slide from bottom
  • Customizable - Override defaults per screen

Custom Slide Animations

Create custom slide transitions for unique navigation experiences:

// Custom slide from bottom
<Stack.Screen
  name="Modal"
  component={ModalScreen}
  options={{
    presentation: 'modal',
    animation: 'slide_from_bottom',
    animationDuration: 300,
  }}
/>

// Custom slide from left
<Stack.Screen
  name="Details"
  component={DetailsScreen}
  options={{
    animationTypeForReplace: 'pop',
    animation: 'slide_from_left',
  }}
/>

Fade Animations

Implement smooth fade transitions for modal-like screens:

import { TransitionPresets } from '@react-navigation/stack';

<Stack.Screen
  name="FadeScreen"
  component={FadeScreen}
  options={{
    ...TransitionPresets.FadeFromBottomAndroid,
    gestureEnabled: true,
  }}
/>

Scale Animations

Create zoom-in/zoom-out effects for dramatic transitions:

const scaleAnimation = {
  cardStyleInterpolator: ({ current, layouts }) => ({
    cardStyle: {
      transform: [
        {
          scale: current.progress.interpolate({
            inputRange: [0, 1],
            outputRange: [0.8, 1],
          }),
        },
      ],
      opacity: current.progress,
    },
  }),
};

<Stack.Screen
  name="ScaleScreen"
  component={ScaleScreen}
  options={scaleAnimation}
/>

Animated Headers

Create dynamic headers that respond to scroll position and user interaction:

  • Collapsing Headers - Hide header on scroll
  • Color Transitions - Change colors based on scroll position
  • Title Animations - Animate title appearance and size

Animated Tab Bars

Enhance tab navigation with smooth animations:

<Tab.Navigator
  screenOptions={{
    tabBarStyle: {
      position: 'absolute',
      elevation: 0,
      backgroundColor: '#ffffff',
    },
    tabBarIconStyle: {
      animation: 'spring',
    },
    tabBarActiveTintColor: '#007AFF',
  }}
>
  {/* Tab screens */}
</Tab.Navigator>

Gesture-Based Swipeable Cards

Implement swipe gestures for intuitive navigation:

  • Swipe to Dismiss - Pull down or swipe to close modals
  • Swipe to Navigate - Swipe left/right between screens
  • Custom Gestures - Define gesture thresholds and responses

Performance Tips

Optimize animation performance for smooth 60fps transitions:

  • Use native driver for animations when possible
  • Avoid heavy computations during transitions
  • Implement lazy loading for screen content
  • Profile animations with React DevTools
  • Test on low-end devices

Advanced Patterns

Explore advanced animation patterns for sophisticated user experiences:

  • Shared element transitions between screens
  • Coordinated animations across multiple elements
  • Physics-based spring animations
  • Interruptible animations

Build Polished Mobile Experiences

For Developers: AI Mobile Launcher includes smooth navigation animations with customizable transitions and gesture support out of the box.

For Founders: Need a mobile app with fluid animations? Contact CasaInnov for professional development.