Skip to content

Commit 3eeb346

Browse files
committed
Remove element at once when transitonLeave is false
Previously transitionLeave being false did not affect the behavior and in dom the old component still existed together with the new component. This does not show old component at all when new component is ready to be rendered.
1 parent 1dae9fe commit 3eeb346

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ReactCSSTransitionReplace.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export default class ReactCSSTransitionReplace extends React.Component {
133133
if (!this.isTransitioning && !this.state.isLeaving) {
134134
const {currentChild, nextChild } = this.state
135135

136-
if (currentChild && (nextChild || nextChild === false || nextChild === null)) {
136+
if (currentChild && (nextChild || nextChild === false || nextChild === null) && this.props.transitionLeave) {
137137
this.leaveCurrent()
138138
}
139139
if (nextChild) {
@@ -263,7 +263,7 @@ export default class ReactCSSTransitionReplace extends React.Component {
263263
...containerProps,
264264
} = this.props
265265

266-
if (currentChild) {
266+
if (currentChild && !nextChild && !transitionLeave || currentChild && transitionLeave) {
267267
childrenToRender.push(
268268
React.createElement(
269269
'span',

0 commit comments

Comments
 (0)