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

[Xamarin.Forms] IsDragAndDropping not changed to false on iOS 15 #55

Closed
AlleSchonWeg opened this issue Jan 28, 2022 · 17 comments
Closed

Comments

@AlleSchonWeg
Copy link
Contributor

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:

  1. Open DragAndDrop Sample in samples folder
  2. Select Layout samples
  3. Enable DragDrop switch
  4. Drag one item and drop it somewhere.
  5. 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 ....

Screenshots (if applicable)
image

@AlleSchonWeg AlleSchonWeg changed the title IsDragAndDropping not changed to false on iOS IsDragAndDropping not changed to false on iOS 15 Jan 28, 2022
@themronion
Copy link
Contributor

+1 here. @AlleSchonWeg did u manage to find out what changed in ios 15?

@AlleSchonWeg
Copy link
Contributor Author

@themronion
No. I don't know what changed.

@roubachof
Copy link
Owner

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....

@roubachof
Copy link
Owner

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.

@AlleSchonWeg
Copy link
Contributor Author

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.

@roubachof
Copy link
Owner

If it's a XF issue I cannot fix it. Just use the workaround

@themronion
Copy link
Contributor

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

@themronion
Copy link
Contributor

i guess we should rename the issue cause IsDragAndDropping actually works as expected

@roubachof
Copy link
Owner

For now the issue is very vague and not very characterized I'm afraid

@AlleSchonWeg
Copy link
Contributor Author

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.

@themronion
Copy link
Contributor

@AlleSchonWeg nope, maybe i'll give it a spin again in my spare time

@AlleSchonWeg
Copy link
Contributor Author

Hi,
if i remove this line:

draggedViewCell = (iOSViewCell)Control.CellForItem(changedPath);

the problem is fixed. After the change the UIGestureRecognizerState.Changed part uses the cell from the UIGestureRecognizerState.Began part.

@themronion
Copy link
Contributor

@AlleSchonWeg make a pr maybe

@AlleSchonWeg
Copy link
Contributor Author

Hi,
i'm not sure if there are side effects.
@roubachof What do you think?

@roubachof
Copy link
Owner

I don't remember the code and why it was written this way :)
Best is to test it with the DrapAndDropSample app

@roubachof
Copy link
Owner

will be fixed in next version

@roubachof roubachof changed the title IsDragAndDropping not changed to false on iOS 15 [Xamarin.Forms] IsDragAndDropping not changed to false on iOS 15 Dec 12, 2022
@roubachof
Copy link
Owner

fixed in maui

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

Successfully merging a pull request may close this issue.

3 participants