Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80517 views
1
/**
2
* Copyright 2013-2015, 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
transitionAppear: React.PropTypes.bool,
32
transitionEnter: React.PropTypes.bool,
33
transitionLeave: React.PropTypes.bool
34
},
35
36
getDefaultProps: function() {
37
return {
38
transitionAppear: false,
39
transitionEnter: true,
40
transitionLeave: true
41
};
42
},
43
44
_wrapChild: function(child) {
45
// We need to provide this childFactory so that
46
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
47
// leave while it is leaving.
48
return ReactCSSTransitionGroupChild(
49
{
50
name: this.props.transitionName,
51
appear: this.props.transitionAppear,
52
enter: this.props.transitionEnter,
53
leave: this.props.transitionLeave
54
},
55
child
56
);
57
},
58
59
render: function() {
60
return (
61
ReactTransitionGroup(
62
assign({}, this.props, {childFactory: this._wrapChild})
63
)
64
);
65
}
66
});
67
68
module.exports = ReactCSSTransitionGroup;
69
70