diff --git a/src/SplitPane.js b/src/SplitPane.js index feb44a9d..7add08e1 100644 --- a/src/SplitPane.js +++ b/src/SplitPane.js @@ -36,6 +36,9 @@ function getDefaultSize(defaultSize, minSize, maxSize, draggedSize) { return minSize; } +function removeNullChildren(children) { + return React.Children.toArray(children).filter(c => c); +} class SplitPane extends React.Component { constructor(props) { super(props); @@ -292,6 +295,8 @@ class SplitPane extends React.Component { ? `${resizerClassName} ${RESIZER_DEFAULT_CLASSNAME}` : resizerClassName; + const notNullChildren = removeNullChildren(children); + const style = Object.assign( {}, { @@ -354,7 +359,7 @@ class SplitPane extends React.Component { split={split} style={pane1Style} > - {children[0]} + {notNullChildren[0]} - {children[1]} + {notNullChildren[1]} );