• This repository has been archived on 25/Feb/2020
  • Stars
    star
    158
  • Rank 229,502 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 5 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A switch navigator but with transitions between screens powered by the react-native-reanimated Transitions API

This package has been moved to https://github.com/react-navigation/react-navigation/tree/4.x/packages/animated-switch


react-navigation-animated-switch

This navigator uses the Reanimated Transitions API to animate route change transitions. Aside from the animations, it is identical to the standard switch navigator.

Installation

  • Install react-native-reanimated >= 1.0.0 if you have not already (the alpha version will not work!). If you have a managed Expo project, you need to use >= SDK 33 to have the correct version of Reanimated.
  • Install react-navigation-animated-switch with your favorite JS package manager.

Usage

import createAnimatedSwitchNavigator from 'react-navigation-animated-switch';

const MySwitch = createAnimatedSwitchNavigator({
  Home: HomeScreen,
  Other: OtherScreen,
});

Ta da! When you change between routes the screens will cross-fade with each other. You can customize the transition using the transition prop:

import createAnimatedSwitchNavigator from 'react-navigation-animated-switch';
import { Transition } from 'react-native-reanimated';

const MySwitch = createAnimatedSwitchNavigator(
  {
    Home: HomeScreen,
    Other: OtherScreen,
  },
  {
    transition: (
      <Transition.Together>
        <Transition.Out
          type="slide-bottom"
          durationMs={400}
          interpolation="easeIn"
        />
        <Transition.In type="fade" durationMs={500} />
      </Transition.Together>
    ),
  }
);

If you need to customize the underlying Transitioning.View style, you can pass in a transitionViewStyle option.

import createAnimatedSwitchNavigator from 'react-navigation-animated-switch';
import { Transition } from 'react-native-reanimated';

const MySwitch = createAnimatedSwitchNavigator(
  {
    Home: HomeScreen,
    Other: OtherScreen,
  },
  {
    transitionViewStyle: { backgroundColor: 'red' },
  }
);

Learn more about the Transition API here.

More Repositories

1

react-navigation

Routing and navigation for your React Native apps
TypeScript
23,162
star
2

react-native-safe-area-view

⚠️ Deprecated: use the successor react-native-safe-area-context instead!
TypeScript
660
star
3

hooks

React hooks for convenient react-navigation use
TypeScript
576
star
4

navigation-ex

Routing and navigation for your React Native apps
TypeScript
495
star
5

stack

Stack navigator for React Navigation
TypeScript
389
star
6

tabs

Tab navigators for React Navigation
TypeScript
326
star
7

react-navigation.github.io

Home of the documentation and other miscellanea
JavaScript
308
star
8

redux-helpers

Redux middleware and utils for React Navigation
JavaScript
296
star
9

material-bottom-tabs

A Material Design bottom tab navigator for React Navigation
TypeScript
175
star
10

drawer

Drawer navigator for React Navigation
TypeScript
143
star
11

search-layout

A basic search screen layout for usage with React Navigation.
JavaScript
124
star
12

web

Tools for react-navigation on web browsers and servers
JavaScript
94
star
13

rfcs

RFCs for changes to React Navigation
88
star
14

experimental-transitioner

A navigator for custom screen transitions with React Navigation and React Native
JavaScript
73
star
15

deep-linking-example

Example of usage of deep linking for blog post in React Navigation
TypeScript
64
star
16

core

Core utilities for the react-navigation framework shared between the native and web implementations.
JavaScript
62
star
17

native

React Native support for React Navigation. You probably don't need to use this directly, it's included in the react-navigation package.
JavaScript
46
star
18

web-server-example

Example for react-navigation and server-side rendering
JavaScript
44
star
19

create-react-app-example

Example create-react-app using react navigation
JavaScript
38
star
20

reanimated-stacks

TypeScript
21
star
21

boilerplate

Boilerplate app using React Navigation
TypeScript
13
star
22

theme-example

An example project with themes
Objective-C
12
star
23

check-versions-action

Check for missing or outdated versions of packages mentioned in the issue
JavaScript
4
star
24

ci-webhook

JavaScript
3
star
25

bot

A GitHub bot for react-navigation issues (currently unused)
JavaScript
3
star
26

deprecated-tab-navigator

Don't use this unless you have to. You will know if you have to
JavaScript
2
star
27

react-navigation-4

Code of React Navigation 4 for archiving
TypeScript
1
star