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

Adding SortableContext during drag starts 1 row off from the correct row #1319

Open
subtext916 opened this issue Jan 15, 2024 · 3 comments
Open

Comments

@subtext916
Copy link

I am trying to create a timeline ui which enables SortableContext with verticalListSortingStrategy only if the user drags up or down more than 50px. When this happens, I conditionally add SortableContext but the problem I am having, is that it only reorders to the 2nd row, skipping the first one.
I am not sure, but it seems like because I am adding the SortableContext DURING the drag, it is not registering it until it is already over the row immediately below and thus the first time it changes the order, it jumps 2 rows. I will attach a video to demonstrate.
My question is: Is there something I can do in this situation?

@subtext916
Copy link
Author

subtext916 commented Jan 15, 2024

A simple example of the code I am working on is:
<ConditionalWrapper condition={reorderingEnabled} wrapper={(children) => ( <SortableContext items={medias} strategy={verticalListSortingStrategy}> {children} </SortableContext> )} >

and "ConditionalWrapper" is like:

export function ConditionalWrapper({ condition, wrapper, children }: ConditionalWrapperProps) { return condition ? wrapper(children) : children }

@subtext916
Copy link
Author

WOQxX0AzEJNnLq2B6BaqwvPg34ZpeamM.1.mp4

@subtext916
Copy link
Author

subtext916 commented Jan 15, 2024

note: version is 6.0.8 but I also tried updating the version to 6.1.0 and the problem is still occurring.

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

1 participant