Skip to content

Commit 84f951a

Browse files
committed
Only call findDOMNode if necessary
1 parent f887c43 commit 84f951a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Transition.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class Transition extends React.Component {
209209
if (nextStatus !== null) {
210210
// nextStatus will always be ENTERING or EXITING.
211211
this.cancelNextCallback()
212-
const node = ReactDOM.findDOMNode(this)
212+
const node = this.needsNode() ? ReactDOM.findDOMNode(this) : null;
213213

214214
if (nextStatus === ENTERING) {
215215
this.performEnter(node, mounting)
@@ -327,6 +327,19 @@ class Transition extends React.Component {
327327
}
328328
}
329329

330+
needsNode() {
331+
return [
332+
'addEndListener',
333+
'onEnter',
334+
'onEntering',
335+
'onEntered',
336+
'onExit'
337+
].some(callbackName => {
338+
const callback = this.props[callbackName];
339+
return callback && callback.length > 0
340+
})
341+
}
342+
330343
render() {
331344
const status = this.state.status
332345
if (status === UNMOUNTED) {

0 commit comments

Comments
 (0)