Initial commit

This commit is contained in:
Brent Vatne
2019-04-06 20:21:59 +02:00
parent 5255444030
commit dc033e9f23
2 changed files with 45 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
# react-navigation-animated-switch-navigator
This navigator uses the [Reanimated Transitions API](https://github.com/kmagiera/react-native-reanimated) to animate route change transitions. Aside from the animations, it is identical to the standard [switch navigator](https://reactnavigation.org/docs/en/switch-navigator.html).
## Installation
- [Install react-native-reanimated >= 1.0.0](https://github.com/kmagiera/react-native-reanimated#installation) 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-navigator` with your favorite JS package manager.
## Usage
```js
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:
```js
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>
),
}
);
```
[Learn more about the `Transition` API here](https://github.com/kmagiera/react-native-reanimated).

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation-animated-switch-navigator",
"version": "1.0.0",
"version": "0.1.0",
"description": "",
"main": "index.js",
"author": "",