{
+ update();
+ props.onScroll?.(event);
+ }}
+ ref={container}
+ css={{
+ overflowY: 'auto',
+ display: 'grid',
+ }}
+ >
+
+ {items.slice(from, to).map((item, index) => children(item, index + from))}
+
+
+ );
+}
+
+function averageItemHeight(container: HTMLDivElement | null) {
+ if (!container?.children.length) {
+ return undefined;
+ }
+
+ const heights = Array.from(container.children)
+ .slice(1, -1)
+ .map((child) => child.clientHeight);
+ return heights.reduce((a, b) => a + b, 0) / heights.length;
+}
diff --git a/src/components/virtualized.tsx b/src/components/virtualized.tsx
index cfae481..fc7acab 100644
--- a/src/components/virtualized.tsx
+++ b/src/components/virtualized.tsx
@@ -31,7 +31,7 @@ export function Virtualized