Skip to content

Commit 9f61b25

Browse files
authored
chore: remove maxScrollWidth and maxScrollHeight (#264)
1 parent 34ec0e7 commit 9f61b25

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/List.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,6 @@ export function RawList<T>(props: ListProps<T>, ref: React.Ref<ListRef>) {
308308
const getVirtualScrollInfo = () => ({
309309
x: isRTL ? -offsetLeft : offsetLeft,
310310
y: offsetTop,
311-
maxScrollWidth: !!scrollWidth ? scrollWidth - size.width : 0,
312-
maxScrollHeight: scrollHeight > height ? maxScrollHeight : 0,
313311
});
314312

315313
const lastVirtualScrollInfoRef = useRef(getVirtualScrollInfo());

tests/scrollWidth.test.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ describe('List.scrollWidth', () => {
132132
width: '20px',
133133
});
134134

135-
expect(onVirtualScroll).toHaveBeenCalledWith({ x: 900, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 });
136-
expect(listRef.current.getScrollInfo()).toEqual({ x: 900, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 });
135+
expect(onVirtualScroll).toHaveBeenCalledWith({ x: 900, y: 0 });
136+
expect(listRef.current.getScrollInfo()).toEqual({ x: 900, y: 0 });
137137
});
138138

139139
it('wheel', async () => {
@@ -151,7 +151,7 @@ describe('List.scrollWidth', () => {
151151
fireEvent.wheel(container.querySelector('.rc-virtual-list-holder')!, {
152152
deltaX: 123,
153153
});
154-
expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 });
154+
expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0 });
155155
});
156156

157157
it('trigger event when less count', async () => {
@@ -169,7 +169,7 @@ describe('List.scrollWidth', () => {
169169
fireEvent.wheel(container.querySelector('.rc-virtual-list-holder')!, {
170170
deltaX: 123,
171171
});
172-
expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0, maxScrollWidth: 900, maxScrollHeight: 0 });
172+
expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0 });
173173
});
174174

175175
it('shift wheel', async () => {
@@ -188,7 +188,7 @@ describe('List.scrollWidth', () => {
188188
deltaY: 123,
189189
shiftKey: true,
190190
});
191-
expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 });
191+
expect(onVirtualScroll).toHaveBeenCalledWith({ x: 123, y: 0 });
192192
});
193193
});
194194

@@ -204,10 +204,10 @@ describe('List.scrollWidth', () => {
204204
});
205205

206206
listRef.current.scrollTo({ left: 135 });
207-
expect(listRef.current.getScrollInfo()).toEqual({ x: 135, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 });
207+
expect(listRef.current.getScrollInfo()).toEqual({ x: 135, y: 0 });
208208

209209
listRef.current.scrollTo({ left: -99 });
210-
expect(listRef.current.getScrollInfo()).toEqual({ x: 0, y: 0, maxScrollWidth: 900, maxScrollHeight: 1900 });
210+
expect(listRef.current.getScrollInfo()).toEqual({ x: 0, y: 0 });
211211
});
212212

213213
it('support extraRender', async () => {

0 commit comments

Comments
 (0)