cheapsteak / react-transition-group-plus

A more full-featured transition group for React
Other
269 stars 20 forks source link

React TransitionGroupPlus

npm npm

A drop-in replacement for the original react-addons-transition-group that allows interruptible transitions and specifying transition order.

Note that this is not API-compatible with react-transition-group v2

Installation

npm install --save react-transition-group-plus

Demo

See a comparative demo between ReactTransitionGroup and TransitionGroupPlus

Aside from being able to specify transition order, notice how a component's enter transition is aborted and the leave transition runs as soon as a component should no longer be active.

Why?

ReactTransitionGroup has a few shortcomings

TransitionGroupPlus builds upon ReactTransitionGroup's existing code to solve these problems.

Usage

Usage of TransitionGroupPlus is nearly identical to ReactTransitionGroup. (See the guide on react's website on how to use ReactTransitionGroup)

Additional props:

sample:
<TransitionGroupPlus transitionMode="in-out">
  ...
</TransitionGroupPlus>

Browser Support

This component relies on Promises, which exists natively in most browsers, but a polyfill would be required for IE11 and below.

Other than that, this should run on all browsers where React runs.

License

Since this code was forked from React's ReactTransitionGroup, significant lines of codes still fall under React's original BSD license.

New code is licensed under MIT

Inspired by Vue's transitions