@@ -341,42 +341,38 @@ class Transition extends React.Component {
341341
342342 render ( ) {
343343 const status = this . state . status
344+
344345 if ( status === UNMOUNTED ) {
345346 return null
346347 }
347348
348- const { children, ...childProps } = this . props
349- // filter props for Transtition
350- delete childProps . in
351- delete childProps . mountOnEnter
352- delete childProps . unmountOnExit
353- delete childProps . appear
354- delete childProps . enter
355- delete childProps . exit
356- delete childProps . timeout
357- delete childProps . addEndListener
358- delete childProps . onEnter
359- delete childProps . onEntering
360- delete childProps . onEntered
361- delete childProps . onExit
362- delete childProps . onExiting
363- delete childProps . onExited
364- delete childProps . nodeRef
365-
366- if ( typeof children === 'function' ) {
367- // allows for nested Transitions
368- return (
369- < TransitionGroupContext . Provider value = { null } >
370- { children ( status , childProps ) }
371- </ TransitionGroupContext . Provider >
372- )
373- }
349+ const {
350+ children,
351+ // filter props for `Transition`
352+ in : _in ,
353+ mountOnEnter : _mountOnEnter ,
354+ unmountOnExit : _unmountOnExit ,
355+ appear : _appear ,
356+ enter : _enter ,
357+ exit : _exit ,
358+ timeout : _timeout ,
359+ addEndListener : _addEndListener ,
360+ onEnter : _onEnter ,
361+ onEntering : _onEntering ,
362+ onEntered : _onEntered ,
363+ onExit : _onExit ,
364+ onExiting : _onExiting ,
365+ onExited : _onExited ,
366+ nodeRef : _nodeRef ,
367+ ...childProps
368+ } = this . props
374369
375- const child = React . Children . only ( children )
376370 return (
377371 // allows for nested Transitions
378372 < TransitionGroupContext . Provider value = { null } >
379- { React . cloneElement ( child , childProps ) }
373+ { typeof children === 'function'
374+ ? children ( status , childProps )
375+ : React . cloneElement ( React . Children . only ( children ) , childProps ) }
380376 </ TransitionGroupContext . Provider >
381377 )
382378 }
0 commit comments