diff --git a/.circleci/config.yml b/.circleci/config.yml index a280fde28d..b3a0b805bf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -184,6 +184,7 @@ jobs: command: npm test -- -w 1 -u environment: LIB_DIR: dist + REACT: 15 test_lib_15: <<: *container_config @@ -196,6 +197,7 @@ jobs: command: npm test -- -w 1 -u environment: LIB_DIR: lib + REACT: 15 test_es_15: <<: *container_config @@ -208,6 +210,7 @@ jobs: command: npm test -- -w 1 -u environment: LIB_DIR: es + REACT: 15 test_dom_15: <<: *container_config @@ -216,7 +219,10 @@ jobs: - checkout - *attach_workspace - *install_react - - run: npm test -- -w 1 -u + - run: + command: npm test -- -w 1 -u + environment: + REACT: 15 test_node_15: <<: *container_config @@ -225,7 +231,10 @@ jobs: - checkout - *attach_workspace - *install_react - - run: npm run test-node -- -w 1 -u + - run: + command: npm run test-node -- -w 1 -u + environment: + REACT: 15 check_metadata: <<: *container_config diff --git a/components/table/Table.tsx b/components/table/Table.tsx index b03d238dbe..5a15e011cb 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -239,11 +239,10 @@ class Table extends React.Component, TableState> { row: React.ComponentType; - rcTable: React.RefObject; + rcTable: any; constructor(props: TableProps) { super(props); - this.rcTable = React.createRef(); const { expandedRowRender, columns: columnsProp = [] } = props; @@ -286,6 +285,10 @@ class Table extends React.Component, TableState> { } } + setTableRef = (table: any) => { + this.rcTable = table; + }; + getCheckboxPropsByItem = (item: T, index: number) => { const rowSelection = getRowSelection(this.props); if (!rowSelection.getCheckboxProps) { @@ -535,7 +538,7 @@ class Table extends React.Component, TableState> { generatePopupContainerFunc = (getPopupContainer: TableProps['getPopupContainer']) => { const { scroll } = this.props; - const table = this.rcTable.current; + const table = this.rcTable; if (getPopupContainer) { return getPopupContainer; } @@ -547,7 +550,7 @@ class Table extends React.Component, TableState> { const { scroll } = this.props; if (scroll && scroll.scrollToFirstRowOnChange !== false) { scrollTo(0, { - getContainer: () => this.rcTable.current.bodyTable, + getContainer: () => this.rcTable.bodyTable, }); } }; @@ -1285,7 +1288,7 @@ class Table extends React.Component, TableState> { return ( {