Skip to content

[Android] Bottom SafeArea not working in nested Grid #32259

@jaroslaw-dutka

Description

@jaroslaw-dutka

Description

Bottom SafeArea not working when I have 2 nested Grids like this:

<?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="bug_safearea.MainPage"
             SafeAreaEdges="None">
    <Grid SafeAreaEdges="None">
        <Image
            Source="dotnet_bot.png"
            HeightRequest="185"
            Aspect="Fill"
            SemanticProperties.Description="dot net bot in a submarine number ten" />
        <Grid RowDefinitions="100,*,100">
            <Label
                Grid.Row="0"
                Text="Hello, World!"
                Style="{StaticResource Headline}"
                SemanticProperties.HeadingLevel="Level1" />
            <Button
                Grid.Row="2"
                x:Name="CounterBtn"
                Text="Click me" 
                SemanticProperties.Hint="Counts the number of times you click"
                Clicked="OnCounterClicked"
                HorizontalOptions="Center" />
        </Grid>
    </Grid>
</ContentPage>

Image

The problem was introduces by recent changes (#31022).
I'm not sure but I think the problem is here:

if (bottom > 0 && viewBottom > (screenHeight - bottom))
becasue there are mixed units (DIP and pixels)

Image

Steps to Reproduce

See attached project.
bug-safearea.zip

Link to public reproduction project repository

No response

Version with bug

10.0.0-rc.2

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

10.0.0-rc.1

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

Labels

area-layoutStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenteri/regressionThis issue described a confirmed regression on a currently supported versionlayout-gridp/0Current heighest priority issues that we are targeting for a release.platform/androidregressed-in-10-rc2s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions