fixes table clone element when child is null (#1326)
parent
f5c11382cb
commit
7231a7cc15
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue