[iOS] Fix for Single item alignment issue in CollectionView HorizontalGrid Layout#25370
Conversation
|
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 |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
5929285 to
3e94697
Compare
|
/rebase |
3e94697 to
fa3ff16
Compare
PureWeen
left a comment
There was a problem hiding this comment.
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. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
|
/rebase |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
@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? |
|
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? |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |




Root Cause of the issue
The CollectionView seems to centre the item if only one exists. We had already adjusted the
HorizontalAlignmentfor theVerticalGridlayout when a single element was in view. However, we missed making the same adjustment for theHorizontalGridlayout.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
Screenshot