fixes table clone element when child is null (#1326)

old
Rubén Moya 2017-04-02 14:10:01 +02:00 committed by Javi Velasco
parent f5c11382cb
commit 7231a7cc15
2 changed files with 14 additions and 8 deletions

View File

@ -47,10 +47,13 @@ const factory = (Checkbox, TableCell) => {
onChange={this.handleSelect}
/>}
</TableCell>}
{React.Children.map(children, (child, index) => cloneElement(child, {
column: index,
tagName: 'th',
}))}
{React.Children.map(children, (child, index) => {
if (!child) return null;
return cloneElement(child, {
column: index,
tagName: 'th',
});
})}
</tr>
);
}

View File

@ -36,10 +36,13 @@ const factory = (Checkbox, TableCell) => {
{selectable && <TableCell className={theme.checkboxCell}>
<Checkbox checked={selected} onChange={this.handleSelect} />
</TableCell>}
{React.Children.map(children, (child, index) => cloneElement(child, {
column: index,
tagName: 'td',
}))}
{React.Children.map(children, (child, index) => {
if (!child) return null;
return cloneElement(child, {
column: index,
tagName: 'td',
});
})}
</tr>
);
}