[Xamarin.Forms] IsDragAndDropping not changed to false on iOS 15
Closed this issue · 17 comments
Platform (please complete the following information):
- OS: [iOS 15.2]
- Device: [iPhoneSimulator (iphoe 12)]
- Sdk vervion: [iOS 15.4.0.0]
- Xamarin.Forms: [5.0.0.2337]
Describe the bug
Sometimes the IsDragAndDropping Property is not changed to false, if dragging ends. Works great on Android and iOS 14. But with iOS 15.2 it stops working.
To Reproduce
Steps to reproduce the behavior:
- Open DragAndDrop Sample in samples folder
- Select Layout samples
- Enable DragDrop switch
- Drag one item and drop it somewhere.
- You should see, that backgroundColor is not reset. (Make it red in screenshot)
Exceptions (if applicable)
Copy paste the exception and the stack trace
Unhandled Exception:
System.InvalidOperationException: exception message
at Namespace.Call
at ....
+1 here. @AlleSchonWeg did u manage to find out what changed in ios 15?
@themronion
No. I don't know what changed.
Does the EndDragAndDrop event/command is working ?
Cause it's set at the same location
_isMovedBackfire = true;
var item = itemsSourceList[from];
itemsSourceList.RemoveAt(from);
itemsSourceList.Insert((int)pathTo.Item, item);
var to = itemsSourceList.IndexOf(item);
Element.IsDragAndDropping = false;
if (draggedViewCell?.FormsCell is DraggableViewCell draggableViewCell)
{
draggableViewCell.IsDragAndDropping = false;
Element.DragAndDropEndedCommand?.Execute(
new DragAndDropInfo(from, to, draggableViewCell.BindingContext));
}
If the command is still working but not the IsDragAndDropping, it means that's probably more a XF data trigger issue....
mmmh I think I reproduced, it seems unfortunately a XF Data trigger issue. Workaround could be: don't use a trigger but a converter based on the IsDragAndDropping property.
Hi,
could you implement a fix? The problem in my project produces only a small visual bug. So i could wait for a fix, before i implement workarounds which become obsolete in a next collectionview version.
If it's a XF issue I cannot fix it. Just use the workaround
mmmh I think I reproduced, it seems unfortunately a XF Data trigger issue. Workaround could be: don't use a trigger but a converter based on the IsDragAndDropping property.
nope, doesn't fix it. The problem only occurs when we try to to drag and drop a cell in another position in the list, if we put it after selection to the same position everything is ok. I guess there might be a problem somewhere with the cells binding context
i guess we should rename the issue cause IsDragAndDropping
actually works as expected
For now the issue is very vague and not very characterized I'm afraid
Still not working with iOS 15.5.
@themronion Do you find a workaround?
I think the issue is easy to reproduce. Perhaps the description is not so accurate and i'm wrong that the problem has something to do with IsDragAndDropping.
@AlleSchonWeg nope, maybe i'll give it a spin again in my spare time
Hi,
if i remove this line:
the problem is fixed. After the change the
UIGestureRecognizerState.Changed
part uses the cell from the UIGestureRecognizerState.Began
part.@AlleSchonWeg make a pr maybe
Hi,
i'm not sure if there are side effects.
@roubachof What do you think?
I don't remember the code and why it was written this way :)
Best is to test it with the DrapAndDropSample app
will be fixed in next version
fixed in maui