mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 01:13:58 +08:00
fix: should work in old version react (#19262)
* fix: should work in old version react * update ci config * add version log
This commit is contained in:
parent
d6c5e5358e
commit
0f83e0a4ee
@ -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
|
||||
|
@ -239,11 +239,10 @@ class Table<T> extends React.Component<TableProps<T>, TableState<T>> {
|
||||
|
||||
row: React.ComponentType<any>;
|
||||
|
||||
rcTable: React.RefObject<any>;
|
||||
rcTable: any;
|
||||
|
||||
constructor(props: TableProps<T>) {
|
||||
super(props);
|
||||
this.rcTable = React.createRef();
|
||||
|
||||
const { expandedRowRender, columns: columnsProp = [] } = props;
|
||||
|
||||
@ -286,6 +285,10 @@ class Table<T> extends React.Component<TableProps<T>, TableState<T>> {
|
||||
}
|
||||
}
|
||||
|
||||
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<T> extends React.Component<TableProps<T>, TableState<T>> {
|
||||
|
||||
generatePopupContainerFunc = (getPopupContainer: TableProps<T>['getPopupContainer']) => {
|
||||
const { scroll } = this.props;
|
||||
const table = this.rcTable.current;
|
||||
const table = this.rcTable;
|
||||
if (getPopupContainer) {
|
||||
return getPopupContainer;
|
||||
}
|
||||
@ -547,7 +550,7 @@ class Table<T> extends React.Component<TableProps<T>, TableState<T>> {
|
||||
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<T> extends React.Component<TableProps<T>, TableState<T>> {
|
||||
|
||||
return (
|
||||
<RcTable
|
||||
ref={this.rcTable}
|
||||
ref={this.setTableRef}
|
||||
key="table"
|
||||
expandIcon={this.renderExpandIcon(prefixCls)}
|
||||
{...restProps}
|
||||
|
@ -1,3 +1,7 @@
|
||||
const React = require('react');
|
||||
|
||||
console.log('Current React Version:', React.version);
|
||||
|
||||
/* eslint-disable global-require */
|
||||
if (typeof window !== 'undefined') {
|
||||
global.window.resizeTo = (width, height) => {
|
||||
|
Loading…
Reference in New Issue
Block a user