Skip to content

Commit

Permalink
Merge pull request react-bootstrap#998 from taion/cassus-iterable-in-…
Browse files Browse the repository at this point in the history
…ListGroup

[added] ListGroup supports iterator as child
  • Loading branch information
taion committed Jul 17, 2015
2 parents 3a24be2 + 3e6523a commit f0d65c1
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/ListGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@ class ListGroup extends React.Component {

if (!this.props.children) {
return this.renderDiv(items);
} else if (React.Children.count(this.props.children) === 1 && !Array.isArray(this.props.children)) {
let child = this.props.children;

childrenAnchors = this.isAnchor(child.props);

} else {

childrenAnchors = Array.prototype.some.call(this.props.children, (child) => {
return !Array.isArray(child) ? this.isAnchor(child.props) : Array.prototype.some.call(child, (subChild) => {
return this.isAnchor(subChild.props);
});
React.Children.forEach(this.props.children, (child) => {
if (this.isAnchor(child.props)) {
childrenAnchors = true;
}

});

Expand Down

0 comments on commit f0d65c1

Please sign in to comment.