dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.99k stars 1.72k forks source link

Bug: iOS - CollectionView scroll sometimes stops working if swipeView is inside datatemplate #16856

Closed SamuelJames101 closed 4 days ago

SamuelJames101 commented 1 year ago

Description

If you half swipe open a swipe view and then swipe it close it sometimes stops the collectionView from scrolling.

This scroll starts working again after using a swipe view again.

Tested on iOS and Android and can only see the issue on iOS

Steps to Reproduce

1.Create a collectionView 2.Set the DataTemplate to contain a SwipeView. 3.Half swipe a CollectionView Item. 4.Try to scroll the CollectionView

  1. If you can Scroll retake steps 3 & 4 until it happens.

Link to public reproduction project repository

https://github.com/SamuelJames101/CollectionViewDataTemplateIssue

Version with bug

8.0.0-preview.7.8842

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iPhone 11 Pro, iOS 13.1.1

Did you find any workaround?

No response

Relevant log output

No response

ghost commented 1 year ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

edgedj commented 6 months ago

We are also experiencing this on a client app. When running on iOS the app appears to freeze when on a view that scrolls with swipe items. It happens intermittently when a swipe item is partially swiped while the view is scrolling, the entire view locks up until the swipe item is moved. Other views in the app continue to function but on return to the frozen view the view remains frozen. the only way to resolve is to either kill the entire app and reload or re-swipe the stuck item (this is not obvious to the user though as there is no visibly stuck swipe item)

divyesh008 commented 4 months ago

Here is a temporary work around using the Scrolled event of CollectionView.

private bool isScrolling = false;
private double previousScrollY = 0;

void CollectionView_Scrolled(System.Object sender, Microsoft.Maui.Controls.ItemsViewScrolledEventArgs e)
{
    if (!isScrolling)
    {
        isScrolling = true;
        MainThread.BeginInvokeOnMainThread(() =>
        {
            foreach (var item in contacts.GetVisualTreeDescendants().OfType<CustomSwipeView>())
            {
                item.IsEnabled = false;
            }
        });

        Dispatcher.StartTimer(TimeSpan.FromSeconds(0.5), () =>
        {
            if (previousScrollY == e.VerticalOffset)
            {
                isScrolling = false;

                MainThread.BeginInvokeOnMainThread(() =>
                {
                    foreach (var item in contacts.GetVisualTreeDescendants().OfType<CustomSwipeView>())
                    {
                        item.IsEnabled = true;
                    }
                });

                return false; // Stop the timer
            }

            previousScrollY = e.VerticalOffset;
            return true; // Continue the timer
        });
    }
}
Flais commented 4 months ago

One MAUI bug nearly fixed, running into the next one. This is anoying. And again it is a bug preventing us to go live. The main view uses that CollectionView SwipeView combination. Thanks to @divyesh008 , I will give it a try. In simulator it looks better, but also had one freeze. Will give it to our tester.

divyesh008 commented 4 months ago

@Flais glad it helped you. But if you still face an issue with the workaround, you have to use Syncfusion's SFListView control.

vitalii-smal commented 2 months ago

also experiencing same issue, please fix ASAP...