Skip to content

Comments

[iOS/Catalyst] Fix Shell TitleView rendering issues on iOS 16 (#1283…#14370

Merged
rmarinho merged 2 commits intonet7.0from
backport/pr-12834-to-net7.0
Apr 4, 2023
Merged

[iOS/Catalyst] Fix Shell TitleView rendering issues on iOS 16 (#1283…#14370
rmarinho merged 2 commits intonet7.0from
backport/pr-12834-to-net7.0

Conversation

@PureWeen
Copy link
Member

@PureWeen PureWeen commented Apr 3, 2023

Backport of #12834 to net7.0

/cc @mattleibow @jsuarezruiz

…Fixes #10128 Fixes #11309

* Fix the issue

* Added a sample in the Gallery

* Added Device Test

* Fix test

* Update src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>

---------

Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
# Conflicts:
#	src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs
#	src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs

void UpdateFrame(UIView newSuper)
{
if (newSuper is not null && newSuper.Bounds != CGRect.Empty)
Copy link
Member Author

@PureWeen PureWeen Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This by itself causes the measure of the height to differ between iOS 16 and pre iOS 16

This block of code sets the Height property of the TitleView to the superview height, which would then cause the Arrange in the base class to get called with the value that Height is set to.

Because Height is no longer being set, iOS 16 uses the measured height where as pre iOS 15 uses the Super.Bounds.Height

I reworked a lot of this code here and from what I can tell in .NET 8 everything is now consistent with ios16 and pre ios16.

I debated just leaving this code as is, because something showing seems better than nothin, I'm worried about the TitleView measuring/arranging changing once users migrate up to .NET 8.

Given the following XAML here are the different results

 <Shell.TitleView>
        <Grid Background="Purple">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>

            </Grid.RowDefinitions>
            <Label Text="I should exist!" Background="blue" />
            <Label Grid.Row="1" Text="I should exist!" Background="Yellow" />
        </Grid>
    </Shell.TitleView>

This is how it currently shows on pre iOS 16

image

This is how it shows with this PR on iOS 16

image

In .NET8 we're making an additional call to UpdateFrame inside LayoutSubviews in order to update all those values. Once we do that then we get the following results on iOS 16 compared to iOS 13.

image

I've pushed up the extra call to UpdateFrame because I think it's important if we backport this that the measure behavior stays consistent.

@PureWeen PureWeen marked this pull request as ready for review April 3, 2023 20:03
@Eilon Eilon added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Apr 3, 2023
@rmarinho rmarinho merged commit 572087a into net7.0 Apr 4, 2023
@rmarinho rmarinho deleted the backport/pr-12834-to-net7.0 branch April 4, 2023 10:18
@Sebastian1989101
Copy link

@PureWeen is there any ETA when this fix will be available in a Service Release? The latest .NET 7 Service Release is already way older as I would expect it to be regarding the list of issues with MAUI still.

@Kapusch
Copy link

Kapusch commented May 23, 2023

Hello @rmarinho , could you please confirm when this fix will be released ?
Indeed, I don't retrieve anything related to this PR from the list of releases.

@Ghostbird
Copy link
Contributor

It's not been in the latest release AFAIK. We still have horrible issues with the TitleView on iOS.

@dpozimski
Copy link

we cant finish app migration because of that issue :) waiting for the release !

@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2023
@samhouts samhouts added platform/macos macOS / Mac Catalyst platform/ios labels Feb 1, 2024
@samhouts samhouts added the fixed-in-7.0.92 Look for this fix in 7.0.92! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-7.0.92 Look for this fix in 7.0.92! platform/ios platform/macos macOS / Mac Catalyst

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants