maui icon indicating copy to clipboard operation
maui copied to clipboard

iOS: UseSafeArea is ignored when root-element is a ScrollView

Open thomaskaelin opened this issue 2 years ago • 11 comments

Description

I am having a ContentPage where the SafeArea is enabled.

<ContentPage xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"
             ios:Page.UseSafeArea="False">

</ContentPage>

Using a ScrollView as a root-element, the SafeArea is ignored. Without_Grid

Wrapping the ScrollView inside a Grid leads to the desired result (SafeArea is respected): With_Grid

Steps to Reproduce

ScrollView as root-element (SafeArea is ignored)

<ContentPage>
    <ScrollView>
        <VerticalStackLayout>
        <!-- place enough content here to make the content extend the vertical size of the screen -->
        </VerticalStackLayout>
    </ScrollView>
</ContentPage>

Grid as a root-element (SafeArea is respected)

<ContentPage>
    <Grid>
        <ScrollView>
            <VerticalStackLayout>
            <!-- place enough content here to make the content extend the vertical size of the screen -->
            </VerticalStackLayout>
        </ScrollView>
    </Grid>
</ContentPage>

Link to public reproduction project repository

n/a

Version with bug

7.0.86

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16.4

Did you find any workaround?

Wrapping the ScrollView inside a Grid-element. Performance-wise, this is a bad solution, of course.

Relevant log output

No response

thomaskaelin avatar Jun 28 '23 06:06 thomaskaelin

I just noticed, that the same error occurs when using a CollectionView as the root-element inside a ContentPage.

thomaskaelin avatar Jun 28 '23 08:06 thomaskaelin

#15809

PrestigiousF avatar Jun 28 '23 22:06 PrestigiousF

We see this issue in our App as well with MAUI version 7.0.92.

Because of this we cannot use the On<iOS>().SetUseSafeArea(false); setting right now.

omghb avatar Jul 25 '23 07:07 omghb

This is because ScrollView doesnt have the property IgnoreSafeArea, which is set to default to False for Layouts like Grid. I openened an issue here #16360

borrmann avatar Jul 27 '23 13:07 borrmann

see also here #12417 , here #16398 , here #12823 and also potentially this one #15460

borrmann avatar Jul 27 '23 13:07 borrmann

#15163

borrmann avatar Jul 27 '23 13:07 borrmann

Are you able to try this again with a nightly build? https://github.com/dotnet/maui/wiki/Nightly-Builds

Redth avatar Nov 30 '23 20:11 Redth

Are you able to try this again with a nightly build? https://github.com/dotnet/maui/wiki/Nightly-Builds

This issue is somewhat "Fixed" in the latest SR1 by the following PR. The UIScrollView now correctly takes https://developer.apple.com/documentation/uikit/uiscrollview/2902261-contentinsetadjustmentbehavior into account. By default UIScrollView has this property set to "Automatic" which means the UIScrollView itself will occupy the DangerZone but the content inset will be set to the area outside of the DangerZone. The problem that still existsis that you can't turn off the contentinsetadjustmentbehavior from the xplat level.

That being said, the UIScrollView in SR1 will now layout correctly based on what the contentinsetadjustmentbehavior is set to, so if you change this value to NEVER on the UIScrollView then the content will layout all the way into the DangerZone.

Check out the docs here on how to customize https://learn.microsoft.com/en-us/dotnet/maui/user-interface/handlers/customize?view=net-maui-8.0

I think we can close this issue for now as a duplicate of https://github.com/dotnet/maui/issues/16360 which covers the scenario a bit more broadly.

PureWeen avatar Dec 11 '23 16:12 PureWeen

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

ghost avatar Jan 10 '24 20:01 ghost

Verified this issue with Visual Studio Enterprise 17.9.0 Preview 4. Still repro on iOS platform with steps. This bug may duplicate with #16360

QianaJiao avatar Jan 30 '24 05:01 QianaJiao

Any update on this issue?

BrundhaVelusamy avatar May 24 '24 09:05 BrundhaVelusamy

Any update on this issue?

BrundhaVelusamy avatar Jun 05 '24 04:06 BrundhaVelusamy

Any update on this issue? This is a priority for us.

Arunachalam3641 avatar Jun 19 '24 10:06 Arunachalam3641

Please provide a high priority for this issue.

BrundhaVelusamy avatar Jul 03 '24 04:07 BrundhaVelusamy

Any update on this issue?

Arunachalam3641 avatar Jul 08 '24 13:07 Arunachalam3641

Any update on this issue?

BrundhaVelusamy avatar Jul 26 '24 04:07 BrundhaVelusamy

Any workaround for this issue? Please provide a high priority for this issue.

BrundhaVelusamy avatar Aug 09 '24 04:08 BrundhaVelusamy