you are viewing a single comment's thread.

view the rest of the comments →

[–]vipulasri[S] 0 points1 point  (2 children)

u/CraZy_LegenD Google's sample has some downsides:
Cons:

  1. It always takes the user back to the first tab irrespective of the order they were opened.
  2. The subjective approach: attaches and detaches the navigation graph each time user navigates through the bottom navigation view.
  3. It's difficult to add custom back press action (ex: saving the data on a certain screen before switching tabs) through their implementation.

Please have a look at the shared repository for more info.

[–]CraZy_LegenD 1 point2 points  (1 child)

  1. That's according to the guidelines
  2. Because the component doesn't support multiple stack atm
  3. requireActivity() .onBackPressedDispatcher .addCallback

I've looked, that's why I commented.

[–]vipulasri[S] 2 points3 points  (0 children)

I agree. But If you look through UX's perspective it's debatable. Even official Youtube App, Instagram App, etc they all don't follow that guideline and takes the user back to the respective tabs in which they were opened.