Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #37 from twitter-fabric/patch/short-circuit-leave
Browse files Browse the repository at this point in the history
Fixes VelocityTransitionGroup for no "leave"
  • Loading branch information
fionawhim committed Oct 21, 2015
2 parents 23b53cb + d5f4030 commit 40341b8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### v1.1.1 (2015-10-21):

#### Bug fixes
* Fix for `VelocityTransitionGroup` not animating when no `leave` prop is set.
* Better detection of existing `Velocity` instances (thanks, @arush!).

### v1.1.0 (2015-10-08):

Updated peerDependencies and requires to React 0.14.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
Read our [announcement blog post](https://fabric.io/blog/introducing-the-velocityreact-library) for
details about why and how we built this.

**Latest version:** 1.1.0 is updated to require React 0.14
**Latest version:** v1.1.1 fixes a small bug with `VelocityTransitionGroup` when no `leave` is
provided. *Note: v1.1.0 and later require React 0.14.*

## Running the demo

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "velocity-react",
"version": "1.1.0",
"version": "1.1.1",
"description": "React components to wrap Velocity animations",
"main": "index.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions velocity-transition-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ var VelocityTransitionGroup = React.createClass({
},

childWillEnter: function (node, doneFn) {
if (this._shortCircuitAnimation(doneFn)) return;
if (this._shortCircuitAnimation(this.props.enter, doneFn)) return;

// By finishing a "leave" on the element, we put it in the right state to be animated in. Useful
// if "leave" includes a rotation or something that we'd like to have as our starting point, for
Expand All @@ -161,7 +161,7 @@ var VelocityTransitionGroup = React.createClass({
},

childWillLeave: function (node, doneFn) {
if (this._shortCircuitAnimation(doneFn)) return;
if (this._shortCircuitAnimation(this.props.leave, doneFn)) return;

this._leaving.push({
node: node,
Expand All @@ -177,8 +177,8 @@ var VelocityTransitionGroup = React.createClass({
//
// Returns true if this did short circuit, false if lifecycle methods should continue with
// their animations.
_shortCircuitAnimation: function (doneFn) {
if (document.hidden || (this._parseAnimationProp(this.props.leave).animation == null)) {
_shortCircuitAnimation: function (animationProp, doneFn) {
if (document.hidden || (this._parseAnimationProp(animationProp).animation == null)) {
if (this.isMounted()) {
doneFn();
}
Expand Down

0 comments on commit 40341b8

Please sign in to comment.