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

Is it possible to implement item dragging as shown in the image? #218

Open
RouberR opened this issue Jan 30, 2025 · 3 comments
Open

Is it possible to implement item dragging as shown in the image? #218

RouberR opened this issue Jan 30, 2025 · 3 comments
Labels

Comments

@RouberR
Copy link

RouberR commented Jan 30, 2025

Hello! The library looks fantastic, but I wanted to ask if it is possible to implement item dragging functionality similar to the one shown in the attached image.

Image

@MatiPl01
Copy link
Owner

Unfortunately, this is not possible, if you mean reordering of grid items that span across different columns or rows. Grid layout supports only items with different heights for now, but it doesn't mean that they span across different rows.

I may consider adding support for this in the future but I don't have an idea how reordering could work in this case if you try to swap an item occupying one column with an item that occupies 2 columns. Can you maybe describe me how you see that?

Btw, use the Discussions tab for questions and feature request instead of issues.

@RouberR
Copy link
Author

RouberR commented Jan 31, 2025

@MatiPl01 Thank you for your response! Here’s how I imagine the behavior: If a 1-column item is dragged into a 2-column space, it could either:

  1. Move downward, leaving empty space (grid "push" effect).
  2. Swap entire columns with items.

I saw a similar approach in the react-native-drag-sort library, but it has bad animation, optimization and many bugs

P.S. Apologies for using Issues instead of Discussions — I’ll repost this there if needed.

@MatiPl01
Copy link
Owner

MatiPl01 commented Jan 31, 2025

You don't have to move this question to discussions. I will not close the issue until we finish talking here. I just wanted to let you know that discussions are a better place for things like that.

Also thank you for letting me know about this library. I saw similar solutions but never came across this one.

You would likely want to create layout that in this library is called AnyThreeLayout. I think that you can now achieve a kind of similar result with the Sortable.Flex component by setting half of the parent container width on some views and the full width on other. It should work in a similar way.

I know that this is not ideal so I would likely implement some more developer friendly solution for this case in the future. For now, I am focusing on adding the web support. I may try implementing this grid layout with column spanning next.

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

No branches or pull requests

2 participants