Skip to content

Commit

Permalink
toolbar: fix for empty toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
cgestes committed May 20, 2015
1 parent 2f1d412 commit 87e895e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/toolbar/toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ var Toolbar = React.createClass({

render: function() {

var firstChild = this.props.children[0];
var lastChild = this.props.children[this.props.children.length - 1];
if (firstChild.type.displayName === 'ToolbarGroup') firstChild = React.cloneElement(firstChild, {firstChild: true});
if (lastChild.type.displayName === 'ToolbarGroup') lastChild = React.cloneElement(lastChild, {lastChild: true});

if (React.Children.count > 0) {
var firstChild = this.props.children[0];
var lastChild = this.props.children[this.props.children.length - 1];
if (firstChild.type.displayName === 'ToolbarGroup') firstChild = React.cloneElement(firstChild, {firstChild: true});
if (lastChild.type.displayName === 'ToolbarGroup') lastChild = React.cloneElement(lastChild, {lastChild: true});
}
return (
<div className={this.props.className} style={this.getStyles()}>
{this.props.children}
Expand Down

0 comments on commit 87e895e

Please sign in to comment.