@@ -224,29 +224,26 @@ class Transition extends React.Component {
224224 performEnter ( mounting ) {
225225 const { enter } = this . props
226226 const appearing = this . context ? this . context . isMounting : mounting
227- const [ maybeNode , maybeAppearing ] = this . props . nodeRef
228- ? [ appearing ]
229- : [ ReactDOM . findDOMNode ( this ) , appearing ]
230227
231228 const timeouts = this . getTimeouts ( )
232229 const enterTimeout = appearing ? timeouts . appear : timeouts . enter
233230 // no enter animation skip right to ENTERED
234231 // if we are mounting and running this it means appear _must_ be set
235232 if ( ( ! mounting && ! enter ) || config . disabled ) {
236233 this . safeSetState ( { status : ENTERED } , ( ) => {
237- this . props . onEntered ( maybeNode )
234+ this . props . onEntered ( this . getNode ( ) )
238235 } )
239236 return
240237 }
241238
242- this . props . onEnter ( maybeNode , maybeAppearing )
239+ this . props . onEnter ( this . getNode ( ) , appearing )
243240
244241 this . safeSetState ( { status : ENTERING } , ( ) => {
245- this . props . onEntering ( maybeNode , maybeAppearing )
242+ this . props . onEntering ( this . getNode ( ) , appearing )
246243
247244 this . onTransitionEnd ( enterTimeout , ( ) => {
248245 this . safeSetState ( { status : ENTERED } , ( ) => {
249- this . props . onEntered ( maybeNode , maybeAppearing )
246+ this . props . onEntered ( this . getNode ( ) , appearing )
250247 } )
251248 } )
252249 } )
@@ -255,26 +252,23 @@ class Transition extends React.Component {
255252 performExit ( ) {
256253 const { exit } = this . props
257254 const timeouts = this . getTimeouts ( )
258- const maybeNode = this . props . nodeRef
259- ? undefined
260- : ReactDOM . findDOMNode ( this )
261255
262256 // no exit animation skip right to EXITED
263257 if ( ! exit || config . disabled ) {
264258 this . safeSetState ( { status : EXITED } , ( ) => {
265- this . props . onExited ( maybeNode )
259+ this . props . onExited ( this . getNode ( ) )
266260 } )
267261 return
268262 }
269263
270- this . props . onExit ( maybeNode )
264+ this . props . onExit ( this . getNode ( ) )
271265
272266 this . safeSetState ( { status : EXITING } , ( ) => {
273- this . props . onExiting ( maybeNode )
267+ this . props . onExiting ( this . getNode ( ) )
274268
275269 this . onTransitionEnd ( timeouts . exit , ( ) => {
276270 this . safeSetState ( { status : EXITED } , ( ) => {
277- this . props . onExited ( maybeNode )
271+ this . props . onExited ( this . getNode ( ) )
278272 } )
279273 } )
280274 } )
@@ -316,9 +310,7 @@ class Transition extends React.Component {
316310
317311 onTransitionEnd ( timeout , handler ) {
318312 this . setNextCallback ( handler )
319- const node = this . props . nodeRef
320- ? this . props . nodeRef . current
321- : ReactDOM . findDOMNode ( this )
313+ const node = this . getNode ( )
322314
323315 const doesNotHaveTimeoutOrListener =
324316 timeout == null && ! this . props . addEndListener
@@ -328,17 +320,20 @@ class Transition extends React.Component {
328320 }
329321
330322 if ( this . props . addEndListener ) {
331- const [ maybeNode , maybeNextCallback ] = this . props . nodeRef
332- ? [ this . nextCallback ]
333- : [ node , this . nextCallback ]
334- this . props . addEndListener ( maybeNode , maybeNextCallback )
323+ this . props . addEndListener ( node , this . nextCallback )
335324 }
336325
337326 if ( timeout != null ) {
338327 setTimeout ( this . nextCallback , timeout )
339328 }
340329 }
341330
331+ getNode ( ) {
332+ return this . props . nodeRef
333+ ? this . props . nodeRef . current
334+ : ReactDOM . findDOMNode ( this ) ;
335+ }
336+
342337 render ( ) {
343338 const status = this . state . status
344339
0 commit comments