Skip to content
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

[net7.0] Ensure that Grid is treating star rows/columns as Auto when unconstrained #14165

Merged
merged 2 commits into from
Mar 23, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Backport of #13999 to net7.0

/cc @PureWeen @hartez

@PureWeen
Copy link
Member

/azp run

@PureWeen PureWeen enabled auto-merge (squash) March 23, 2023 14:49
@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Mar 23, 2023
@PureWeen PureWeen merged commit 10d32ff into net7.0 Mar 23, 2023
@PureWeen PureWeen deleted the backport/pr-13999-to-net7.0 branch March 23, 2023 16:31
rmarinho pushed a commit that referenced this pull request Apr 17, 2023
…unconstrained (#14165)

* Ensure that Grid is treating star rows/columns as Auto when unconstrained Fixes #13993

* Auto-format source code

---------

Co-authored-by: E.Z. Hart <[email protected]>
Co-authored-by: GitHub Actions Autoformatter <[email protected]>
@mikebikerider
Copy link

The #14165 'Ensure that Grid is treating star rows/columns as Auto when unconstrained' brakes existing grid layouts for iOS.
When a grid has a star Height row and 'auto' rows beneath it, and I place into the star row a vertical layout CollectionView or a ListView the control will push any visible control in rows below off the visible screen, UseSafeArea ignored.

Simulator Screenshot - iPhone 14 Pro - 2023-05-28 at 19 57 30

If I click the Hide button to hide the control (CollectionView) the Label and button beneath the CollectionView appear at the correct position with the iOS Save Area.

Simulator Screenshot - iPhone 14 Pro - 2023-05-28 at 19 52 26

I can toggle the Collection IsVisible back to true using the same button and the CollectionView will push the Label with text out of the Safe Area and off the visible portion of the screen.

I could not find which MAUI controls are officially 'unconstrained'. A map control placed into a star height row also pushes down controls in auto height rows beneath it.

If change the 'star' row to 'auto' in VS2022 Hot Reload the iOS screen does not change. In the below iOS iPhone 14 Pro simulator screenshot the CollectionView has two items and still pushes the controls below it off screen.

Simulator Screenshot - iPhone 14 Pro - 2023-05-28 at 20 37 04

The same code with the Collection View in the 'auto' height row running in the Google Pixel 5 simulator.

Screenshot_1685320170

Android CollectionView (Windows too) exhibits constraint. If it has 2 rows it will occupy space for 2 rows and will resize when more added, or some removed. iOS CollectionView is a different beast. I am aware of it.

In my Xamarin apps I have CollectionView controls in 'star' and in 'auto' rows, depending on the context. Handling a CollectionView in a grid 'auto' row can be tricky. My code must calculate the HeightRequest. This works well if there is a star row in the grid that can shrink or expand. It works great in Xamarin. In MAUI it depends what kind of control is in the star row and how well or not MAUI GridLayoutManager handles the 'star' row content. If I place a map control into the star grid row in MAUI iOS app and I have a CollectionView in the 'auto' grid row below the map, it was already not handled gracefully prior to #14165. After I upgraded VS2022 to 17.6.2 it got worse. Now in addition to the CollectionView not always rendered at a correct position the lower grid row is cut off at the bottom of the screen. I didn't have these issues when using Xamarin.Forms. The last MAUI update forced me to put a transition to MAUI project on hold. Not that I am much upset about that. The Xamarin app I was moving runs faster than the MAUI version, screen refresh cleaner.

I suggest restoring previous functionality where star rows are treated as star rows.

@mikebikerider
Copy link

Besides grids, map control fell victim to #14165 'treating star rows as auto' under iOS.

Simulator Screenshot - iPhone 14 Pro - 2023-06-05 at 21 59 03

The page layout is a grid, the top 'star' row has a map control, the bottom 'auto' row has a grid with navigation buttons.
Whan the page loads in the simulator it looks fine. I rotate the page to landscape and the bottom bar is pushed down beyond the safe area.

Simulator Screenshot - iPhone 14 Pro - 2023-06-05 at 22 10 51

A click on the info button shows a label with the copyright notice. The label is in an 'auto' row initially hidden.

Simulator Screenshot - iPhone 14 Pro - 2023-06-05 at 21 58 12

When the row with the copyright label became visible it pushed down the bottom navigation bar instead of pushing up the map lower border.
That is not how it should look and did look prior to #14165

Simulator Screenshot - iPhone 14 Pro - 2023-06-05 at 22 00 06

I made the page look as it should by setting map MaximumHeighRequest to 0.

<Map x:Name="map" Grid.Row="0" MaximumHeightRequest="0"/>

This silly trick doesn't work well for grids.
This #14165 update came out terribly wrong.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
@samhouts samhouts added fixed-in-7.0.86 Look for this fix in 7.0.86! fixed-in-7.0.92 Look for this fix in 7.0.92! labels Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter fixed-in-7.0.86 Look for this fix in 7.0.86! fixed-in-7.0.92 Look for this fix in 7.0.92!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants