xamarin / Xamarin.Forms

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

[Bug] Collection view doesn't renderer inside Shell top tab #6707

Open rmarinho opened 5 years ago

rmarinho commented 5 years ago

Description

If i use CollectionView inside a Tab that is inside a FlyoutItem, (so basic a top tab) i see the log bellow, and it doesn't render, the same view renders fine in a normal page or inside just a shell bottom tab.

<!-- Bug report best practices: https://github.com/xamarin/Xamarin.Forms/wiki/Submitting-Issues -->
2019-06-29 00:35:36.579301+0100 SCEiOS[18042:711308] *** Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3698.103.12/UICollectionView.m:6165
2019-06-29 00:35:38.466247+0100 SCEiOS[18042:711308] The behavior of the UICollectionViewFlowLayout is not defined because:
2019-06-29 00:35:38.466414+0100 SCEiOS[18042:711308] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
2019-06-29 00:35:38.466545+0100 SCEiOS[18042:711308] Please check the values returned by the delegate.
2019-06-29 00:35:38.467316+0100 SCEiOS[18042:711308] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fc920df52f0>, and it is attached to <UICollectionView: 0x7fc9243c3400; frame = (0 0; 414 33); autoresize = W+H; gestureRecognizers = <NSArray: 0x600000cc2bb0>; layer = <CALayer: 0x600004202040>; contentOffset: {0, 0}; contentSize: {183, 35}; adjustedContentInset: {0, 0, 0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7fc920df52f0>.
2019-06-29 00:35:38.467472+0100 SCEiOS[18042:711308] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
2019-06-29 00:35:38.467587+0100 SCEiOS[18042:711308] The behavior of the UICollectionViewFlowLayout is not defined because:
2019-06-29 00:35:38.467694+0100 SCEiOS[18042:711308] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
2019-06-29 00:35:38.467792+0100 SCEiOS[18042:711308] Please check the values returned by the delegate.
2019-06-29 00:35:38.468000+0100 SCEiOS[18042:711308] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fc920df52f0>, and it is attached to <UICollectionView: 0x7fc9243c3400; frame = (0 0; 414 33); autoresize = W+H; gestureRecognizers = <NSArray: 0x600000cc2bb0>; layer = <CALayer: 0x600004202040>; contentOffset: {0, 0}; contentSize: {183, 35}; adjustedContentInset: {0, 0, 0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7fc920df52f0>.
2019-06-29 00:35:38.468108+0100 SCEiOS[18042:711308] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
2019-06-29 00:35:38.468263+0100 SCEiOS[18042:711308] The behavior of the UICollectionViewFlowLayout is not defined because:
2019-06-29 00:35:38.468362+0100 SCEiOS[18042:711308] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
2019-06-29 00:35:38.468455+0100 SCEiOS[18042:711308] Please check the values returned by the delegate.
2019-06-29 00:35:38.468813+0100 SCEiOS[18042:711308] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fc920df52f0>, and it is attached to <UICollectionView: 0x7fc9243c3400; frame = (0 0; 414 33); autoresize = W+H; gestureRecognizers = <NSArray: 0x600000cc2bb0>; layer = <CALayer: 0x600004202040>; contentOffset: {0, 0}; contentSize: {183, 35}; adjustedContentInset: {0, 0, 0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7fc920df52f0>.
2019-06-29 00:35:38.468974+0100 SCEiOS[18042:711308] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
2019-06-29 00:35:38.469244+0100 SCEiOS[18042:711308] The behavior of the UICollectionViewFlowLayout is not defined because:
2019-06-29 00:35:38.469501+0100 SCEiOS[18042:711308] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
2019-06-29 00:35:38.469749+0100 SCEiOS[18042:711308] Please check the values returned by the delegate.
2019-06-29 00:35:38.470148+0100 SCEiOS[18042:711308] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fc920df52f0>, and it is attached to <UICollectionView: 0x7fc9243c3400; frame = (0 0; 414 33); autoresize = W+H; gestureRecognizers = <NSArray: 0x600000cc2bb0>; layer = <CALayer: 0x600004202040>; contentOffset: {0, 0}; contentSize: {183, 35}; adjustedContentInset: {0, 0, 0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7fc920df52f0>.
2019-06-29 00:35:38.470464+0100 SCEiOS[18042:711308] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
2019-06-29 00:35:38.470735+0100 SCEiOS[18042:711308] The behavior of the UICollectionViewFlowLayout is not defined because:
2019-06-29 00:35:38.470995+0100 SCEiOS[18042:711308] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
2019-06-29 00:35:38.471219+0100 SCEiOS[18042:711308] Please check the values returned by the delegate.
2019-06-29 00:35:38.471558+0100 SCEiOS[18042:711308] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fc920df52f0>, and it is attached to <UICollectionView: 0x7fc9243c3400; frame = (0 0; 414 33); autoresize = W+H; gestureRecognizers = <NSArray: 0x600000cc2bb0>; layer = <CALayer: 0x600004202040>; contentOffset: {0, 0}; contentSize: {183, 35}; adjustedContentInset: {0, 0, 0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7fc920df52f0>.
2019-06-29 00:35:38.471904+0100 SCEiOS[18042:711308] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
2019-06-29 00:35:38.472191+0100 SCEiOS[18042:711308] The behavior of the UICollectionViewFlowLayout is not defined because:
2019-06-29 00:35:38.472627+0100 SCEiOS[18042:711308] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
2019-06-29 00:35:38.472938+0100 SCEiOS[18042:711308] Please check the values returned by the delegate.
2019-06-29 00:35:38.473750+0100 SCEiOS[18042:711308] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fc920df52f0>, and it is attached to <UICollectionView: 0x7fc9243c3400; frame = (0 0; 414 33); autoresize = W+H; gestureRecognizers = <NSArray: 0x600000cc2bb0>; layer = <CALayer: 0x600004202040>; contentOffset: {0, 0}; contentSize: {183, 35}; adjustedContentInset: {0, 0, 0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7fc920df52f0>.
2019-06-29 00:35:38.474190+0100 SCEiOS[18042:711308] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.

Steps to Reproduce

 <FlyoutItem Route="teams" Title="Equipas" Icon="{StaticResource teamsIcon}" >
        <Tab Route="futebol" Title="Futebol" Icon="{StaticResource soccerIcon}"  >
            <ShellContent Title="News" Route="news"  ContentTemplate="{DataTemplate pages:PostsPage}" Icon="{StaticResource newsIcon}"/>
        </Tab>
  </FlyoutItem>

PostsPage

  <CollectionView  ItemsSource="{Binding Posts}"
                     ItemTemplate="{StaticResource postListItemTemplate}"
                     SelectionMode="Single"
                     SelectedItem="{Binding SelectedPost, Mode=TwoWay}"/>

Expected Behavior

Actual Behavior

Basic Information

Screenshots

Reproduction Link

PureWeen commented 5 years ago

@rmarinho is this still an issue?

420tech commented 4 years ago

I am having this issue - so yes.

GeorgeVelikov commented 4 years ago

Can confirm this is still an issue on XF 4.5 and seems to be related to https://github.com/xamarin/Xamarin.Forms/issues/9857

DamienDoumer commented 3 years ago

@PureWeen Version 5.0.2012, I still have this issue

dbrevitt commented 3 years ago

I am experiencing this issue in v5.0.0.2012.

For me the workaround was to not use ShellContent ContentTemplate.

Based on steps to reproduce above, try something like this:

<FlyoutItem Route="teams" Title="Equipas" Icon="{StaticResource teamsIcon}" >
    <Tab Route="futebol" Title="Futebol" Icon="{StaticResource soccerIcon}"  >
        <ShellContent Title="News" Route="news" Icon="{StaticResource newsIcon}">
            <pages:PostsPage />
        </ShellContent>
    </Tab>
</FlyoutItem>

I don't yet know what any other ramifications of this approach might be.