maui icon indicating copy to clipboard operation
maui copied to clipboard

[iOS] Fix for Single item alignment issue in CollectionView HorizontalGrid Layout

Open Tamilarasan-Paranthaman opened this issue 1 year ago • 15 comments

Root Cause of the issue

The CollectionView seems to centre the item if only one exists. We had already adjusted the HorizontalAlignment for the VerticalGrid layout when a single element was in view. However, we missed making the same adjustment for the HorizontalGrid layout.

Description of Change

I have applied the same adjustment to the horizontal grid layout as was done for the vertical grid layout.

Issues Fixed

Fixes #25181

Tested the behaviour in the following platforms

  • [x] Android
  • [x] Windows
  • [x] iOS
  • [x] Mac

Screenshot

Before Issue Fix After Issue Fix

Tamilarasan-Paranthaman avatar Oct 18 '24 09:10 Tamilarasan-Paranthaman

Hey there @Tamilarasan-Paranthaman! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

/azp run

jsuarezruiz avatar Oct 18 '24 11:10 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Oct 18 '24 11:10 azure-pipelines[bot]

/rebase

Tamilarasan-Paranthaman avatar Oct 22 '24 10:10 Tamilarasan-Paranthaman

/rebase

PureWeen avatar Oct 24 '24 16:10 PureWeen

SingleItemAlignmentInCollectionViewHorizontalGridLayout is failing

@PureWeen, I added this test for this issue. There seems to be a slight difference between the previously committed image and the current one generated by the CI. However, the current image is correct, so I have committed it.

Tamilarasan-Paranthaman avatar Oct 25 '24 07:10 Tamilarasan-Paranthaman

/azp run

jsuarezruiz avatar Oct 25 '24 10:10 jsuarezruiz

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Oct 25 '24 10:10 azure-pipelines[bot]

/rebase

sheiksyedm avatar Nov 19 '24 07:11 sheiksyedm

/rebase

rmarinho avatar Dec 11 '24 15:12 rmarinho

/azp run

rmarinho avatar Dec 11 '24 15:12 rmarinho

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Dec 11 '24 15:12 azure-pipelines[bot]

The test is failing for CV1 seems the layout is expanding below the status bar and we cut that off for the test ? or do we need to regenerate images?

image

Original screenshot full screen

image

@rmarinho, Yes, it is expanding below the status bar, and it seems the CI did not account for that space. I have modified the test sample to address this by wrapping the CollectionView in a StackLayout, and it now passes both CV1 and CV2 on my end. Could you please review it and let me know if you have any concerns?

Tamilarasan-Paranthaman avatar Dec 12 '24 07:12 Tamilarasan-Paranthaman

Nop wrapping a CollectionView on a StackLayout is not a good practice. Try use a Grid instead.

rmarinho avatar Dec 12 '24 10:12 rmarinho

Nop wrapping a CollectionView on a StackLayout is not a good practice. Try use a Grid instead.

@rmarinho, thank you for pointing this out! I have replaced the StackLayout with a Grid as suggested, and it worked as expected during my testing. Could you please check and let me know if you have any further concerns?

Tamilarasan-Paranthaman avatar Dec 12 '24 11:12 Tamilarasan-Paranthaman

/azp run

rmarinho avatar Dec 12 '24 11:12 rmarinho

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Dec 12 '24 12:12 azure-pipelines[bot]