Skip to content

Commit d9a1911

Browse files
committed
chore: Make scrollTo as arrow function to avoid this switch
1 parent 3388285 commit d9a1911

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/List.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,7 @@ class List<T = any> extends React.Component<ListProps<T>, ListState<T>> {
454454
}
455455
};
456456

457-
public scrollTo(scrollTop: number): void;
458-
459-
public scrollTo(config: ScrollConfig): void;
460-
461-
public scrollTo(arg0: any) {
457+
public scrollTo = (arg0: number | ScrollConfig) => {
462458
// Number top
463459
if (typeof arg0 === 'object') {
464460
const { isVirtual } = this.state;
@@ -596,7 +592,7 @@ class List<T = any> extends React.Component<ListProps<T>, ListState<T>> {
596592
} else {
597593
this.listRef.current.scrollTop = arg0;
598594
}
599-
}
595+
};
600596

601597
public internalScrollTo(relativeScroll: RelativeScroll): void {
602598
const { itemIndex: compareItemIndex, relativeTop: compareItemRelativeTop } = relativeScroll;

0 commit comments

Comments
 (0)