All Projects → aboeglin → react-router-v4-transition

aboeglin / react-router-v4-transition

Licence: MIT license
React Router V4 Transition

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-router-v4-transition

Materialtransitionanimation
Material Animations practice which is inspired from
Stars: ✭ 165 (+312.5%)
Mutual labels:  transition
Visualizer
UI-Router state visualizer and transition visualizer
Stars: ✭ 205 (+412.5%)
Mutual labels:  transition
Presentr
iOS let's you modally present any view controller, but if you want the presented view controller to not cover the whole screen or modify anything about its presentation or transition you have to use the Custom View Controller Presentation API's.
Stars: ✭ 2,816 (+6940%)
Mutual labels:  transition
React Reveal Text
✨ A small react library for animating the revealing of text.
Stars: ✭ 171 (+327.5%)
Mutual labels:  transition
Decktransition
A library to recreate the iOS Apple Music now playing transition
Stars: ✭ 2,207 (+5417.5%)
Mutual labels:  transition
Spstorkcontroller
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.
Stars: ✭ 2,494 (+6135%)
Mutual labels:  transition
Aisphereview
A wonderful 3D animation
Stars: ✭ 160 (+300%)
Mutual labels:  transition
Fluidtransitions
Fluid Transitions for React Navigation
Stars: ✭ 2,814 (+6935%)
Mutual labels:  transition
Droidmotion
🏂 Implementation of a simple android motion
Stars: ✭ 200 (+400%)
Mutual labels:  transition
Anix
🐿 Super easy and lightweight(<3kb) JavaScript animation library
Stars: ✭ 239 (+497.5%)
Mutual labels:  transition
Transitioner
A library for dynamic view-to-view transitions
Stars: ✭ 2,049 (+5022.5%)
Mutual labels:  transition
Atgmediabrowser
Image slide-show viewer with multiple predefined transition styles, with ability to create new transitions with ease.
Stars: ✭ 186 (+365%)
Mutual labels:  transition
Transition
Easy interactive interruptible custom ViewController transitions
Stars: ✭ 2,566 (+6315%)
Mutual labels:  transition
Phaser State Transition
State transition plugin for Phaser.js
Stars: ✭ 169 (+322.5%)
Mutual labels:  transition
Lsyevernote
Stars: ✭ 248 (+520%)
Mutual labels:  transition
Starwars.android
This component implements transition animation to crumble view into tiny pieces.
Stars: ✭ 1,942 (+4755%)
Mutual labels:  transition
Marshroute
Marshroute is an iOS Library for making your Routers simple but extremely powerful
Stars: ✭ 208 (+420%)
Mutual labels:  transition
Editly
Slick, declarative command line video editing & API
Stars: ✭ 3,162 (+7805%)
Mutual labels:  transition
Ailight
AiLight is a custom firmware for the esp8266 based Ai-Thinker (or equivalent) RGBW WiFi light bulbs
Stars: ✭ 248 (+520%)
Mutual labels:  transition
Zfdragablemodaltransition
Custom animation transition for present modal view controller
Stars: ✭ 2,485 (+6112.5%)
Mutual labels:  transition

React Router Transition

Build Status Coverage Status npm version

Transitions for React Router v4. The API is composed of a component, TransitionSwitch, that should be used as the Switch component from react-router v4 to switch from a route to another one with a transition. That transition can be any action you need to do between routes, like animation, or fetching data.

API Description

1) The component:

<TransitionSwitch parallel={false}>
    <Route exact path="/">
        <Transition>home path</Transition>
    </Route>
    <Route path="/otherPath">
        <Transition>other path</Transition>
    </Route>
    <Route path="/">
        <Transition>other home</Transition>
    </Route>
    <Route path="/anotherPath">
        <Transition>another path</Transition>
    </Route>
</TransitionSwitch>

TransitionSwitch allows you to perform transitions on route change. Given its name, it works like the router v4 Switch. It means that only one route will be visible at all times. Except if parallel is set to true, which means that the entering transition won't wait for the leaving transition to be finished. NB: parallel may be renamed in the future.

2) The transitions:

Like a switch, the children must be Route elements. The children of these route elements will be given hooks to perform the transition. These hooks are :

class Transition extends React.Component {
    
    componentWillAppear(callback) {
        //do something when the component will appear
        
        callback();
    }
    
    componentDidAppear() {
        //do something when the component appeared
    }
    
    componentWillEnter(callback) {
        //do something when the component will enter
        
        callback();
    }
    
    componentDidEnter() {
        //do something when the component entered
    }
    
    componentWillLeave(callback) {
        //do something when the component will leave
                
        callback();
    }
    
    componentDidLeave() {
        //do something when the component has left    
    }
    
}

The callbacks must be called after the transition is complete, in the case of animation, a good place is in the callback provided by the animation library. The interface is very much the same as react-trasition-group v1. This means that componentWillAppear is called for the first time when the TransitionSwitch is mounted.

Sample App

In case you want to quickly try it, there's a webpack setup and very rough sample app. In order to build it you should run :

npm run build:example
npm run start:server

The app will be running at localhost:8080, the build command watches for changes in case you want to play with it, the sources are located in src/example.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].