From 74f6d72d91db9e6ae0fc9388a9a5a4edf4817e63 Mon Sep 17 00:00:00 2001 From: zombiej Date: Tue, 7 Jan 2020 19:34:29 +0800 Subject: [PATCH 1/2] fix: Table column render with array --- src/Cell/index.tsx | 6 +++++- tests/Table.spec.js | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Cell/index.tsx b/src/Cell/index.tsx index b900600f6..889d91629 100644 --- a/src/Cell/index.tsx +++ b/src/Cell/index.tsx @@ -102,7 +102,11 @@ function Cell( } // 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; } diff --git a/tests/Table.spec.js b/tests/Table.spec.js index 68c2a6071..ed5b14ca3 100644 --- a/tests/Table.spec.js +++ b/tests/Table.spec.js @@ -719,4 +719,14 @@ describe('Table.Basic', () => { expect(internalRefs.body.current instanceof HTMLDivElement).toBeTruthy(); }); }); + + it('column render array', () => { + const wrapper = mount( + [] }]} + data={[{ key: 1 }]} + />, + ); + expect(wrapper.find('.test')).toHaveLength(1); + }); }); From f942988424caf33efce6ab7a159787d09ac013e0 Mon Sep 17 00:00:00 2001 From: zombiej Date: Tue, 7 Jan 2020 19:38:34 +0800 Subject: [PATCH 2/2] fix now --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 1a8863191..c8fc8f38f 100644 --- a/package.json +++ b/package.json @@ -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",