Skip to content

Commit b831c06

Browse files
committed
fix group index
1 parent ffd4de4 commit b831c06

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

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": "3.0.0-beta.14",
3+
"version": "3.0.0-beta.15",
44
"description": "tween-one anim component for react",
55
"typings": "es/index.d.ts",
66
"engines": {

src/TweenOneGroup.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ const TweenOneGroup: TweenOneGroupRef = React.forwardRef<any, IGroupProps>((prop
216216
}
217217
const { key } = child;
218218
if (keysToLeave.current.indexOf(key) >= 0) {
219-
return getCoverAnimation(child, i, 'leave');
219+
return getCoverAnimation(child, keysToLeave.current.indexOf(key), 'leave');
220220
}
221221
if (
222222
(keysToEnter.current.indexOf(key) >= 0 ||
@@ -228,7 +228,7 @@ const TweenOneGroup: TweenOneGroupRef = React.forwardRef<any, IGroupProps>((prop
228228
* 2. 出场未结束,触发进场, this.isTween[key] 为 leave, key 在 enter 里。
229229
* 3. 状态为 enter 且 tweenTag 里有值时,不执行重载动画属性,直接调用 tweenTag 里的。
230230
*/
231-
return getCoverAnimation(child, i, 'enter');
231+
return getCoverAnimation(child, keysToEnter.current.indexOf(key), 'enter');
232232
}
233233
if (!oneEnter.current) {
234234
return getCoverAnimation(child, i, 'appear');

src/type.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ interface AnimObject extends Anim {
2323

2424
export type AnimObjectOrArray = AnimObject | AnimObject[];
2525

26-
export type IAnimObject = AnimObjectOrArray | ((key: string, index: number) => AnimObject);
26+
export type IAnimObject = AnimObjectOrArray | ((e: { key: string; index: number }) => AnimObject);
2727

28-
29-
interface AllHTMLAttributes extends Omit<React.SVGAttributes<any>, 'crossOrigin'>, React.AllHTMLAttributes<any> {
30-
31-
}
28+
interface AllHTMLAttributes
29+
extends Omit<React.SVGAttributes<any>, 'crossOrigin'>,
30+
React.AllHTMLAttributes<any> {}
3231
export interface IAnimProps extends Omit<AllHTMLAttributes, 'onChange'> {
3332
style?: React.CSSProperties;
3433
children?: any;
@@ -59,7 +58,8 @@ export interface IAnimProps extends Omit<AllHTMLAttributes, 'onChange'> {
5958
regionEndTime?: number;
6059
}
6160

62-
export interface IGroupProps extends Omit<React.HTMLAttributes<any>, 'onChange'> {
61+
export interface IGroupProps extends Omit<AllHTMLAttributes, 'onChange'> {
62+
ref?: React.Ref<any>;
6363
appear?: boolean;
6464
enter?: IAnimObject;
6565
leave?: IAnimObject;

0 commit comments

Comments
 (0)