react-cool-virtual
Advanced tools
Comparing version 0.4.4 to 0.4.5
{ | ||
"name": "react-cool-virtual", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "A tiny React hook for rendering large datasets like a breeze.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1034,13 +1034,13 @@ <p align="center"> | ||
```js | ||
const props = useVirtual({ | ||
onScroll: ({ | ||
startIndex, // (number) The index of the first batch item | ||
stopIndex, // (number) The index of the last batch item | ||
loadIndex, // (number) The index of the current batch items (e.g. 1 - 15 as `0`, 16 - 30 as `1`, and so on) | ||
scrollOffset, // (number) The scroll offset from top/left, depending on the `horizontal` option | ||
userScroll, // (boolean) Tells you the scrolling is through the user or not | ||
}) => { | ||
// Fetch data... | ||
}, | ||
}); | ||
const loadMore = ({ | ||
startIndex, // (number) The index of the first batch item | ||
stopIndex, // (number) The index of the last batch item | ||
loadIndex, // (number) The index of the current batch items (e.g. 1 - 15 as `0`, 16 - 30 as `1`, and so on) | ||
scrollOffset, // (number) The scroll offset from top/left, depending on the `horizontal` option | ||
userScroll, // (boolean) Tells you the scrolling is through the user or not | ||
}) => { | ||
// Fetch data... | ||
}; | ||
const props = useVirtual({ loadMore }); | ||
``` | ||
@@ -1055,15 +1055,15 @@ | ||
```js | ||
const props = useVirtual({ | ||
onScroll: ({ | ||
overscanStartIndex, // (number) The index of the first overscan item | ||
overscanStopIndex, // (number) The index of the last overscan item | ||
visibleStartIndex, // (number) The index of the first visible item | ||
visibleStopIndex, // (number) The index of the last visible item | ||
scrollOffset, // (number) The scroll offset from top/left, depending on the `horizontal` option | ||
scrollForward, // (boolean) The scroll direction of up/down or left/right, depending on the `horizontal` option | ||
userScroll, // (boolean) Tells you the scrolling is through the user or not | ||
}) => { | ||
// Do something... | ||
}, | ||
}); | ||
const onScroll = ({ | ||
overscanStartIndex, // (number) The index of the first overscan item | ||
overscanStopIndex, // (number) The index of the last overscan item | ||
visibleStartIndex, // (number) The index of the first visible item | ||
visibleStopIndex, // (number) The index of the last visible item | ||
scrollOffset, // (number) The scroll offset from top/left, depending on the `horizontal` option | ||
scrollForward, // (boolean) The scroll direction of up/down or left/right, depending on the `horizontal` option | ||
userScroll, // (boolean) Tells you the scrolling is through the user or not | ||
}) => { | ||
// Do something... | ||
}; | ||
const props = useVirtual({ onScroll }); | ||
``` | ||
@@ -1078,10 +1078,10 @@ | ||
```js | ||
const props = useVirtual({ | ||
onResize: ({ | ||
width, // (number) The content width of the outer element | ||
height, // (number) The content height of the outer element | ||
}) => { | ||
// Do something... | ||
}, | ||
}); | ||
const onResize = ({ | ||
width, // (number) The content width of the outer element | ||
height, // (number) The content height of the outer element | ||
}) => { | ||
// Do something... | ||
}; | ||
const props = useVirtual({ onResize }); | ||
``` | ||
@@ -1088,0 +1088,0 @@ |
347779