virtua icon indicating copy to clipboard operation
virtua copied to clipboard

Consider removing wrapper div of items

Open inokawa opened this issue 2 years ago • 4 comments

However, in current architecture, we can't assign ResizeObserver and position to items without it.

inokawa avatar Jan 02 '24 15:01 inokawa

As a workaround, you can override item prop of Virtualizer and use React.cloneElement in it. https://github.com/inokawa/virtua/blob/main/stories/react/advanced/With%20cmdk.stories.tsx

It may be better to add a shorthand like <Virtualizer item={false}>. As an important point, without wrapper div, ResizeObserver doesn't detect border by default, and margin at all. We have to change configuration for it.

inokawa avatar Jan 05 '24 02:01 inokawa

Hi! Been struggling to find any list-virtualization plugin that allows this, so it'd be fantastic if virtua did. You mention that you can overwrite the itemprop on Virtualizer in React - is there a similar workaround for ListItem in the Vue implementation?

wanecek avatar Apr 11 '24 11:04 wanecek

Hello @wanecek , Vue Virtualizer doesn't have item prop yet but it would be possible to implement the feature. Currently I don't have time to do it, but contribution is welcome if anyone want to help.

inokawa avatar Apr 11 '24 12:04 inokawa

React 19 will have ref cleanup function. I'll try it after release.

inokawa avatar Apr 24 '24 13:04 inokawa