google / accompanist

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

[Navigation Material] Prevent closing Bottom Sheet #1657

Closed danieldaeschle closed 1 year ago

danieldaeschle commented 1 year ago

I'm using a migrated version of ModalBottomSheetLayout for material3.

Everything works fine so far. But there is a use-case where I want to prevent the user from closing the BottomSheet.

Description I have a form in my BottomSheet.

  1. User fills out that form
  2. User forgets to click save
  3. User either presses back from phone, clicks into the grey area, clicks close icon inside BottomSheet or lastly drags the BottomSheet down.
  4. The BottomSheet closes without data being saved.

Interrupting back press and clicking the close icon is easy but the other two ways to close the BottomSheet are not so easy to solve. I would like to display a Dialog to the user which asks him if he want to discard the data. If he presses yes, the BottomSheet can close, otherwise it should stay open (or reopen if the user dragged it down).

Is there a way to achieve my use-case without modifying the internal code too much?

joakimtall commented 1 year ago

I came here to post exactly this issue!

danieldaeschle commented 1 year ago

Is there an update if there is a workaround or will be worked on any time soon?

github-actions[bot] commented 1 year 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.

danieldaeschle commented 1 year ago

ping

danieldaeschle commented 1 year ago

wtf, why did it get closed?

joakimtall commented 1 year ago

I guess the bot is buggy. Anyway, working on more bottom sheet stuff right now so still a priority issue for me

danieldaeschle commented 5 months ago

Any news on this?

joakimtall commented 5 months ago

Might need to make a new issue and link to this one? This process is frustrating to say the least 😅