Skip to content

Commit 05069bd

Browse files
committed
Revert the getChildMapping change since detecting nulls can't work.
1 parent cd82460 commit 05069bd

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/ReactCSSTransitionReplace.jsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ import { nameShape } from './utils/PropTypes'
2020
const reactCSSTransitionReplaceChild = React.createFactory(ReactCSSTransitionReplaceChild)
2121

2222

23-
// Filter out nulls before looking for an only child
24-
function getChildMapping(children) {
25-
if (!Array.isArray(children)) {
26-
return children
27-
}
28-
const childArray = React.Children.toArray(children).filter(c => c)
29-
return childArray.length === 1 ? childArray[0] : React.Children.only(childArray)
30-
}
31-
32-
3323
export default class ReactCSSTransitionReplace extends React.Component {
3424

3525
static displayName = 'ReactCSSTransitionReplace'
@@ -64,7 +54,7 @@ export default class ReactCSSTransitionReplace extends React.Component {
6454

6555
this.state = {
6656
currentKey: '1',
67-
currentChild: getChildMapping(this.props.children),
57+
currentChild: this.props.children ? React.Children.only(this.props.children) : undefined,
6858
prevChildren: {},
6959
height: null,
7060
}
@@ -87,7 +77,7 @@ export default class ReactCSSTransitionReplace extends React.Component {
8777
}
8878

8979
componentWillReceiveProps(nextProps) {
90-
const nextChild = getChildMapping(nextProps.children)
80+
const nextChild = nextProps.children ? React.Children.only(nextProps.children) : undefined
9181
const {currentChild} = this.state
9282

9383
if ((!currentChild && !nextChild) || (currentChild && nextChild && currentChild.key === nextChild.key)) {

0 commit comments

Comments
 (0)