Skip to content

Commit

Permalink
fix: pass correct args to scrollToItem method
Browse files Browse the repository at this point in the history
  • Loading branch information
wellyshen committed Jun 3, 2021
1 parent 1c5f4e4 commit 6a17acb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-fans-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-cool-virtual": patch
---

fix: pass correct args to `scrollToItem` method
2 changes: 1 addition & 1 deletion src/useVirtual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export default <
correctScrollCountRef.current <= MAX_CORRECT_SCROLL_COUNT &&
(scrollOffset >= start || scrollOffset + outerSize <= end)
) {
setTimeout(() => scrollToItem(index, cb));
setTimeout(() => scrollToItem(val, cb));
correctScrollCountRef.current += 1;
} else {
if (cb) cb();
Expand Down

0 comments on commit 6a17acb

Please sign in to comment.