paint-brush
How to Use react-router-native-animate-stack Moduleby@minikawoon
304 reads
304 reads

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

by minikawoonApril 10th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

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.

Company Mentioned

Mention Thumbnail
featured image - How to Use react-router-native-animate-stack Module
minikawoon HackerNoon profile picture

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

Visiting https://github.com/Taymindis/react-router-native-animate-stack for more details