Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public override UIViewController SelectedViewController
{
ShellItem.SetValueFromRenderer(ShellItem.CurrentItemProperty, renderer.ShellSection);
CurrentRenderer = renderer;
MoreNavigationController?.PopToRootViewController(false);
}

if (ReferenceEquals(value, MoreNavigationController))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,12 +588,24 @@ public override UIViewController[] PopToViewController(UIViewController viewCont
public override void PushViewController(UIViewController viewController, bool animated)
{
_pendingViewControllers = null;
base.PushViewController(viewController, animated);
if (IsInMoreTab && ParentViewController is UITabBarController tabBarController)
{
tabBarController.MoreNavigationController.PushViewController(viewController, animated);
Comment thread
mattleibow marked this conversation as resolved.
}
else
{
base.PushViewController(viewController, animated);
Comment thread
mattleibow marked this conversation as resolved.
}
}

public override UIViewController PopViewController(bool animated)
{
_pendingViewControllers = null;
if (IsInMoreTab && ParentViewController is UITabBarController tabBarController)
{
return tabBarController.MoreNavigationController.PopViewController(animated);
}

return base.PopViewController(animated);
}

Expand Down
88 changes: 88 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue18193.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
namespace Maui.Controls.Sample.Issues
{
[Issue(IssueTracker.Github, 18193, "[iOS] Navigation doesn't work on sixth tab in shell", PlatformAffected.iOS)]
Comment thread
PureWeen marked this conversation as resolved.
public class Issue18193 : Shell
{
public Issue18193()
{
var tabBar = new TabBar();

tabBar.Items.Add(CreateShellContent("MainPage", typeof(Issue18193MainPage), nameof(Issue18193MainPage)));
tabBar.Items.Add(CreateShellContent("Page 2", typeof(Issue18193Page2), nameof(Issue18193Page2)));
tabBar.Items.Add(CreateShellContent("Page 3", typeof(Issue18193Page3), nameof(Issue18193Page3)));
tabBar.Items.Add(CreateShellContent("Page 4", typeof(Issue18193Page4), nameof(Issue18193Page4)));
tabBar.Items.Add(CreateShellContent("Page 5", typeof(Issue18193Page5), nameof(Issue18193Page5)));
tabBar.Items.Add(CreateShellContent("Page 6", typeof(Issue18193Page6), nameof(Issue18193Page6)));

Items.Add(tabBar);
Routing.RegisterRoute(nameof(Issue18193DetailPage), typeof(Issue18193DetailPage));
}

ShellContent CreateShellContent(string title, Type contentType, string route) => new()
{
Title = title,
ContentTemplate = new DataTemplate(contentType),
Route = route
};
}

class Issue18193MainPage : ContentPage
{
public Issue18193MainPage()
{
var button = new Button() { AutomationId = "NavigationToPage6Button", Text = "Navigate to page 6" };
button.Clicked += (s, e) => Issue18193.Current.GoToAsync("//" + nameof(Issue18193Page6));
Content = button;
}
}

class Issue18193DetailPage : ContentPage
{
public Issue18193DetailPage()
{
Title = "Detail Page";
var button = new Button() { AutomationId = "NavigateBackButton", Text = "Navigate back" };
button.Clicked += (s, e) => Issue18193.Current.GoToAsync("..");
Content = button;
}
}

class Issue18193Page2 : ContentPage
{
public Issue18193Page2()
{
Content = new Button()
{
Text = "Navigate to page 5",
Command = new Command(async () => await Issue18193.Current.GoToAsync("//" + nameof(Issue18193Page5))),
AutomationId = "NavigateToPage5Button"
};
}
}

public class Issue18193Page3 : ContentPage { }

public class Issue18193Page4 : ContentPage { }

public class Issue18193Page5 : ContentPage { }

public class Issue18193Page6 : ContentPage
{
public Issue18193Page6()
{
var button = new Button() { AutomationId = "NavigateToDetailButton", Text = "Navigate to detail page" };
button.Clicked += (s, e) => Issue18193.Current.GoToAsync(nameof(Issue18193DetailPage));

var button2 = new Button() { AutomationId = "NavigateToPage2Button", Text = "Navigate to Page 2" };
button2.Clicked += (s, e) => Issue18193.Current.GoToAsync("//" + nameof(Issue18193Page2));
Content = new StackLayout
{
Children =
{
button,
button2
}
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#if IOS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue18193 : _IssuesUITest
{
public override string Issue => "[iOS] Navigation doesn't work on sixth tab in shell";

public Issue18193(TestDevice testDevice) : base(testDevice)
{
}

[Test]
[Category(UITestCategories.Shell)]
public void ShellNavigationShouldWorkInMoreTab()
Comment thread
mattleibow marked this conversation as resolved.
{
App.WaitForElement("NavigationToPage6Button");
App.Click("NavigationToPage6Button");
Comment thread
mattleibow marked this conversation as resolved.
App.WaitForElement("NavigateToDetailButton");
App.Click("NavigateToDetailButton");
App.WaitForElement("NavigateBackButton");
App.Click("NavigateBackButton");
App.WaitForElement("NavigateToPage2Button");
App.Click("NavigateToPage2Button");
App.WaitForElement("NavigateToPage5Button");
App.Click("NavigateToPage5Button");
App.WaitForElement("More");
App.Click("More");
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public void OneMoreControllerOpensOnFirstClick()
App.Tap("Tab 4");
App.WaitForElement("More");
App.Tap("More");
// On iOS and Mac Catalyst, the first 'more' tab goes back to tab 11, the second click goes to the 'more' menu
#if IOS || MACCATALYST
Comment thread
mattleibow marked this conversation as resolved.
App.Tap("More");
#endif
App.WaitForElement("Tab 12");
App.Tap("Tab 12");
}
Expand Down