dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

[iOS] Using safe area causes white area at the top upon entry focus. #25866

Open mkshiblu opened 1 week ago

mkshiblu commented 1 week ago

Description

Problem: A white area appears at the top when an entry is tapped on and the soft keyboard opens up on iOS. Upon closing the keyboard, the area disappears. The area sometimes becomes bigger and permanent upon returning from a detail page.

Image

Sample Code:


<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp2.MainPage"
            xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"
             ios:Page.UseSafeArea="False"
             Shell.NavBarIsVisible="False">

    <Grid BackgroundColor="Yellow"
          IgnoreSafeArea="True">
        <Entry Text="Entry"
               BackgroundColor="White"
               VerticalOptions="Start"
               Margin="50" />
    </Grid>

</ContentPage>

Shell or Navigation page didn't make any difference

Steps to Reproduce

STEPS:

  1. Create a new MAUI project .net 8.0.x
  2. Set the content page's ios:Page.UseSafeArea="False" via XAML
  3. Set the page's Shell.NavBarIsVisible="False" since we don't want to show the navbar
  4. In the top-level child grid, set the IgnoreSafeArea to True so that it can be rendered on top of the iOS dynamic island or other controls
  5. Add an Entry to the top-level child grid close to the dynamic island. The issue is not reproduced if the entry is not close to the physical phone non-safe areas.
  6. Tap on the entry to enter something, the keyboard should open.

Observed Behavior: When the Keyboard opens, it seems like the entire layout drops down a bit as well. A white border appears at the very top of the display. Upon closing the keyboard, the area disappears.

Expected Behavior: The page top area should remain the same upon keyboard opening.

In addition to that, when coming back from another page the top white area becomes bigger and remains that way.

Link to public reproduction project repository

No response

Version with bug

8.0.93 SR9.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

iOS

Affected platform versions

iOS 17.5, iOS 18 both sim and physical device

Did you find any workaround?

None since it seemed like a core MAUI issue.

Relevant log output

similar-issues-ai[bot] commented 1 week ago

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

Zhanglirong-Winnie commented 6 days ago

This issue has been verified using Visual Studio 17.13 Preview 1( 9.0.10 & 8.0.93 & 8.0.83). Can repro this issue on iOS platform.