Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81155 views
1
/**
2
* Copyright 2013-2014, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @typechecks
10
* @providesModule ReactCSSTransitionGroup
11
*/
12
13
"use strict";
14
15
var React = require('React');
16
17
var assign = require('Object.assign');
18
19
var ReactTransitionGroup = React.createFactory(
20
require('ReactTransitionGroup')
21
);
22
var ReactCSSTransitionGroupChild = React.createFactory(
23
require('ReactCSSTransitionGroupChild')
24
);
25
26
var ReactCSSTransitionGroup = React.createClass({
27
displayName: 'ReactCSSTransitionGroup',
28
29
propTypes: {
30
transitionName: React.PropTypes.string.isRequired,
31
transitionEnter: React.PropTypes.bool,
32
transitionLeave: React.PropTypes.bool
33
},
34
35
getDefaultProps: function() {
36
return {
37
transitionEnter: true,
38
transitionLeave: true
39
};
40
},
41
42
_wrapChild: function(child) {
43
// We need to provide this childFactory so that
44
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
45
// leave while it is leaving.
46
return ReactCSSTransitionGroupChild(
47
{
48
name: this.props.transitionName,
49
enter: this.props.transitionEnter,
50
leave: this.props.transitionLeave
51
},
52
child
53
);
54
},
55
56
render: function() {
57
return (
58
ReactTransitionGroup(
59
assign({}, this.props, {childFactory: this._wrapChild})
60
)
61
);
62
}
63
});
64
65
module.exports = ReactCSSTransitionGroup;
66
67