26598 - Fix for Tabbar disappears when navigating back from page with hidden TabBar in iOS 18#27582
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
PureWeen
left a comment
There was a problem hiding this comment.
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 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 |
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 |
There was a problem hiding this comment.
Can you move all these classes to be inner classes of Issue26598 so they don't pollute the namespace?
There was a problem hiding this comment.
Yes @PureWeen! I have refactored the code by moving all the classes inside Issue26598 as inner classes.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
@PureWeen, I have added the additional scenario in the same test case. Kindly review the test cases and let me know if you have any concerns |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| navPage.SendAppearing(); | ||
|
|
||
| // We use this inside ModalNavigationManager to indicate that we're going to be popping multiple | ||
| // modal pages so we don't want it to fire any appearing events |
There was a problem hiding this comment.
Could we do something in the UI from the UITest, like update a Label Text, to validate the correct behavior with the Appearing method?
There was a problem hiding this comment.
This existing test covers the modal scenario here
- PoppingModalStackFiresAppearingOnRevealedModalPage
I've added
- PoppingModalStackFiresAppearingOnRevealedNonModalPage
To cover popping multiple pages down to a shell page to ensure appearing still fires
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Issue Details
When
TabBarIsVisibleis 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.HidesBottomBarWhenPusheddoes 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
TabBarHiddenproperty. Therefore, I have restricted the use ofUIViewController.HidesBottomBarWhenPushedto iOS versions prior to 18 within theUpdateTabBarVisiblemethod.Issues Fixed
Fixes #26598
Tested the behaviour in the following platforms
Known Issue
ItemsUpdatingScrollModeis not implemented in CollectionView2Output Screenshot
Before.mov
After.mov