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

Impl auto safe area padding #13047

Merged
merged 5 commits into from
Nov 21, 2023
Merged

Impl auto safe area padding #13047

merged 5 commits into from
Nov 21, 2023

Conversation

maxkatz6
Copy link
Member

What does the pull request do?

Adds a new TopLevel.AutoSafeAreaPadding property settable on the top-level content (MainView) or top-level itself.
When enabled, it automatically adds safe area paddings.

Normally, to see any effect, it also requires InsetsManager.DisplayEdgeToEdge to be enabled as well, so application content can be rendered behind the status bar.
It is enabled automatically on iOS though, and we need to add safe paddings automatically. Making overall Avalonia iOS experience better out of the box.

It's a behavioral change on mobile, since TopLevel.AutoSafeAreaPadding is enabled by default now. If not needed, TopLevel.AutoSafeAreaPadding can be disabled on the main view.

Also, this PR changes iOS InsetsManager.SafeAreaPadding behavior to match Android behavior, when SafeAreaPadding returns empty paddings, when DisplayEdgeToEdge is disabled.

Fixed issues

Fixes #12969

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0040066-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 requested review from a team and removed request for emmauss October 1, 2023 06:05
Copy link
Member

@jmacato jmacato left a comment

Choose a reason for hiding this comment

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

LGTM

@jmacato jmacato added this pull request to the merge queue Nov 21, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2023
@jmacato jmacato added this pull request to the merge queue Nov 21, 2023
Merged via the queue into master with commit 3df092f Nov 21, 2023
7 checks passed
@jmacato jmacato deleted the impl-AutoSafeAreaPadding branch November 21, 2023 15:44
@kerams
Copy link

kerams commented Oct 24, 2024

Has this been removed in a recent version of Avalonia? With 11.3.999-cibuild0052531-alpha on iPhone SE 2nd gen (iOS 17) I get no automatic padding and my navbar is rendered across the system status bar:

Screenshot 2024-10-24 at 13 32 03

Similarly in iPhone 15 Pro emulator (iOS 18):

Untitled

@emmauss
Copy link
Contributor

emmauss commented Oct 24, 2024

Has this been removed in a recent version of Avalonia? On iPhone SE 2nd gen I get no automatic padding and my navbar is rendered across the system status bar:

Screenshot 2024-10-24 at 13 32 03

Similarly in iPhone 15 Pro emulator:

Untitled

@maxkatz6

@maxkatz6
Copy link
Member Author

@kerams can you open an issue with minimal repro? I can take a look over weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Safe area insets background colour is wrong (on iOS)
5 participants