From ca3faf5c4f63535919a7dedabed3b21f8d6bfde1 Mon Sep 17 00:00:00 2001 From: Egor Komarov Date: Mon, 26 Jun 2017 14:11:41 +0300 Subject: [PATCH] Add ability to change container component --- src/ReactCSSTransitionReplace.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ReactCSSTransitionReplace.jsx b/src/ReactCSSTransitionReplace.jsx index ea9ea59..d3b0930 100644 --- a/src/ReactCSSTransitionReplace.jsx +++ b/src/ReactCSSTransitionReplace.jsx @@ -66,6 +66,7 @@ export default class ReactCSSTransitionReplace extends React.Component { transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave'), overflowHidden: PropTypes.bool, changeWidth: PropTypes.bool, + component: PropTypes.string } static defaultProps = { @@ -281,7 +282,7 @@ export default class ReactCSSTransitionReplace extends React.Component { if (currentChild && !nextChild && !transitionLeave || currentChild && transitionLeave) { childrenToRender.push( React.createElement( - 'span', + component, {key: currentChildKey}, this._wrapChild( typeof currentChild.type == 'string' ? currentChild : React.cloneElement(currentChild, {isLeaving}), @@ -322,7 +323,8 @@ export default class ReactCSSTransitionReplace extends React.Component { if (nextChild) { childrenToRender.push( - React.createElement('span', + React.createElement( + component, { style: { position: 'absolute',