Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"./lib/dist/react-transition-group.js": {
"bundled": 80859,
"minified": 22686,
"gzipped": 6939
"bundled": 82017,
"minified": 22806,
"gzipped": 7001
},
"./lib/dist/react-transition-group.min.js": {
"bundled": 46875,
"minified": 15056,
"gzipped": 4715
"bundled": 47393,
"minified": 15176,
"gzipped": 4768
}
}
20 changes: 13 additions & 7 deletions src/Transition.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as PropTypes from 'prop-types'
import React from 'react'
import ReactDOM from 'react-dom'
import { polyfill } from 'react-lifecycles-compat'

import { timeoutsShape } from './utils/PropTypes'
Expand Down Expand Up @@ -140,6 +139,10 @@ class Transition extends React.Component {
this.nextCallback = null
}

setChildNode = node => {
this.childNode = node
}

getChildContext() {
return { transitionGroup: null } // allows for nested Transitions
}
Expand Down Expand Up @@ -216,12 +219,13 @@ class Transition extends React.Component {
if (nextStatus !== null) {
// nextStatus will always be ENTERING or EXITING.
this.cancelNextCallback()
const node = ReactDOM.findDOMNode(this)

if (nextStatus === ENTERING) {
this.performEnter(node, mounting)
} else {
this.performExit(node)
const node = this.childNode
if (node) {
if (nextStatus === ENTERING) {
this.performEnter(node, mounting)
} else {
this.performExit(node)
}
}
} else if (this.props.unmountOnExit && this.state.status === EXITED) {
this.setState({ status: UNMOUNTED })
Expand Down Expand Up @@ -357,6 +361,8 @@ class Transition extends React.Component {
delete childProps.onExiting
delete childProps.onExited

childProps.ref = this.setChildNode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will override the ref that is attached to child.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what about user component? Example

class Button extends React.Component {}

ref returned Symbol but not Element


if (typeof children === 'function') {
return children(status, childProps)
}
Expand Down