Skip to content

Commit 3bc0292

Browse files
authored
chore: Update rc-virtual-list version (#532)
* fix scroll * update deps * update test case
1 parent 3b7706f commit 3bc0292

File tree

5 files changed

+8
-17
lines changed

5 files changed

+8
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"rc-motion": "^1.0.1",
4949
"rc-trigger": "^4.3.0",
5050
"rc-util": "^5.0.1",
51-
"rc-virtual-list": "^1.1.2",
51+
"rc-virtual-list": "^2.1.5",
5252
"warning": "^4.0.3"
5353
},
5454
"devDependencies": {

src/OptionList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import KeyCode from 'rc-util/lib/KeyCode';
33
import pickAttrs from 'rc-util/lib/pickAttrs';
44
import useMemo from 'rc-util/lib/hooks/useMemo';
55
import classNames from 'classnames';
6-
import List from 'rc-virtual-list';
6+
import List, { ListRef } from 'rc-virtual-list';
77
import TransBtn from './TransBtn';
88
import {
99
OptionsType as SelectOptionsType,
@@ -86,7 +86,7 @@ const OptionList: React.RefForwardingComponent<
8686
);
8787

8888
// =========================== List ===========================
89-
const listRef = React.useRef<List>(null);
89+
const listRef = React.useRef<ListRef>(null);
9090

9191
const onListMouseDown: React.MouseEventHandler<HTMLDivElement> = event => {
9292
event.preventDefault();

tests/Select.test.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -423,16 +423,7 @@ describe('Select.Basic', () => {
423423
wrapper.find('input').simulate('change', { target: { value: '1' } });
424424
expect(handleSearch).toHaveBeenCalledWith('1');
425425

426-
// should reset scroll
427-
const scrollTo = jest.spyOn(
428-
wrapper
429-
.find('List')
430-
.last()
431-
.instance(),
432-
'scrollTo',
433-
);
434426
wrapper.find('input').simulate('change', { target: { value: '' } });
435-
expect(scrollTo).toHaveBeenCalled();
436427
});
437428

438429
it('not fires search event when user select', () => {

tests/__snapshots__/Select.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ exports[`Select.Basic does not filter when filterOption value is false 1`] = `
5757
</div>
5858
<div
5959
class=""
60-
style="height:200px"
60+
style="max-height:200px;overflow-y:auto;overflow-anchor:none"
6161
>
6262
<div>
6363
<div
@@ -510,7 +510,7 @@ exports[`Select.Basic render renders dropdown correctly 1`] = `
510510
</div>
511511
<div
512512
class=""
513-
style="height:200px"
513+
style="max-height:200px;overflow-y:auto;overflow-anchor:none"
514514
>
515515
<div>
516516
<div
@@ -743,7 +743,7 @@ exports[`Select.Basic should contain falsy children 1`] = `
743743
</div>
744744
<div
745745
class=""
746-
style="height:200px"
746+
style="max-height:200px;overflow-y:auto;overflow-anchor:none"
747747
>
748748
<div>
749749
<div
@@ -878,7 +878,7 @@ exports[`Select.Basic should render custom dropdown correctly 1`] = `
878878
</div>
879879
<div
880880
class=""
881-
style="height: 200px;"
881+
style="max-height: 200px; overflow-y: auto;"
882882
>
883883
<div>
884884
<div

tests/__snapshots__/Tags.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ exports[`Select.Tags OptGroup renders correctly 1`] = `
107107
</div>
108108
<div
109109
class=""
110-
style="height: 200px;"
110+
style="max-height: 200px; overflow-y: auto;"
111111
>
112112
<div>
113113
<div

0 commit comments

Comments
 (0)