react / react-0.13.3 / examples / basic-commonjs / node_modules / reactify / node_modules / react-tools / src / addons / transitions / ReactCSSTransitionGroup.js
81155 views/**1* Copyright 2013-2014, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @typechecks9* @providesModule ReactCSSTransitionGroup10*/1112"use strict";1314var React = require('React');1516var assign = require('Object.assign');1718var ReactTransitionGroup = React.createFactory(19require('ReactTransitionGroup')20);21var ReactCSSTransitionGroupChild = React.createFactory(22require('ReactCSSTransitionGroupChild')23);2425var ReactCSSTransitionGroup = React.createClass({26displayName: 'ReactCSSTransitionGroup',2728propTypes: {29transitionName: React.PropTypes.string.isRequired,30transitionEnter: React.PropTypes.bool,31transitionLeave: React.PropTypes.bool32},3334getDefaultProps: function() {35return {36transitionEnter: true,37transitionLeave: true38};39},4041_wrapChild: function(child) {42// We need to provide this childFactory so that43// ReactCSSTransitionGroupChild can receive updates to name, enter, and44// leave while it is leaving.45return ReactCSSTransitionGroupChild(46{47name: this.props.transitionName,48enter: this.props.transitionEnter,49leave: this.props.transitionLeave50},51child52);53},5455render: function() {56return (57ReactTransitionGroup(58assign({}, this.props, {childFactory: this._wrapChild})59)60);61}62});6364module.exports = ReactCSSTransitionGroup;656667