Skip to content

Commit ae5326e

Browse files
committed
TweenOneGroup restore resetStyle
1 parent e694bc3 commit ae5326e

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

HISTORY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
----
33

44
## 2.2.0
5-
1. TweenOne 的 resetStyleBool 改名成 resetStyle;
5+
1. resetStyleBool 改名成 resetStyle;
66
2. TweenOne 删除 updateReStart, 现在默认是。
77
3. Group 重构动画逻辑,以队列形式切换,如果在动画时做切换,需将动画完成后再执切换动画。
88
4. Group 增加 exclusive, 在队列动画时强行执行切换动画。

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +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. |
208209
| exclusive | boolean | false | Whether to allow a new animate to execute immediately when switching. `enter => leave`: execute immediately leave |
209210
| component | React.Element/String | div | component tag |
210211
| componentProps | object | - | component tag props |

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-tween-one",
3-
"version": "2.2.10",
3+
"version": "2.2.11",
44
"description": "tween-one anim component for react",
55
"keywords": [
66
"react",
@@ -34,9 +34,7 @@
3434
"assets/*.css",
3535
"dist",
3636
"es",
37-
"typings/index.d.ts",
38-
"typings/AnimObject.d.ts",
39-
"typings/TweenOneGroup.d.ts"
37+
"typings"
4038
],
4139
"licenses": "MIT",
4240
"main": "./lib/index",

src/TweenOneGroup.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class TweenOneGroup extends Component {
125125
key: child.key,
126126
animation: animate,
127127
onChange,
128-
resetStyle: this.props.exclusive,
128+
resetStyle: this.props.resetStyle,
129129
};
130130
if (this.keysToEnter.concat(this.keysToLeave).indexOf(child.key) >= 0
131131
|| !this.onEnterBool && animation) {
@@ -220,6 +220,7 @@ class TweenOneGroup extends Component {
220220
'animatingClassName',
221221
'onEnd',
222222
'exclusive',
223+
'resetStyle',
223224
].forEach(key => delete componentProps[key]);
224225
return createElement(this.props.component,
225226
{ ...componentProps, ...this.props.componentProps },
@@ -238,6 +239,7 @@ TweenOneGroup.propTypes = {
238239
leave: PropTypes.any,
239240
animatingClassName: PropTypes.array,
240241
onEnd: PropTypes.func,
242+
resetStyle: PropTypes.bool,
241243
exclusive: PropTypes.bool,
242244
};
243245

@@ -249,6 +251,7 @@ TweenOneGroup.defaultProps = {
249251
enter: { x: 50, opacity: 0, type: 'from' },
250252
leave: { x: -50, opacity: 0 },
251253
onEnd: noop,
254+
resetStyle: false,
252255
exclusive: false,
253256
};
254257
TweenOneGroup.isTweenOneGroup = true;

typings/TweenOneGroup.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface IGroupProps<T> extends Omit<React.HTMLAttributes<T>, 'onChange'
1010
leave?: IAnimObject | IAnimObject[] | ((key: string, index: number) => IAnimObject);
1111
animatingClassName?: string[] | [string, string];
1212
exclusive?: boolean;
13+
resetStyle?: boolean;
1314
onEnd?: (e: { key: string, type: string }) => void;
1415
component?: string | React.ReactNode;
1516
componentProps?: {};

0 commit comments

Comments
 (0)