# transition-routes

> React Router 4 Switch Replacement that adds animations and scroll to top.

Latest version **0.1.0** (published 2018-02-02) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install transition-routes
pnpm add transition-routes
yarn add transition-routes
bun add transition-routes
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-02-02 |
| First published | 2018-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | canfie1d |

## Links

- npm: https://www.npmjs.com/package/transition-routes
- Repository: https://github.com/canfie1d/transition-switch
- Homepage: https://github.com/canfie1d/transition-switch#readme
- Issues: https://github.com/canfie1d/transition-switch/issues
- npm.io page: https://npm.io/package/transition-routes

## Dependencies (3)

- [animated](https://npm.io/package/animated.md) ^0.2.1
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0
- [react-transition-group](https://npm.io/package/react-transition-group.md) ^2.2.1

## Recent versions

- 0.1.0 (latest) — 2018-02-02

## README

# Transition Switch

This package replaces react-router 4's `<Switch>` component and enables scroll-to-top functionality and route transition animations using [React Transition Group](https://github.com/reactjs/react-transition-group) and
[Animate.js](https://github.com/animatedjs/animated).

Inspired by [react-router-transitions](https://github.com/gianlucacandiotti/react-router-transitions)

Demo available in /demo
## Installation
---
`npm i --save transition-switch`

## Usage
---
```
import TransitionSwitch from './TransitionSwitch';
```
```
<TransitionSwitch>
  <Route />
  <Route />
</TransitionSwitch>
```

## Props
---
- `transition`

  Controls the animation type

  _default:_ `'fade'`
  _available:_ `'fade', 'fade-up', 'fade-down'`
  _custom:_ If you pass in a formatted object, you can define custom animations
  - `[ 'opacity' ]`

- `timeout`

  Controls the animation duration

  _default:_ `{enter: 500, exit: 500 }`

- `scrollToTop`

  Toggles whether your scroll position is preserved on route change

  _default:_ `true`

- `scrollTopOffset`

  Controls scrollToTop's final position

  _default:_ `{ x: 0, y: 0 }`

- `scrollTopDelay`

  Defines when the scrollToTop occurs during the route animation

  _default:_ `250`


- `scrollContainer`

  If your layout locks the body and scrolls another element, you can change the scroll container target for scrollToTop

  _default:_ `window`

- `animatedDivClassName`

  Optionally pass a class name to the div that is animated

  _default:_ `"animatedRouteWrapper"`

---
_Source: https://npm.io/package/transition-routes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
