diff --git a/lib/VirtualList.tsx b/lib/VirtualList.tsx index 5eed19b..71f6b26 100644 --- a/lib/VirtualList.tsx +++ b/lib/VirtualList.tsx @@ -149,6 +149,12 @@ export const VirtualList = forwardRef(function ( continue } const style = getComputedStyle(el) + if (style.display === 'none') { + continue + } + if (style.position !== 'static' && style.position !== 'relative') { + continue + } totalHeight += (el as HTMLElement).offsetHeight + parseFloat(style.marginTop) + parseFloat(style.marginBottom) + gap count++ }