UNPKG

1.98 kBTypeScriptView Raw
1/// <reference types="react" />
2
3import * as React from 'react';
4import CommonProps from '../util';
5
6export interface AnimateProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
7 /**
8 * 动画 className
9 */
10 animation?: string | any;
11
12 /**
13 * 子元素第一次挂载时是否执行动画
14 */
15 animationAppear?: boolean;
16
17 /**
18 * 包裹子元素的标签
19 */
20 component?: React.ReactHTML;
21
22 /**
23 * 是否只有单个子元素,如果有多个子元素,请设置为 false
24 */
25 singleMode?: boolean;
26
27 /**
28 * 子元素
29 */
30 children?: React.ReactElement<any> | Array<any>;
31
32 /**
33 * 执行第一次挂载动画前触发的回调函数
34 */
35 beforeAppear?: (node: React.ReactElement<any>) => void;
36
37 /**
38 * 执行第一次挂载动画,添加 xxx-appear-active 类名后触发的回调函数
39 */
40 onAppear?: (node: React.ReactElement<any>) => void;
41
42 /**
43 * 执行完第一次挂载动画后触发的函数
44 */
45 afterAppear?: (node: React.ReactElement<any>) => void;
46
47 /**
48 * 执行进场动画前触发的回调函数
49 */
50 beforeEnter?: (node: React.ReactElement<any>) => void;
51
52 /**
53 * 执行进场动画,添加 xxx-enter-active 类名后触发的回调函数
54 */
55 onEnter?: (node: React.ReactElement<any>) => void;
56
57 /**
58 * 执行完进场动画后触发的回调函数
59 */
60 afterEnter?: (node: React.ReactElement<any>) => void;
61
62 /**
63 * 执行离场动画前触发的回调函数
64 */
65 beforeLeave?: (node: React.ReactElement<any>) => void;
66
67 /**
68 * 执行离场动画,添加 xxx-leave-active 类名后触发的回调函数
69 */
70 onLeave?: (node: React.ReactElement<any>) => void;
71
72 /**
73 * 执行完离场动画后触发的回调函数
74 */
75 afterLeave?: (node: React.ReactElement<any>) => void;
76}
77
78export default class Animate extends React.Component<AnimateProps, any> {}