Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

26598 - Fix for Tabbar disappears when navigating back from page with hidden TabBar in iOS 18 #27582

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

SuthiYuvaraj
Copy link
Contributor

Issue Details

When TabBarIsVisible is set to false on an inner page, navigating back to the previous page and switching between tabs causes the tab bar visibility to not update correctly.

Root Cause

In iOS 18, UIViewController.HidesBottomBarWhenPushed does not reliably update the tab bar visibility. This property must be set before the page is pushed, which leads to inconsistent behavior when toggling between tabs.

Description of Change

For iOS 18 and later, tab bar visibility is effectively managed using the TabBarHidden property. Therefore, I have restricted the use of UIViewController.HidesBottomBarWhenPushed to iOS versions prior to 18 within the UpdateTabBarVisible method.

Issues Fixed

Fixes #26598

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Known Issue

ItemsUpdatingScrollMode is not implemented in CollectionView2

Output Screenshot

Before Issue Fix After Issue Fix
Before.mov
After.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Feb 5, 2025
@PureWeen PureWeen added this to the .NET 9 SR4 milestone Feb 5, 2025
@karthikraja-arumugam karthikraja-arumugam added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Feb 6, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

PureWeen commented Feb 6, 2025

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created an alternate PR here
#27617

let me know your thoughts.

I think the main problem here is that we are sending an appearing event too early so the call to (Page.FindParentOfType<ShellItem>() as IShellItemController)?.ShowTabs is being calculated against the previous page instead of the incoming page

I'm thinking if we fix this appearing a bit that it might fix a few different quirks with appearing.

If you agree, can you just modify this PR with my changes? Then we can just merge this PR once it's ready.

@SuthiYuvaraj
Copy link
Contributor Author

I've created an alternate PR here #27617

let me know your thoughts.

I think the main problem here is that we are sending an appearing event too early so the call to (Page.FindParentOfType<ShellItem>() as IShellItemController)?.ShowTabs is being calculated against the previous page instead of the incoming page

I'm thinking if we fix this appearing a bit that it might fix a few different quirks with appearing.

If you agree, can you just modify this PR with my changes? Then we can just merge this PR once it's ready.

@PureWeen I have tested the reported issue with this fix, and it works fine. however, in the scenario where the first page has TabBar.IsVisible set to false and the inner page has TabBar.IsVisible set totrue, the behaviour breaks. Here is the code snippet and output video.

public class Issue26598Home : ContentPage
{
 VerticalStackLayout stackLayout;
 Button button;
 public Issue26598Home()
 {
  Title = "Home";
  HeightRequest = 200;
  stackLayout = new VerticalStackLayout();
  button = new Button()
  {
   Text = "Navigate to InnerTab",
   AutomationId = "NavigateToInnerTab",
   VerticalOptions = LayoutOptions.Center,
   HorizontalOptions = LayoutOptions.Center,
  };
  button.Clicked += Button_OnClicked;
  stackLayout.Add(button);
  Shell.SetTabBarIsVisible(this, false);
  this.Content = stackLayout;
 }

 private void Button_OnClicked(object sender, EventArgs e)
 {
  Shell.Current.GoToAsync(nameof(Issue26598Inner));
 }

}

public class Issue26598Inner : ContentPage
{
 VerticalStackLayout stackLayout;
 Button button;
 public Issue26598Inner()
 {
  Title = "InnerTab";
  stackLayout = new VerticalStackLayout();
  button = new Button()
  {
   Text = "Navigate to TabBarPage",
   AutomationId = "NavigateToTabBarPage",
   VerticalOptions = LayoutOptions.Center,
   HorizontalOptions = LayoutOptions.Center,
  };
  button.Clicked += Button_OnClicked;
  stackLayout.Add(button);
  Shell.SetTabBarIsVisible(this, true);
  this.Content = stackLayout;
 }

 private void Button_OnClicked(object sender, EventArgs e)
 {
  Shell.Current.GoToAsync(nameof(Issue26589NonTab));
 }
}
ShellIssue.mov

@PureWeen
Copy link
Member

PureWeen commented Feb 7, 2025

ShellIssue.mov

Dang! Alright, let's just take both our fix than and can you create another test for the additional scenario you've pointed out here?

}
}

public class Issue26598Home : ContentPage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move all these classes to be inner classes of Issue26598 so they don't pollute the namespace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration
Projects
Status: Changes Requested
Development

Successfully merging this pull request may close these issues.

Tabbar disappears when navigating back from page with hidden TabBar in iOS 18
5 participants