xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.87k forks source link

[Bug] [Android] RefreshView is broken when CollectionView contains single/"zero height" element in GroupHeader #12056

Open bondarenkod opened 4 years ago

bondarenkod commented 4 years ago

Description

Using an empty view inside CollectionView.GroupHeaderTemplate as a view prevents RefreshView from react to user interaction ("pull to refresh").

Steps to Reproduce

  1. Put a single empty element into CollectionView.GroupHeaderTemplate to display the absent group header:
    <CollectionView.GroupHeaderTemplate>
    <DataTemplate>
        <Grid />
    </DataTemplate>
    </CollectionView.GroupHeaderTemplate>
  2. Create a page with CollectionView that can accept groups, and put it inside RefreshView. You can use default modern template for XF application with tabs from recent versions of VS2019.

    Expected Behavior

    RefreshView control should respond to user interaction.

    Actual Behavior

    The user interaction is ignored by RefreshView.

Basic Information

Screenshots

09_09_2020__00_45_27__582306ee-32f5-4b73-9b28-de23d314b583

Reproduction Link

https://github.com/bondarenkod/xf_collectionview_refreshview_pulltorefresh_issue see the files /Views/ItemsPage.xaml /Views/ItemsPage2.xaml

Workaround

This is partial workaround due to unwanted side effects. Put an addition element inside the root one

 <CollectionView.GroupHeaderTemplate>
    <DataTemplate>
        <Grid>
            <Grid />
        </Grid>
    </DataTemplate>
</CollectionView.GroupHeaderTemplate>
StephaneDelcroix commented 4 years ago

I don't think it prevents anything, but as it has an empty size, you can't slide it.

@hartez your opinion on this ?

bondarenkod commented 4 years ago

The same project, iOS. Everything is perfect here. The 'pull to refresh' behavior from the RefreshView is different. I will provide a demo from native android later. 10_09_2020__16_28_14__80e778f4-04f6-444b-b92c-b88afbeb6bb8