Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Collapse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ const Collapse = React.createClass({
getItems() {
const activeKey = this.state.activeKey;
const { prefixCls, accordion } = this.props;
return Children.map(this.props.children, (child, index) => {
const newChildren = [];

Children.forEach(this.props.children, (child, index) => {
if (!child) return;
// If there is no key provide, use the panel order as default key
const key = child.key || String(index);
const header = child.props.header;
Expand All @@ -112,8 +115,10 @@ const Collapse = React.createClass({
onItemClick: this.onClickItem(key).bind(this),
};

return React.cloneElement(child, props);
newChildren.push(React.cloneElement(child, props));
});

return newChildren;
},

setActiveKey(activeKey) {
Expand Down