rc-animate
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -23,2 +23,16 @@ 'use strict'; | ||
var defaultKey = 'rc_animate_' + Date.now(); | ||
function getChildrenFromProps(props) { | ||
var children = props.children; | ||
if (_react2['default'].isValidElement(children)) { | ||
if (!children.key) { | ||
return _react2['default'].cloneElement(children, { | ||
key: defaultKey | ||
}); | ||
} | ||
} | ||
return children; | ||
} | ||
var Animate = _react2['default'].createClass({ | ||
@@ -55,3 +69,3 @@ displayName: 'Animate', | ||
return { | ||
children: (0, _ChildrenUtils.toArrayChildren)(this.props.children) | ||
children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)) | ||
}; | ||
@@ -63,3 +77,3 @@ }, | ||
var nextChildren = (0, _ChildrenUtils.toArrayChildren)(nextProps.children); | ||
var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); | ||
var props = this.props; | ||
@@ -70,3 +84,3 @@ var showProp = props.showProp; | ||
// exclusive needs immediate response | ||
var currentChildren = exclusive ? (0, _ChildrenUtils.toArrayChildren)(props.children) : this.state.children; | ||
var currentChildren = exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children; | ||
var newChildren = _ChildrenUtils2['default'].mergeChildren(currentChildren, nextChildren); | ||
@@ -144,3 +158,3 @@ | ||
delete this.currentlyAnimatingKeys[key]; | ||
var currentChildren = (0, _ChildrenUtils.toArrayChildren)(this.props.children); | ||
var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)); | ||
if (!this.isValidChildByKey(currentChildren, key)) { | ||
@@ -175,3 +189,3 @@ // exclusive will not need this | ||
delete this.currentlyAnimatingKeys[key]; | ||
var currentChildren = (0, _ChildrenUtils.toArrayChildren)(this.props.children); | ||
var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)); | ||
// in case state change is too fast | ||
@@ -218,2 +232,5 @@ if (this.isValidChildByKey(currentChildren, key)) { | ||
var children = this.state.children.map(function (child) { | ||
if (!child.key) { | ||
throw new Error('must set key for <rc-animate> children'); | ||
} | ||
return _react2['default'].createElement( | ||
@@ -220,0 +237,0 @@ _AnimateChild2['default'], |
{ | ||
"name": "rc-animate", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "css-transition ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -26,6 +26,2 @@ # rc-animate | ||
## Screenshots | ||
![](http://gtms02.alicdn.com/tps/i2/TB1l3yrHXXXXXXWXpXXM9PE9pXX-446-343.png) | ||
## Feature | ||
@@ -32,0 +28,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17807
366
155