Blame view

天文台pc/tianwentai-ui/node_modules/react-smooth/src/AnimateGroup.js 963 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  import React, { Children } from 'react';
  import { TransitionGroup } from 'react-transition-group';
  import PropTypes from 'prop-types';
  import AnimateGroupChild from './AnimateGroupChild';
  
  function AnimateGroup(props) {
    const { component, children, appear, enter, leave } = props;
  
    return (
      <TransitionGroup component={component}>
        {Children.map(children, (child, index) => (
          <AnimateGroupChild
            appearOptions={appear}
            enterOptions={enter}
            leaveOptions={leave}
              key={`child-${index}`} // eslint-disable-line
          >
            {child}
          </AnimateGroupChild>
        ))}
      </TransitionGroup>
    );
  }
  
  AnimateGroup.propTypes = {
    appear: PropTypes.object,
    enter: PropTypes.object,
    leave: PropTypes.object,
    children: PropTypes.oneOfType([PropTypes.array, PropTypes.element]),
    component: PropTypes.any,
  };
  
  AnimateGroup.defaultProps = {
    component: 'span',
  };
  
  export default AnimateGroup;