Skip to content

Releases: Morglod/react-virtual-overflow

1.1.2 infinity loader example

28 Jul 20:35
Compare
Choose a tag to compare
  • Hooks now also return itemSlice

Example infinity loader:

const [items, setItems] = useState([] as any[]);

// here we get current rendered itemSlice
const { renderedItems, itemSlice } = useVirtualOverflowY({
    itemsLengthY: items.length,
    // ...
});

// here we check if we render bottom range of items
useEffect(() => {
    if (itemSlice.topStartIndex + itemSlice.lengthY >= items.length - 4) {
        // load more
        setItems((prev) => [...prev, ...newItems]);
    }
}, [itemSlice.topStartIndex, itemSlice.lengthY]);

1.1.0 list & grid support

14 Jul 21:55
Compare
Choose a tag to compare
  • Added components for vertical / horizontal lists and grid
  • Updated documentation
  • Added more examples
  • Added ability to force update calculations