Skip to content

[iOS] UICollectionView ScrollToTop does not work #19866

Description

@kklose23

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions