Skip to content

Commit

Permalink
Add transition status param to addEndListener
Browse files Browse the repository at this point in the history
if (node) clause is removed because it's not necessary a single concrete node
  • Loading branch information
mvasin committed Aug 13, 2018
1 parent 16ab2cc commit 512411b
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/Transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class Transition extends React.Component {
this.safeSetState({ status: ENTERED }, () => {
this.props.onEntered(node, appearing)
})
})
}, ENTERING)
})
}

Expand All @@ -284,7 +284,7 @@ class Transition extends React.Component {
this.safeSetState({ status: EXITED }, () => {
this.props.onExited(node)
})
})
}, EXITING)
})
}

Expand Down Expand Up @@ -322,18 +322,14 @@ class Transition extends React.Component {
return this.nextCallback
}

onTransitionEnd(node, timeout, handler) {
onTransitionEnd(node, timeout, handler, status) {
this.setNextCallback(handler)

if (node) {
if (this.props.addEndListener) {
this.props.addEndListener(node, this.nextCallback)
}
if (timeout != null) {
setTimeout(this.nextCallback, timeout)
}
} else {
setTimeout(this.nextCallback, 0)
if (this.props.addEndListener) {
this.props.addEndListener(node, this.nextCallback, status)
}
if (timeout != null) {
setTimeout(this.nextCallback, timeout)
}
}

Expand Down

0 comments on commit 512411b

Please sign in to comment.