Skip to content

Commit

Permalink
[added] ListGroup supports iterator as child
Browse files Browse the repository at this point in the history
  • Loading branch information
cassus authored and Jimmy Jia committed Jul 17, 2015
1 parent 3a24be2 commit 3e6523a
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 3e6523a

Please sign in to comment.