Xamarin.forms: [Bug] Shell content padding on iOS default

Created on 16 Apr 2019  路  6Comments  路  Source: xamarin/Xamarin.Forms

Safe Area Spec

  • Don't use the platform specific UseSafeArea API with Shell it doesn't make any sense to have this ios specific API
  • SetPaddingInsets(true) should be the default value
  • SetPaddingInsets(false) on Android and iOS should cause the content to flow underneath the nav bar so the page offset is at 0,0
  • SetPaddingInsets API name is confusing and if anything we should just call it "UseSafeAreaInsets" and then we can emulate how this works on iOS to Android
  • "UseSafeAreaInsets" should be settable on Shell and ContentPage

David's original issue below

Description

This issue has been filed 3 or 4 times already and it came up just now from a new developer on Twitter. To me this indicates an API design that needs to be improved.

4342

5811

4840

Out of the box, content is shoved underneath the NavigationBar TabBar. It seems the expectation is that content would appear below the NavigationBar and above the TabBar while scrolling behind them.

1) I suggest this should be the default in Shell.

2) Nobody is looking for Shell.SetPaddingInsets and more importantly it doesn't seem to be named consistently with the rest of the Shell API at least in terms of what we expose in XAML. Nothing else is a Set_____.

3) We should not have to add anything to the templates to get this expected default

What's the difference between SetPaddingInsets and the iOS UseSafeArea?

Steps to Reproduce

File > New > Shell template. Run on iOS. Observe the content is under the navigation bar.

Yes ScrollView and ListView will adapt as desired, but I think we can do better.

Basic Information

  • Version with issue: 4.0-pre8
  • Platform Target Frameworks:

    • iOS: 12.1

Screenshots

Screenshot 2019-04-15 20 45 33

<?xml version="1.0" encoding="utf-8"?>
<ContentPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="TopScrollTest.Views.ItemsPage"
    Title="{Binding Title}"
    x:Name="BrowseItemsPage">
    <ContentPage.ToolbarItems>
        <ToolbarItem
            Text="Add"
            Clicked="AddItem_Clicked" />
    </ContentPage.ToolbarItems>
    <StackLayout>
        <ListView
            x:Name="ItemsListView"
            ItemsSource="{Binding Items}"
            VerticalOptions="FillAndExpand"
            HasUnevenRows="true"
            RefreshCommand="{Binding LoadItemsCommand}"
            IsPullToRefreshEnabled="true"
            IsRefreshing="{Binding IsBusy, Mode=OneWay}"
            CachingStrategy="RecycleElement"
            ItemSelected="OnItemSelected">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <StackLayout
                            Padding="10">
                            <Label
                                Text="{Binding Text}"
                                LineBreakMode="NoWrap"
                                Style="{DynamicResource ListItemTextStyle}"
                                FontSize="16" />
                            <Label
                                Text="{Binding Description}"
                                LineBreakMode="NoWrap"
                                Style="{DynamicResource ListItemDetailTextStyle}"
                                FontSize="13" />
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>
</ContentPage>
shell blocker 2 bug

Most helpful comment

Yep, let's do it.

All 6 comments

Yep, let's do it.

Just stumbled upon this. Glad to hear it's on the radar.

closed by #5990

No, I used SetPaddingInsets! :-( Can't use iOsSpecific:Page.UseSafeArea="false" on my page?

Before the padding also included my custom tabbar.

Is it possible to disable this? Or is it not possible with shell to use de "safeArea" space? Because sometimes you would want that..

@samhouts I second the opinion of those above me, I don't agree with this change either. There are several instances where you would want at least the option to use the safe area.

Any workaround for this?

Was this page helpful?
0 / 5 - 0 ratings