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

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

Closed
SamuelJames101 opened this issue Aug 18, 2023 · 6 comments · Fixed by #23442
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView delighter-sc fixed-in-8.0.90 fixed-in-9.0.0-rc.2.24503.2 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/iOS 🍎 t/bug Something isn't working
Milestone

Comments

@SamuelJames101
Copy link

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

@SamuelJames101 SamuelJames101 added the t/bug Something isn't working label Aug 18, 2023
@Eilon Eilon added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Aug 18, 2023
@PureWeen PureWeen changed the title [regression/8.0.0-preview.7.8842] Bug: iOS - CollectionView scroll sometimes stops working if swipeView is inside datatemplate Bug: iOS - CollectionView scroll sometimes stops working if swipeView is inside datatemplate Aug 24, 2023
@PureWeen PureWeen added this to the Backlog milestone Aug 24, 2023
@ghost
Copy link

ghost commented Aug 24, 2023

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
Copy link

edgedj commented Mar 4, 2024

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)

@samhouts samhouts added partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert labels Apr 22, 2024
@divyesh008
Copy link

divyesh008 commented May 5, 2024

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
        });
    }
}
  • This code implements functionality to manage the behavior of SwipeView elements within a CollectionView during scrolling. The CollectionView is referenced using the x:Name property as contacts.
  • When scrolling is detected, SwipeView elements are disabled to prevent interactions.
  • After scrolling stops, SwipeView elements are re-enabled, allowing users to interact with them as intended.
  • This workaround optimizes the user experience by ensuring smooth interaction with SwipeView elements within the CollectionView.

@Flais
Copy link

Flais commented May 8, 2024

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
Copy link

@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
Copy link

also experiencing same issue, please fix ASAP...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView delighter-sc fixed-in-8.0.90 fixed-in-9.0.0-rc.2.24503.2 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants