dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.04k stars 1.73k forks source link

[iOS] UICollectionView ScrollsToTop does not work #19866

Open kklose23 opened 8 months ago

kklose23 commented 8 months ago

Description

https://developer.apple.com/documentation/uikit/uiscrollview/1619421-scrollstotop

The ScrollsToTop property works as expected for ScrollViews but not CollectionViews

I tried adding the following, but it still did not work:

Microsoft.Maui.Controls.Handlers.Items.CollectionViewHandler.Mapper.AppendToMapping("ScrollsToTop", (h, v) =>
{
  var uiView = h.PlatformView.Subviews.FirstOrDefault(x => x is UICollectionView);
  if (uiView is UICollectionView collectionView)
  {
    collectionView.ScrollsToTop = true;
  }
});

Steps to Reproduce

  1. Scroll down on a CollectionView in iOS
  2. Tap the status bar
  3. The CollectionView should scroll to the top but it does not

Link to public reproduction project repository

https://github.com/kklose23/maui-uicollectionview-scrollstotop

Version with bug

8.0.5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 17

Did you find any workaround?

No

Relevant log output

No response

ghost commented 8 months ago

Hi @kklose23. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

kklose23 commented 8 months ago

Added the repro code and steps

XamlTest commented 7 months ago

Verified this on Visual Studio Enterprise 17.10.0 Preview 1(8.0.6). Repro on iOS 17.2 with below Project: MonkeyFinder.zip