From 3e6523ac171442b419eacdb105063d358c2227b9 Mon Sep 17 00:00:00 2001 From: Adam Banko Date: Fri, 10 Jul 2015 17:14:10 +0200 Subject: [PATCH] [added] ListGroup supports iterator as child Fixes #935 --- src/ListGroup.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/ListGroup.js b/src/ListGroup.js index 7301f050a8..30dca37c87 100644 --- a/src/ListGroup.js +++ b/src/ListGroup.js @@ -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; + } });