Open edgiardina opened 1 year ago
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Verified this issue with Visual Studio Enterprise 17.9.0 Preview 5. Can repro on iOS platform with sample project. https://github.com/edgiardina/MauiBug_iOS_AppAction_Navigation_Tabbar
I found out it has nothing to do with app actions (at least for me). GoToAsync is bugged in iOS for navigating to another Tab's subpage - awaiting it hangs until you switch Tab manually.
Workaround (not sure why it even works, but I tried it out of desperation and it actually does... There has to be some important synchronous code executing within GoToAsync):
var x = Shell.Current.GoToAsync("//main/tab3/subpage", navigationParameter);
#if IOS
Shell.Current.CurrentItem.CurrentItem = Shell.Current.CurrentItem.Items[2];
#endif
await x;
where main
is the Route name of the TabBar.
If you change the active tab (setting CurrentItem) before calling GoToAsync, you first see //main/tab3
and from there subpage
being pushed upon. If you do it like in the snippet above, it navigates to the subpage directly, without showing tab3
in between.
Additional (simpler) information and a (simpler) how to reproduce repository:
On iOS, using TabBar and navigating to a new Tab also pushing a page onto the navigation stack does not work:
var shell = Shell.Current;
try
{
// "main" is the `TabBar`
// "Foo" is a different `ShellContent`
// "Bar" is a page registered in the `Routing`
await shell.GoToAsync("//main/Foo/Bar");
}
catch (Exception ex)
{
// Add breakpoint here => not hit
Console.WriteLine(ex.Message);
}
finally
{
// Add breakpoint here => not hit
Console.WriteLine("Finally");
}
https://github.com/albyrock87/maui-shell-issues/blob/main/MainPage.xaml.cs#L14-L28
8.0.40 SR5
Description
If you have a Tabbar as the primary shell control, and navigate using AppActions (or applinks, for that matter) with a subpage, the tabbar fails to switch to the selected tab.
Steps to Reproduce
Create an app action to navigate to a path like
//page1/subpage
AppActions which only have a top level route like
//page
will work. AppActions with a subpage route will not change the current tab. Interestingly, if you manually navigate to the tab, you can see the subpage navigation was added, but the selected and visible tab from the tabbar is not shown.Link to public reproduction project repository
https://github.com/edgiardina/MauiBug_iOS_AppAction_Navigation_Tabbar
Version with bug
7.0.86
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 16.4 but suspect all versions
Did you find any workaround?
No response
Relevant log output
No response