XamarinCommunityToolkit
XamarinCommunityToolkit copied to clipboard
[Bug] CollectionView inside TabViewItem not showing content on iOS
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
- create new xamarin forms app
- add Community Toolkit and update all packages
- 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
Same problem on iOS. On Android works but on iOS isn't working
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.
Same problem - first TabViewItem with CollectionView - no issues; 2nd tab not showing - other things like Label do show up; xct 2.05, XF 2545
facing same issue. can anyone please update if anyone is working on it?
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.
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.
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.
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: @.***>
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
me having the same issue in iOS. Any news about that?
Our solution is to set ItemSizingStrategy to MeasureFirstItem for iOS.
Worth noting, Android need to set as MeasureAllItems separately in our case.
i had the same problem and found the solution for it!!
- 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
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.
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.