google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.46k stars 599 forks source link

[Navigation Material] Wish to custom behavior of OnSheetDismissed for bottom sheet #1278

Closed dennisbordet closed 2 years ago

dennisbordet commented 2 years ago

Description After navigating like this: composable(screen1) → bottomSheet(bottom1) → bottomSheet(bottom2)

Then user dismissed bottomSheet(bottom2) by clicking on backdrop or swipe down

Expected behavior I wish I could go directly back to composable(screen1).

https://user-images.githubusercontent.com/83081700/182813568-74e625e8-8ded-454a-ac47-3b50297bf776.mov

Actual behavior Acting like back button → go back on bottomSheet(bottom1)

Solution 1 Make BottomSheetNavigator and its sheetContent attribute open to make possible to developers to override and chose the behavior. By doing it, you need to alter visibility of some other attributes.

Solution 2 Add an optional function in parameter on BottomSheetNavigator to define a custom behavior for OnSheetDismissed if the function is not null.

Solution 3 Add a parameter on BottomSheetNavigator to tell if dismiss should act like back button or dismiss the entire chain of bottom sheets

Example You can find an example of solution 1 on my sample repository: https://github.com/bamlab/android-navigable-bottom-sheet

PS : If there is another solution to my problem in the current version of the library (0.25.0). Let me know !

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

jossiwolf commented 2 years ago

Tracking this in #1317 :)