Skip to content

Commit d1b0ef2

Browse files
committedFeb 23, 2024
fix: type of onScroll
1 parent 74a9767 commit d1b0ef2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default function BaseExample() {
7676
- `persistentIndices`: `number[]`. Array of indices of items to be persistently rendered. This keeps the corresponding items rendered continuously without being removed due to being outside the rendering area. You can make them sticky by using CSS `position:sticky`.
7777
- `listSize`: `number`, default: 1000. Height of the visible area of the list. Only used before DOM creation, suitable for SSR.
7878
- `triggerDistance`: `number`. The min distance to trigger re-rendering when scrolling.
79-
- `onScroll`: `typeof document.onscroll`. Listen for the list's scroll event. Type is same with HTML native onscroll handle.
79+
- `onScroll`: `React.UIEventHandler`. Listen for the list's scroll event. Type is same with HTML native onscroll handle.
8080
- `virtual`: `boolean`. default: `false`. Whether to enable the virtual list feature. Render all items if disabled.
8181
- `className`: `string`. Add a CSS class to the list root element.
8282
- `style`: `React.CSSProperties`. Add CSS styles to the list root element.

‎README_CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default function BaseExample() {
7676
- `persistentIndices`: `number[]`. 持久化渲染的项的索引数组。使对应索引的项持续渲染而不会因为在渲染区域外而被删除。你再使用 css 的`position:sticky`就可以使其黏着显示。
7777
- `listSize`: `number`, 默认值: 1000. 列表的可见区域高度。仅用于 DOM 创建前使用,适用于 SSR.
7878
- `triggerDistance`: `number`. 滚动时触发重新渲染的距离。
79-
- `onScroll`: `typeof document.onscroll`. 监听列表的 scorll 事件。类型与 HTML 原生 onscroll 监听器相同。
79+
- `onScroll`: `React.UIEventHandler`. 监听列表的 scorll 事件。类型与 HTML 原生 onscroll 监听器相同。
8080
- `virtual`: `boolean`. 默认`false`. 是否启用虚拟列表。不启用则会渲染全部列表项。
8181
- `className`: `string`. 附加 css class 到根元素。
8282
- `style`: `React.CSSProperties`. 附加 css style 到根元素。

‎lib/VirtualList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export type VirtualListProps<ITEM> = {
3737
/**
3838
* listen to scroll event.
3939
*/
40-
onScroll?: typeof document.onscroll,
40+
onScroll?: React.UIEventHandler<HTMLElement>,
4141
/**
4242
* Insert elements at the head. Recommended to only insert elements that do not take up space or take very little space, such as position absolute.
4343
*/

0 commit comments

Comments
 (0)
Please sign in to comment.