xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.87k forks source link

[Bug] TabbedPage "goes under" Home Bar on iOS #15612

Open xDaijobu opened 1 year ago

xDaijobu commented 1 year ago

Description

TabbedPage inside FlyoutPage "goes under" Home Bar on iOS

Steps to Reproduce

  1. Open & run the solution
  2. Select one of the details by clicking the 'Punch Me' Button Simulator Screen Shot - iPhone 14 Pro Max - 2022-11-23 at 14 11 41

https://user-images.githubusercontent.com/22674537/203490875-3e7192d0-2fd4-4426-b074-83009d0816ae.mov

Expected Behavior

Simulator Screen Shot - iPhone 14 Pro Max - 2022-11-23 at 14 08 47

Actual Behavior

Simulator Screen Shot - iPhone 14 Pro Max - 2022-11-23 at 14 09 03

Basic Information

Screenshots

Reproduction Link

https://github.com/xDaijobu/BugTabbedPageiOS

Workaround

xDaijobu commented 1 year ago

It only happens on the iOS simulator and device ( 14 Pro Max & 14 Pro ). Android, it's working fine ~

jfversluis commented 1 year ago

Just to be clear: it doesn't happen on iOS if it doesn't have the Dynamic Island? So it works fine on an iOS non-Pro?

xDaijobu commented 1 year ago

Just to be clear: it doesn't happen on iOS if it doesn't have the Dynamic Island? So it works fine on an iOS non-Pro?

yeahhh

Screenshot 2022-11-25 at 10 45 20
xDaijobu commented 1 year ago

hmm, i just realised somethingg

there is a another bug @@

Screenshot 2022-11-25 at 11 15 03
KMWenyon commented 1 year ago

I have the same issue, can you please provide eta on fix as this has huge impact on our production applications

Phatfisher commented 1 year ago

Affecting our production app as well and need a fix for this. Would love to see this resolved.

samuelGrahame commented 1 year ago
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;

public static void SetDefaultPageSettings(Xamarin.Forms.Page page)
{
    page.On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);            
}

if you use this does it solve the issue. as i had similar issue.

giuseppenovielli commented 1 year ago

@samuelGrahame your workaround not working. I set for 'SetUseSafeArea' for TabbedPage and every Page into tabbed.

@jfversluis @jsuarezruiz How i can fix this issue?

Thanks!

samuelGrahame commented 1 year ago

Not sure then, just commenting on this as I had a similar issue.

giuseppenovielli commented 1 year ago

Hi guys, i have found a new workaround, thanks the following comment -> https://github.com/xamarin/Xamarin.Forms/issues/14484#issuecomment-900062339

So follow these steps:

  1. Use SafeArea into FlyoutPage, and all pages into tabbed pages as @samuelGrahame says:

into code behind ->

public partial class MyFlyoutPage : FlyoutPage
    {
        public MyFlyoutPage()
        {
            InitializeComponent();
            SetDefaultPageSettings(this)
        }
    }
public partial class MyPageIntoTabbedBar : ContentPage
    {
        public MyPageIntoTabbedBar()
        {
            InitializeComponent();
            SetDefaultPageSettings(this)
        }
    }
  1. Use the follow Custom TabbedPage to fix:
public class iOSDynamicIslandFixTabbedPage : TabbedPage
   public iOSDynamicIslandFixTabbedPage()
        {
            InitializeComponent();
            SetDefaultPageSettings(this)
        }
  1. Add the following CustomRenderer into iOS project
[assembly: ExportRenderer(typeof(iOSDynamicIslandFixTabbedPage), typeof(iOSDynamicIslandFixTabbedPageCustomRenderer))]
namespace <namespace>.iOS.Views
{
    public class iOSDynamicIslandFixTabbedPageCustomRenderer : TabbedRenderer
    {
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            if (View == null)
                return;

            var currentFrame = View.Frame;
            View.Frame = currentFrame.Inset(0, 1);
            View.Frame = currentFrame;
        }
    }
}

Enjoy! ;)

15mgm15 commented 1 year ago

@giuseppenovielli I've spent 6 hours trying to find a workaround, I owe you a beer!

jerryg78258 commented 1 year ago

You've saved me with this workaround! Thanks!