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

Fix navigation stuck on iOS when pushing on hidden tab section in TabBar #22574

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

albyrock87
Copy link
Contributor

@albyrock87 albyrock87 commented May 22, 2024

Description of Change

On iOS, the view controller DidShowViewController will not be triggered until the Tab inside TabBar becomes visible.
The code is waiting on that before switching to the new Tab, this causes a race condition.
So in this specific case, we have to complete the task immediately instead of waiting for DidShowViewController.

Issues Fixed

Contributes to #16568 by fixing the scenario when the number of tabs is <= 5 (a.k.a. no "More" tab).
See my comment below regarding "More" tab.

@albyrock87 albyrock87 requested a review from a team as a code owner May 22, 2024 11:32
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label May 22, 2024
Copy link
Contributor

Hey there @albyrock87! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@albyrock87
Copy link
Contributor Author

Build is failing for an unrelated test:

Error Message:
   Shape should not be alive!
  Stack Trace:
     at Microsoft.Maui.UnitTests.Views.ShapeTests.ShapeFillDoesNotLeak() in /_/src/Core/tests/UnitTests/Views/ShapeTests.cs:line 46

@albyrock87
Copy link
Contributor Author

Closed in favor of #22655

@albyrock87 albyrock87 closed this Jul 5, 2024
@PureWeen PureWeen reopened this Jul 10, 2024
@PureWeen PureWeen marked this pull request as draft July 10, 2024 19:45
@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@albyrock87 albyrock87 force-pushed the fix-navigation-stuck-when-pushing-on-hidden-tabbar-tab branch from fa357b9 to e3155b9 Compare July 28, 2024 09:48
@albyrock87
Copy link
Contributor Author

So here's my discovery regarding #16568 and #18193.

We're using UITabBarController as ShellItemRenderer.
Each view controller in ViewControllers is a ShellSectionRenderer which inherits from UINavigationController (in order to handle the navigation stack).

Everything's fine until we hit the limit (N>5). In this case MoreViewController enters the game.
When the user presses on the More icon, ShellItemRenderer.SelectedViewController becomes UIMoreNavigationController where the root view controller represents the list of shell sections (ViewControllers) hidden inside.

The problem starts when the user taps on one of the sub-pages list item: UIMoreNavigationController (which is a UINavigationController itself) should push ShellSectionRenderer into its stack, but what happens is that it transfers ShellSectionRenderer stack inside UIMoreNavigationController to avoid nesting UINavigationControllers (see: https://stackoverflow.com/a/11967127).

image

At this point ShellSectionRenderer.ViewControllers becomes empty, which obviously creates a very odd situation.
The stack is then transferred back when the user leaves the MoreViewController.

It seems there's no way to fix this besides creating our own "more" mechanism.

@albyrock87 albyrock87 force-pushed the fix-navigation-stuck-when-pushing-on-hidden-tabbar-tab branch from e3155b9 to 58f97ff Compare August 25, 2024 12:16
albyrock87 added a commit to nalu-development/maui-custom that referenced this pull request Oct 18, 2024
@albyrock87 albyrock87 marked this pull request as ready for review October 23, 2024 09:55
albyrock87 added a commit to nalu-development/maui-custom that referenced this pull request Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-navigation NavigationPage community ✨ Community Contribution platform/iOS 🍎
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants