Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] CollectionView inside TabViewItem not showing content on iOS #1932

Open
Hanisafa opened this issue Oct 18, 2022 · 14 comments
Open

[Bug] CollectionView inside TabViewItem not showing content on iOS #1932

Hanisafa opened this issue Oct 18, 2022 · 14 comments
Labels
bug Something isn't working. Breaky break.

Comments

@Hanisafa
Copy link

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 Hanisafa added the bug Something isn't working. Breaky break. label Oct 18, 2022
@xamiell
Copy link

xamiell commented Oct 20, 2022

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

@ShortStack622
Copy link

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.

@bvschie
Copy link

bvschie commented Dec 10, 2022

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

@surajporje
Copy link

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

@bvschie
Copy link

bvschie commented Dec 29, 2022

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.

@exendahal
Copy link

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.

@dush135
Copy link

dush135 commented Jan 26, 2023

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.

@ShortStack622
Copy link

ShortStack622 commented Jan 26, 2023 via email

@timahrentlov
Copy link

timahrentlov commented Mar 16, 2023

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: #1854 (comment)

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

@DaviBittencourt
Copy link

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

@hariywill
Copy link

Our solution is to set ItemSizingStrategy to MeasureFirstItem for iOS.

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

@VxDant
Copy link

VxDant commented Jun 29, 2023

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

@LeoJHarris
Copy link
Contributor

LeoJHarris commented Nov 20, 2023

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

LeoJHarris commented Nov 21, 2023

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working. Breaky break.
Projects
None yet
Development

No branches or pull requests