diff --git a/src/hooks/useColumns.tsx b/src/hooks/useColumns.tsx index e59d785e7..891a5a2fd 100644 --- a/src/hooks/useColumns.tsx +++ b/src/hooks/useColumns.tsx @@ -257,7 +257,7 @@ function useColumns( }, [mergedColumns, direction]); // Only check out of production since it's waste for each render if (process.env.NODE_ENV !== 'production') { - warningFixed(flattenColumns); + warningFixed(direction === 'rtl' ? flattenColumns.slice().reverse() : flattenColumns); } return [mergedColumns, flattenColumns]; } diff --git a/tests/FixedColumn.spec.js b/tests/FixedColumn.spec.js index 11078100e..88869c546 100644 --- a/tests/FixedColumn.spec.js +++ b/tests/FixedColumn.spec.js @@ -191,6 +191,11 @@ describe('Table.FixedColumn', () => { "Warning: Index 2 of `columns` missing `fixed='right'` prop.", ); }); + + it('RTL', () => { + mount(); + expect(errorSpy).not.toHaveBeenCalled(); + }); }); it('ellipsis will wrap additional dom', () => { @@ -207,6 +212,7 @@ describe('Table.FixedColumn', () => { ); expect(wrapper.render()).toMatchSnapshot(); }); + it('has correct scroll classNames when table direction is RTL', () => { const wrapper = mount(
);