This is a small extension of Facebook's TransitionGroup
and TransitionGroupChild
components from React source code.
What's changed
TransitionGroup
listens for bubbling click events from elements inside it and looks for data-direction
attribute. Then, it sets a class for animated element: <animation name>-direction-<direction name>
.
There is also a setDirection
method on TransitionGroup
to set direction name programmatically.
Usage
var TransitionGroup = require('directions-transition-group');
<TransitionGroup name="slide" ref="tg">
<RouteHandler />
</TransitionGroup>
<a href="#next" data-direction="forward">Next</a>
<Link to="step-one" data-direction="whatever">Back</Link>
this.refs.tg.setDirection("swap");