From e6c33d22573c0e76a4ee81f137be080753f84ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Thu, 18 May 2023 11:33:56 +0800 Subject: [PATCH] chore: patch cls for rtl (#204) --- src/List.tsx | 6 +++++- tests/scroll.test.js | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/List.tsx b/src/List.tsx index 78fd0a9b..6aeb1b68 100644 --- a/src/List.tsx +++ b/src/List.tsx @@ -88,7 +88,11 @@ export function RawList(props: ListProps, ref: React.Ref) { const [scrollTop, setScrollTop] = useState(0); const [scrollMoving, setScrollMoving] = useState(false); - const mergedClassName = classNames(prefixCls, className); + const mergedClassName = classNames( + prefixCls, + { [`${prefixCls}-rtl`]: direction === 'rtl' }, + className, + ); const mergedData = data || EMPTY_DATA; const componentRef = useRef(); const fillerInnerRef = useRef(); diff --git a/tests/scroll.test.js b/tests/scroll.test.js index c708bad3..d29535bb 100644 --- a/tests/scroll.test.js +++ b/tests/scroll.test.js @@ -305,5 +305,7 @@ describe('List.Scroll', () => { ); expect(wrapper.find('.rc-virtual-list-scrollbar').props().style.left).toEqual(0); jest.useRealTimers(); + + expect(wrapper.exists('.rc-virtual-list-rtl')).toBeTruthy(); }); });