Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not displaying preview of the dragging item when in a virtualized list #526

Closed
danglduy opened this issue Nov 26, 2021 · 2 comments
Closed

Comments

@danglduy
Copy link

I'm having an issue of displaying the preview of a dragging item in a virtualized list.

It's when I removed this line

opacity: id === activeId ? 0 : undefined,

After dragging and scrolling passes the initial view, the preview of the dragging item will be disappeared.

I am using latest versions:

  • @dnd-kit/core 4.0.3
  • @dnd-kit/sortable 5.1.0

Demo

dndkit_disappeared_drag_preview_virtualized_list.mp4
@danglduy danglduy changed the title Not displaying shadowed preview of the dragging item when in a virtualized list Not displaying preview of the dragging item when in a virtualized list Nov 26, 2021
@clauderic
Copy link
Owner

This isn't a bug with @dnd-kit, this is just how virtualized lists work. When items scroll out of view, they get unmounted by the virtual list component.

If you're using react-tiny-virtual-list, you can use the stickyIndices prop to prevent the item from unmounting when it goes off screen:

<VirtualList
  stickyIndices={activeId ? [items.indexOf(activeId)] : undefined}

@hanmaker-s1
Copy link

This isn't a bug with @dnd-kit, this is just how virtualized lists work. When items scroll out of view, they get unmounted by the virtual list component.

If you're using react-tiny-virtual-list, you can use the stickyIndices prop to prevent the item from unmounting when it goes off screen:

<VirtualList
  stickyIndices={activeId ? [items.indexOf(activeId)] : undefined}

If using another virtual library such as react-virtuoso, is there a solution for https://github.com/dnd-kit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants