adrielcafe / voyager

🛸 A pragmatic navigation library for Jetpack Compose
https://voyager.adriel.cafe
MIT License
2.48k stars 124 forks source link

I want bottomSheet over bottomTab navigation #196

Open savan-ixfi opened 12 months ago

savan-ixfi commented 12 months ago

Screenshot_1693485875

DevSrSouza commented 10 months ago

Can you share a little piece of code? I did not understand exactly what you want and where the Voyager is the issue here.

Syer10 commented 10 months ago

Since Voyager uses the Material2 ModalBottomSheetLayout, it only wraps around the content, if you need something like that it needs to use the Material3 ModalBottomSheet which is a Popup above all other content

DevSrSouza commented 10 months ago

We should have a copy of the current Bottom Sheet module but for Material 3. We don't have the time now to on work it, but we appreciate a PR.

After 1.0.0 I will create it

Qw4z1 commented 9 months ago

@Syer10 I don't think so. I'm using the below code in my project and it works just fine. The trick is to have the BottomSheetNavigator wrap the TabNavigator and then just call LocalBottomSheetNavigator.current to get the correct navigator.

  BottomSheetNavigator {
      TabNavigator(
          HomeScreen(),
      ) 
  }
Moozart commented 1 month ago

@Qw4z1 If tab navigator tabs has Nested Navigator, and using your navigator order, tabX -> tabXParentNav -> Screen0 -> Screen1 and open BottomSheetScreen. After that calling back, back handler starts to pop from tabXParentNav until the root. If it pops all stack after that hides Bottom sheet. I think need custom back handler. Am I wrong?

Qw4z1 commented 1 month ago

@Moozart, first of all, whenever you ask yourself something like "would X work" I would recommend just creating a small sample project so you can test your assumptions for yourself.

Second, you shouldn't need a custom backhandler. I've taken the liberty of creating a small sample with the structure I proposed HERE. Feel free to fork and play around with it as you please.

Third, for some reason the back button behaves as expected on the second tab, but not on the first tab. @DevSrSouza am I doing something wrong or did I just stumble on a bug (see link to repo above)? =)

Moozart commented 1 month ago

@Qw4z1 Thanks for preparing a small project. I have spent 5-10 hours + on workarounds for Voyager. I never want to spend an extra minute for voyager, I don't want to create project and consume world energy for small project. (https://github.com/adrielcafe/voyager/issues/344, https://github.com/adrielcafe/voyager/issues/144#issuecomment-1961372747) - I customized it to manage life cycles too (https://github.com/adrielcafe/voyager/issues/410) - I use more complex key management. (https://github.com/adrielcafe/voyager/pull/128) - Too many changes were made to work with the nested nav on the bottom sheet.

My explanation was very basic and simple. I think you can understand it too. I wanted to comment in case someone sees it and takes it into consideration when choosing voyager.

Thanks again for pointing out the error of the first tab.

If you use https://github.com/adrielcafe/voyager/issues/144#issuecomment-1961372747, the error will also occur for all nested tabs. I can not create small project.