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

[Navigation CodeLab] Account type is not Changing and navigating to Overview Screen #376

Open
amandeepcodes opened this issue Aug 15, 2023 · 1 comment
Assignees

Comments

@amandeepcodes
Copy link

When I am clicking on any AccountType it is showing only the first clicked Account Type in Navigation and also when it is showing Single Account screen, Navigation moves to Overview Tab.

navigation issue

@remain-maomao
Copy link

when I am following the this codelab, I found the same problem you mentioned above, to confirm this problem, I downloaded the end version code, and the end version code indeed had the bug, so I sloved it.

the problem occurred because this line of code.
val currentScreen = rallyTabRowScreens.find { it.route == currentDestination?.route } ?: Overview

for a quick answer, just replace it with this line:
val currentScreen = rallyTabRowScreens.find { it.route == currentDestination?.route || (it == Accounts && currentDestination?.route?.startsWith( SingleAccount.route ) == true) } ?: Overview

for a deep explanation, continue to read. when you navigate the single_account, actually this page's route can be one of the following:

  • single_account/Checking
  • single_account/Home Savings
  • single_account/Car Savings

of course, all of them can not match the tab routes: overview, accounts, bills, so the original code fall back to the overview page.

to solve this, you just need to add a condition to say that if the current route beyond the tab routes, but it starts with single_account, then the accounts tab should be highlighted.

hope this can answer your question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants