Skip to content

Commit f8b82f1

Browse files
committed
remove originalChildren, use currentChildren, resetStyle default is true
1 parent ae5326e commit f8b82f1

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ object: `animation={{ path: { x: path, y: path, rotate: path } }}`, can be contr
205205
| leave | object / array / func | `{ x: 30, opacity: 0 }` | leave anim twee-one data. when array is tween-one timeline, func refer to queue-anim |
206206
| onEnd | func | - | one animation end callback |
207207
| animatingClassName | array | `['tween-one-entering', 'tween-one-leaving']` | className to every element of animating |
208-
| resetStyle | boolean | TweenOne resetStyle, reset the initial style when changing animation. |
208+
| resetStyle | boolean | true | TweenOne resetStyle, reset the initial style when changing animation. |
209209
| exclusive | boolean | false | Whether to allow a new animate to execute immediately when switching. `enter => leave`: execute immediately leave |
210210
| component | React.Element/String | div | component tag |
211211
| componentProps | object | - | component tag props |

examples/group.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class Demo extends React.Component {
8686
enter={this.enterType}
8787
leave={[{ y: 90 }, { x: 100, opacity: 0 }]}
8888
onEnd={this.onEnd}
89+
exclusive
8990
>
9091
{this.state.children}
9192
</TweenOneGroup>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-tween-one",
3-
"version": "2.2.11",
3+
"version": "2.2.12",
44
"description": "tween-one anim component for react",
55
"keywords": [
66
"react",

src/TweenOneGroup.jsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class TweenOneGroup extends Component {
2424
this.isTween = {};
2525
// 第一进入,appear 为 true 时默认用 enter 或 tween-one 上的效果
2626
const children = toArrayChildren(getChildrenFromProps(this.props));
27-
this.originalChildren = toArrayChildren(getChildrenFromProps(this.props));
2827
this.currentChildren = toArrayChildren(getChildrenFromProps(this.props));
2928
this.state = {
3029
children,
@@ -41,13 +40,9 @@ class TweenOneGroup extends Component {
4140
this.animQueue.push(nextChildren);
4241
return;
4342
}
44-
const currentChildren = toArrayChildren(nextProps.exclusive ?
45-
this.originalChildren : this.state.children);
43+
const currentChildren = toArrayChildren(this.currentChildren);
4644
this.changeChildren(nextChildren, currentChildren);
4745
}
48-
componentDidUpdate() {
49-
this.originalChildren = toArrayChildren(getChildrenFromProps(this.props));
50-
}
5146

5247
onChange = (animation, key, type, obj) => {
5348
const length = dataToArray(animation).length;
@@ -251,7 +246,7 @@ TweenOneGroup.defaultProps = {
251246
enter: { x: 50, opacity: 0, type: 'from' },
252247
leave: { x: -50, opacity: 0 },
253248
onEnd: noop,
254-
resetStyle: false,
249+
resetStyle: true,
255250
exclusive: false,
256251
};
257252
TweenOneGroup.isTweenOneGroup = true;

0 commit comments

Comments
 (0)