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

[iOS] - Swipeview with collectionview issue #19541

Open
MattePozzy opened this issue Dec 21, 2023 · 3 comments
Open

[iOS] - Swipeview with collectionview issue #19541

MattePozzy opened this issue Dec 21, 2023 · 3 comments
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView area-controls-swipeview SwipeView platform/iOS 🍎 t/bug Something isn't working
Milestone

Comments

@MattePozzy
Copy link

MattePozzy commented Dec 21, 2023

Description

Hi,
in a Collectionview if there is a swipeview opened and the list binded at the collectionview is refreshed, the swipe is not resetted.

On android works.

ios:
ios_ezgif com-video-to-gif-converted

android:
android_ezgif com-video-to-gif-converted

Steps to Reproduce

  1. create a collectionview with swipeview that contains buttons
  2. create a timer that refresh the list
  3. perform a swipe
  4. wait till the refresh
  5. the swipe are not reset and the button are put on another random list element

Link to public reproduction project repository

https://github.com/MattePozzy/MauiSwipeViewIssue

Version with bug

8.0.3

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

No response

Did you find any workaround?

No

Relevant log output

No response

@MattePozzy MattePozzy added the t/bug Something isn't working label Dec 21, 2023
@PureWeen PureWeen added area-controls-collectionview CollectionView, CarouselView, IndicatorView area-controls-swipeview SwipeView platform/iOS 🍎 labels Dec 21, 2023
@PureWeen PureWeen added this to the Backlog milestone Dec 21, 2023
@ghost
Copy link

ghost commented Dec 21, 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.

@SupermindPT
Copy link

It looks like its related to the way CollectionView virtualization works. As alternative try with a ListView, or set the DataTemplate in a separate View with its BindingContext.

@MattePozzy
Copy link
Author

It looks like its related to the way CollectionView virtualization works. As alternative try with a ListView, or set the DataTemplate in a separate View with its BindingContext.

Hi @SupermindPT, thank you for your reply.
With ListView the issue persist. I have used this code:

        <ListView ItemsSource="{Binding MyList}" >
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <SwipeView>
                            <Label Text="{Binding Name}" />
                            <SwipeView.RightItems>
                                <SwipeItems SwipeBehaviorOnInvoked="Close">
                                    <SwipeItemView>
                                        <Button BackgroundColor="Pink" Text="Delete" />
                                    </SwipeItemView>
                                </SwipeItems>
                            </SwipeView.RightItems>
                        </SwipeView>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

Then I have tried the CollectionView wth a data template in a separate view:

        <CollectionView ItemsSource="{Binding MyList}" >
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <local:ItemTemplate BindingContext="{Binding .}"/>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>

ItemTemplate.xaml:

<?xml version="1.0" encoding="utf-8" ?>
<ContentView 
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="MauiApp6.ItemTemplate">

    <SwipeView HeightRequest="60">
        <Label Text="{Binding Name}" />
        <SwipeView.RightItems>
            <SwipeItems SwipeBehaviorOnInvoked="Close">
                <SwipeItemView>
                    <Button BackgroundColor="Pink" Text="Delete" />
                </SwipeItemView>
            </SwipeItems>
        </SwipeView.RightItems>
    </SwipeView>
</ContentView>

but the issue still persist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView area-controls-swipeview SwipeView platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants