virtua 0.16.2 → 0.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { ReactElement, ReactNode } from "react";
2
2
  import { CustomViewportComponent, ViewportComponentAttributes } from "./Viewport";
3
3
  import { CustomItemComponent } from "./ListItem";
4
4
  import { CacheSnapshot, ScrollToIndexOpts } from "../core/types";
@@ -46,8 +46,14 @@ export interface VListHandle {
46
46
  export interface VListProps extends ViewportComponentAttributes {
47
47
  /**
48
48
  * Elements rendered by this component.
49
+ *
50
+ * You can also pass a function and set {@link VListProps.count} to create elements lazily.
51
+ */
52
+ children: ReactNode | ((index: number) => ReactElement);
53
+ /**
54
+ * If you set a function to {@link VListProps.children}, you have to set total number of items to this prop.
49
55
  */
50
- children: ReactNode;
56
+ count?: number;
51
57
  /**
52
58
  * Number of items to render above/below the visible bounds of the list. You can increase to avoid showing blank items in fast scrolling.
53
59
  * @defaultValue 4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtua",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "description": "A zero-config, fast and small (~3kB) virtual list (and grid) component for React.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",