Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "rc-table",
"version": "7.0.0-alpha.21",
"description": "table ui component for react",
"engines": {
"node": "12.x"
},
"keywords": [
"react",
"react-table",
Expand Down
6 changes: 5 additions & 1 deletion src/Cell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ function Cell<RecordType extends DefaultRecordType>(
}

// Not crash if final `childNode` is not validate ReactNode
if (typeof childNode === 'object' && !React.isValidElement(childNode)) {
if (
typeof childNode === 'object' &&
!Array.isArray(childNode) &&
!React.isValidElement(childNode)
) {
childNode = null;
}

Expand Down
10 changes: 10 additions & 0 deletions tests/Table.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,4 +719,14 @@ describe('Table.Basic', () => {
expect(internalRefs.body.current instanceof HTMLDivElement).toBeTruthy();
});
});

it('column render array', () => {
const wrapper = mount(
<Table
columns={[{ dataIndex: 'test', render: () => [<span className="test" key="test" />] }]}
data={[{ key: 1 }]}
/>,
);
expect(wrapper.find('.test')).toHaveLength(1);
});
});