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

DragAndDropInfo provides incorrect information for moved item #27

Closed
ewerspej opened this issue May 26, 2021 · 8 comments
Closed

DragAndDropInfo provides incorrect information for moved item #27

ewerspej opened this issue May 26, 2021 · 8 comments

Comments

@ewerspej
Copy link

ewerspej commented May 26, 2021

Platform (please complete the following information):

  • OS: Both (mainly iOS, though)

Describe the bug
The DragAndDropInfo provides an incorrect object that has been moved on iOS. When I move an item by one position, I receive the item that was in the new position instead of the actual item which was moved to that new position. Also, it seems that on both platforms, the From and To properties are reversed.

To Reproduce
Steps to reproduce the behavior:

  1. Create a HorizontalListView with Drag and Drop enabled
  2. Add a handler for the DragAndDropEndedCommand
  3. Drag and Drop an item to a new position
  4. Interrogate the DragAndDropInfo object on both iOS and Android
  5. You'll see that the From and To properties are the wrong way around and that on iOS the returned object is not the one that was moved, but instead the one that was previously in the position that the moved item got dropped to.

This is urgent, because I cannot release a feature I'm working on with this behaving different on iOS than on Android and I am not a fan of workarounds. A quick response and possible fix would be much appreciated! :)

Update: For now, I've implemented a workaround, because it's a one-liner, which is less work than fixing the actual issue and also goes much faster than waiting for an update to the nuget. However, this should be fixed, because Drag and Drop currently isn't exactly doing what it is supposed to do.

@ewerspej ewerspej changed the title Urgent: DragAndDropInfo provides incorrect information for moved item DragAndDropInfo provides incorrect information for moved item May 27, 2021
@ewerspej
Copy link
Author

@roubachof This is still important, but not urgent anymore as I've found away around this problem. I'd like to get rid of the workaround eventually, though. If I have some spare time, I might look into a solution myself and provide a PR.

@umar15baig
Copy link

@ewerspej Can you please tell me about that workaround you are talking about ?
Thanks

@roubachof
Copy link
Owner

in fact the info are inversed:

'from' is 'to'
and 'to' is 'from' x)

@ewerspej
Copy link
Author

@ewerspej Can you please tell me about that workaround you are talking about ?
Thanks

@umar15baig , instead of using the Content object from the DragAndDropInfo, I'm accessing the object myself in my underlying collection and instead of the To position, I'm simply using the From position (which will break obviously, once a fix is available):

var draggedElement = MyCollection[dragDropInfo.From];

That solved the immediate issue for my use case. Your use case might be different.

@ewerspej
Copy link
Author

in fact the info are inversed:

'from' is 'to'
and 'to' is 'from' x)

LOL, yes!

@roubachof
Copy link
Owner

just be aware, it will be fixed in next version (next week) :)

@ewerspej
Copy link
Author

nice! thanks for the info :)

@roubachof
Copy link
Owner

fixed by 1.8.2

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