How to Use react-router-native-animate-stack Module

Written by minikawoon | Published 2020/04/10
Tech Story Tags: react-native | reactjs | javascript | coding | tutorial | application | mobile-apps | apps

TLDR React Router Native v5 with your desired customisation transition style! The code as simple as it is. The code is. simply simple as. It is. You can use the.yarn to add react-router-native to your desired transition style. It is not the only way you can customise the transition style of your transition style. The code will be updated to reflect the changes made in React Router v5 v5 and v5 versions of this year's version.via the TL;DR App

React Router Native v5 with your desired customisation transition style!
- The code as simple as it is.
<AnimatedStack>
    <Route exact path='/'>
        <Home />
    </Route>
    <Route path='/about'>
        <About />
    </Route>
    <Route path='/topics' component={Topics} />
</AnimatedStack>
If you want different kind of transition
activedViewStyleHandler={({ location, action, isNestedRoute }) => {
  return {
    transform: [
      {
        translateX: enterAnimKit.interpolate({
          inputRange: [0, 1],
          outputRange: [width, 0]
        })
      },
      {
        scale: enterAnimKit.interpolate({
          inputRange: [0, 0.5, 1],
          outputRange: [1, 0.2, 1]
      })
    }
    ]
  };
}}
deactivedViewStyleHandler={({ location, action, isNestedRoute }) => {
  return {
    transform: [
      {    
        translateX: exitAnimKit.interpolate({
          inputRange: [0, 1],
          outputRange: [0, -width]
        })
      },
      {
        scale: exitAnimKit.interpolate({
          inputRange: [0, 0.5, 1],
          outputRange: [1, 0.2, 1]
      })
    }
    ]
  };
}}
yarn add react-router-native react-router-native-animate-stack
or
npm install react-router-native react-router-native-animate-stack --save

Published by HackerNoon on 2020/04/10