FlexibleBottomSheet icon indicating copy to clipboard operation
FlexibleBottomSheet copied to clipboard

I don't know how to disable hiding

Open akurbanoff opened this issue 1 year ago • 8 comments

I tried to find option to disable hide Bottom Sheet when I dismiss, but I didn't find the solution, can you explain?

akurbanoff avatar Dec 14 '23 17:12 akurbanoff

What do you mean by disabling hiding the bottom sheet when you dismiss? Isn't it meant to be the same as not dismissing?

skydoves avatar Dec 15 '23 08:12 skydoves

What do you mean by disabling hiding the bottom sheet when you dismiss? Isn't it meant to be the same as not dismissing?

I mean that I want to block hiding bottom sheet by user. As I understand bottom sheet animates to Hidden when user dismiss this sheet, but I want to disable this feature for users. I trued to manage this state in another function using show(), slightlyExpand() and so on to expand sheet when user dismiss sheet, but it doesn't work if user tries to hide sheet by slow sliding down, but if it fast everything works. I want to allow every state except Hidden

akurbanoff avatar Dec 15 '23 14:12 akurbanoff

@Uspesh Sounds interesting. Let me consider implementing the skipHidden property.

skydoves avatar Dec 21 '23 15:12 skydoves

I tried to find option to disable hide Bottom Sheet when I dismiss, but I didn't find the solution, can you explain?

I created a tricky solution for this. Here is the code:

var flexibleSheetValue by remember { mutableStateOf(FlexibleSheetValue.SlightlyExpanded) }
val flexibleBottomSheetState = rememberFlexibleBottomSheetState(
    . . .
    confirmValueChange = {
        flexibleSheetValue = it
        true
    }
)
LaunchedEffect(key1 = flexibleSheetValue) {
    when (flexibleSheetValue) {
        FlexibleSheetValue.SlightlyExpanded -> flexibleBottomSheetState.slightlyExpand()
        FlexibleSheetValue.IntermediatelyExpanded -> flexibleBottomSheetState.intermediatelyExpand()
        FlexibleSheetValue.FullyExpanded -> flexibleBottomSheetState.fullyExpand()
        else -> flexibleBottomSheetState.slightlyExpand()
    }
}

muhammedesadcomert avatar Jan 14 '24 20:01 muhammedesadcomert

or, you could do like this:

sheetState = rememberFlexibleBottomSheetState( ... confirmValueChange = { it != FlexibleSheetValue.Hidden } )

binishmatheww avatar Feb 10 '24 19:02 binishmatheww

or, you could do like this:

sheetState = rememberFlexibleBottomSheetState( ... confirmValueChange = { it != FlexibleSheetValue.Hidden } )

this still hides the bottom sheet on a system back back event @skydoves can u help here?

v01dn3ph1l1m avatar Mar 31 '24 15:03 v01dn3ph1l1m

Any updates about this feature @skydoves ?

cacato86 avatar May 09 '24 12:05 cacato86

@skydoves any plans to address this?

nilufer32 avatar May 14 '24 10:05 nilufer32

Hi everyone, apologies for the delayed response. Since version 0.1.3, you can prevent the bottom sheet from hiding and keep it displayed across user actions by setting the skipHiddenState property to true.

val sheetState = rememberFlexibleBottomSheetState(
    skipHiddenState = true,
    ..
)

I appreciate your patience!

skydoves avatar Jun 06 '24 07:06 skydoves