XamarinCommunityToolkit icon indicating copy to clipboard operation
XamarinCommunityToolkit copied to clipboard

[Bug] CollectionView inside TabViewItem not showing content on iOS

Open Hanisafa opened this issue 2 years ago • 14 comments

Description

in IOS , When having a CollectionView inside TabViewItem , the content of the CollectionView is not visible the fist time the page laod , you need to navigate to other page and then navigate back to be visible . please note that the CollectionView it self is visible , but it don't Render/draw its item template

please note that ListView work fine please note that this bug only appear in iOS , Android s ok

Stack Trace

Link to Reproduction Sample

Steps to Reproduce

  1. create new xamarin forms app
  2. add Community Toolkit and update all packages
  3. add TabView with CollectionView in one of its TabViewItem

Expected Behavior

show the CollectionView items

Actual Behavior

Nothing is showen tell i navigate to another page and navigate back to Tab page

Basic Information

Xamarin.Forms : 5.0.0.2515 Xamarin.Essentials : 1.7.3 Xamarin.CommunityToolKit : 2.0.5

test on iPhone 6s ios : 15.6

  • Version with issue:
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:
    • iOS:
    • Android:
    • UWP:
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Workaround

Change CollectionView to listView

Reproduction imagery

Hanisafa avatar Oct 18 '22 09:10 Hanisafa

Same problem on iOS. On Android works but on iOS isn't working

xamiell avatar Oct 20 '22 20:10 xamiell

I am also having this problem...

I have tried directly having the collectionview inside the tabviewitem.... I also set it as a content view and it will not show.

ShortStack622 avatar Nov 27 '22 17:11 ShortStack622

Same problem - first TabViewItem with CollectionView - no issues; 2nd tab not showing - other things like Label do show up; xct 2.05, XF 2545

bvschie avatar Dec 10 '22 14:12 bvschie

facing same issue. can anyone please update if anyone is working on it?

surajporje avatar Dec 29 '22 04:12 surajporje

I noticed the problem is CollectionView - multiple instances do not render on iOS ; I replaced TabView with Syncfusion version -> same problem; I replaced CollectionView back to 'simple' listview to solve the issue for me.

bvschie avatar Dec 29 '22 12:12 bvschie

I noticed a similar issue. I had 3 tabs and each tab had a collection view. The first collection view displays data with no issues. The second and third collection view display data only when the item count is greater than 1.

exendahal avatar Jan 17 '23 11:01 exendahal

me having the same issue in iOS. There is no solution yet. Giving following output on the log

The behavior of the UICollectionViewFlowLayout is not defined because: the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values. Please check the values returned by the delegate. The relevant UICollectionViewFlowLayout instance is <Xamarin_Forms_Platform_iOS_ListViewLayout: 0x7faf4cd32490>, and it is attached to <UICollectionView: 0x7faf4f110000; frame = (0 0; 805 271); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600001e41f80>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x600001b39160>; contentOffset: {0, -38.333333333333336}; contentSize: {0, 0}; adjustedContentInset: {38.333332061767578, 0, 0, 0}; layout: <Xamarin_Forms_Platform_iOS_ListViewLayout: 0x7faf4cd32490>; dataSource: <Xamarin_Forms_Platform_iOS_GroupableItemsViewController_1: 0x7faf4cd326d0>>. Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.

dush135 avatar Jan 26 '23 04:01 dush135

Just a random thought….

Could it not be accounting for DPI, throwing the error…?

On Wed, Jan 25, 2023 at 11:30 PM Dushan Madushanka @.***> wrote:

me having the same issue in iOS. There is no solution yet. Giving following output on the log

The behavior of the UICollectionViewFlowLayout is not defined because: the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values. Please check the values returned by the delegate. The relevant UICollectionViewFlowLayout instance is <Xamarin_Forms_Platform_iOS_ListViewLayout: 0x7faf4cd32490>, and it is attached to <UICollectionView: 0x7faf4f110000; frame = (0 0; 805 271); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600001e41f80>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x600001b39160>; contentOffset: {0, -38.333333333333336}; contentSize: {0, 0}; adjustedContentInset: {38.333332061767578, 0, 0, 0}; layout: <Xamarin_Forms_Platform_iOS_ListViewLayout: 0x7faf4cd32490>; dataSource: <Xamarin_Forms_Platform_iOS_GroupableItemsViewController_1: 0x7faf4cd326d0>>. Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.

— Reply to this email directly, view it on GitHub https://github.com/xamarin/XamarinCommunityToolkit/issues/1932#issuecomment-1404553517, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKKOVCM4RID5TG4VOXKEWLWUH4WNANCNFSM6AAAAAARH4F5ZA . You are receiving this because you commented.Message ID: @.***>

ShortStack622 avatar Jan 26 '23 04:01 ShortStack622

We have a derivate of this bug. We're having TabView -> TabView -> CollectionView, and the CollectionView items are being almost entirely pushed off the left side of the screen.

This happens on all Xamarin Forms versions after 5.0.2337. It's basically forcing us not to upgrade or find a replacement for TabView. Looks a lot like this: https://github.com/xamarin/XamarinCommunityToolkit/issues/1854#issuecomment-1192174790

[update] .. and it probably has to do with this CarouselView bug in XF 2401 and onwards: https://github.com/xamarin/Xamarin.Forms/issues/15659

timahrentlov avatar Mar 16 '23 09:03 timahrentlov

me having the same issue in iOS. Any news about that?

DaviBittencourt avatar Apr 17 '23 15:04 DaviBittencourt

Our solution is to set ItemSizingStrategy to MeasureFirstItem for iOS.

Worth noting, Android need to set as MeasureAllItems separately in our case.

hariywill avatar Apr 27 '23 22:04 hariywill

i had the same problem and found the solution for it!!

  1. use OnAppearing method of the page... a. if u are using MVVM. put binding context inside OnAppearing method. b. no MVVM? populate observable collection inside OnAppearing method of the page

VxDant avatar Jun 29 '23 17:06 VxDant

This has been a blocking issue for while for us, preventing our apps from upgrading beyond XF v5.0.0.2478 which does not have the issue described here.

The latest XCT version doesn't seem to have issue. The only issue from my observation is when XF is higher then 5.0.0.2478 then TabViewItem UI is being messed up.

LeoJHarris avatar Nov 20 '23 23:11 LeoJHarris

I have just swapped the XCT Tabbar for https://github.com/roubachof/Sharpnado.Tabs and its all working just fine now with latest XF nuget.

LeoJHarris avatar Nov 21 '23 00:11 LeoJHarris