diff --git a/src/List.tsx b/src/List.tsx index 88c1a73..5688261 100644 --- a/src/List.tsx +++ b/src/List.tsx @@ -308,8 +308,6 @@ export function RawList(props: ListProps, ref: React.Ref) { const getVirtualScrollInfo = () => ({ x: isRTL ? -offsetLeft : offsetLeft, y: offsetTop, - maxScrollWidth: !!scrollWidth ? scrollWidth - size.width : 0, - maxScrollHeight: scrollHeight > height ? maxScrollHeight : 0, }); const lastVirtualScrollInfoRef = useRef(getVirtualScrollInfo()); diff --git a/tests/scrollWidth.test.tsx b/tests/scrollWidth.test.tsx index 4f06693..7a5db3b 100644 --- a/tests/scrollWidth.test.tsx +++ b/tests/scrollWidth.test.tsx @@ -132,8 +132,8 @@ describe('List.scrollWidth', () => { width: '20px', }); - expect(onVirtualScroll).toHaveBeenCalledWith({ x: 900, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 }); - expect(listRef.current.getScrollInfo()).toEqual({ x: 900, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 }); + expect(onVirtualScroll).toHaveBeenCalledWith({ x: 900, y: 0 }); + expect(listRef.current.getScrollInfo()).toEqual({ x: 900, y: 0 }); }); it('wheel', async () => { @@ -151,7 +151,7 @@ describe('List.scrollWidth', () => { fireEvent.wheel(container.querySelector('.rc-virtual-list-holder')!, { deltaX: 123, }); - expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 }); + expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0 }); }); it('trigger event when less count', async () => { @@ -169,7 +169,7 @@ describe('List.scrollWidth', () => { fireEvent.wheel(container.querySelector('.rc-virtual-list-holder')!, { deltaX: 123, }); - expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0, maxScrollWidth: 900, maxScrollHeight: 0 }); + expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0 }); }); it('shift wheel', async () => { @@ -188,7 +188,7 @@ describe('List.scrollWidth', () => { deltaY: 123, shiftKey: true, }); - expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 }); + expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0 }); }); }); @@ -204,10 +204,10 @@ describe('List.scrollWidth', () => { }); listRef.current.scrollTo({ left: 135 }); - expect(listRef.current.getScrollInfo()).toEqual({ x: 135, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 }); + expect(listRef.current.getScrollInfo()).toEqual({ x: 135, y: 0 }); listRef.current.scrollTo({ left: -99 }); - expect(listRef.current.getScrollInfo()).toEqual({ x: 0, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 }); + expect(listRef.current.getScrollInfo()).toEqual({ x: 0, y: 0 }); }); it('support extraRender', async () => {