Skip to content

On iOS, CollectionView with GridItemsLayout and Span set is centering the item when the collection has only one item. #29595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jhovelnu opened this issue May 20, 2025 · 7 comments · May be fixed by #29639
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView i/regression This issue described a confirmed regression on a currently supported version p/0 Work that we can't release without platform/ios potential-regression This issue described a possible regression on a currently supported version., verification pending regressed-in-9.0.60 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@jhovelnu
Copy link

jhovelnu commented May 20, 2025

Description

I have a CollectionView with Span=3, and it was working correctly. However, after updating to MAUI version 9.0.70, I'm experiencing an issue on iOS: the CollectionView centers the item when the collection contains only one item.

I am using the FFImageLoading:
PackageReference Include="FFImageLoading.Maui" Version="1.2.7"

Image

If I replace ffimageloading:CachedImage with the default Image, the issue does not occur.

Note: This was working as expected in MAUI version 9.0.40 and 9.0.50.

iOS:

Image

Android:

Image

Steps to Reproduce

1.Create a CollectionView with GridItemsLayout and set Span=3.
2.In the item template use the ffimageloading:CachedImage.
3.Set the item source with only one item.

Link to public reproduction project repository

https://github.com/jhovelnu/MauiApp2Net9/tree/CollectionViewSpan

Version with bug

9.0.70 SR7

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.50 SR5

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

For now, the only workaround is to replace ffimageloading:CachedImage with Image.

Relevant log output

@jhovelnu jhovelnu added the t/bug Something isn't working label May 20, 2025
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@jhovelnu
Copy link
Author

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

This is not the same issue, but I found a similar one that occurred in Xamarin.Forms:
xamarin/Xamarin.Forms#6851

@PureWeen PureWeen added area-controls-collectionview CollectionView, CarouselView, IndicatorView potential-regression This issue described a possible regression on a currently supported version., verification pending platform/iOS labels May 20, 2025
@TamilarasanSF4853
Copy link
Contributor

This issue has been verified in Visual Studio Code 1.99.3 with .NET MAUI versions 9.0.40, 9.0.50, 9.0.51, and 9.0.70. It is reproducible on the iOS and Mac platforms starting from version 9.0.60 up to the latest. However, the issue is not reproducible in earlier versions, including 9.0.51 and below.

@anandhan-rajagopal anandhan-rajagopal added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed i/regression This issue described a confirmed regression on a currently supported version regressed-in-9.0.60 labels May 21, 2025
@PureWeen PureWeen added the p/0 Work that we can't release without label May 21, 2025
@PureWeen PureWeen added this to the .NET 9 SR8 milestone May 21, 2025
@sheiksyedm
Copy link
Contributor

This issue occurs only with the CV1 handler and not the CV2 handler. The regression was introduced in PR: #28670

CC: @albyrock87

@albyrock87
Copy link
Contributor

I'm trying to repro from within the TestHostApp.

I have referenced FFImageLoading DLL directly:

  <ItemGroup Condition=" '$(TargetFramework)' == 'net9.0-ios' ">
    <Reference Include="/Users/myuser/.nuget/packages/ffimageloading.maui/1.2.7/lib/net8.0-ios17.5/FFImageLoading.Maui.dll" />
  </ItemGroup>

then I've added it to MauiProgram.cs

#if IOS
FFImageLoading.Maui.HostingExtensions.UseFFImageLoading(appBuilder);
#endif

I have created the attached C# file Issue29595.cs.zip with the exact code from the sample repo and set it as main page.

mainPage = new Issue29595Shell();

I cannot reproduce on main, and even checking out 9.0.70 tag.

But I can indeed reproduce with a standalone app... any idea?

@albyrock87
Copy link
Contributor

Update: it appears that using a different FontSize on the label solves the issue (don't ask me why).
I'm investigating it.

@albyrock87
Copy link
Contributor

Fix is ready :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView i/regression This issue described a confirmed regression on a currently supported version p/0 Work that we can't release without platform/ios potential-regression This issue described a possible regression on a currently supported version., verification pending regressed-in-9.0.60 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: Todo
7 participants