skydoves / FlexibleBottomSheet

🐬 Advanced Compose Multiplatform bottom sheet for segmented sizing, non-modal type, and allows interaction behind the bottom sheet similar to Google Maps.
Apache License 2.0
687 stars 30 forks source link

I don't know how to disable hiding #5

Closed akurbanoff closed 2 weeks ago

akurbanoff commented 6 months ago

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

skydoves commented 6 months ago

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

akurbanoff commented 6 months ago

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

skydoves commented 6 months ago

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

muhammedesadcomert commented 5 months ago

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()
    }
}
binishmatheww commented 4 months ago

or, you could do like this:

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

v01dn3ph1l1m commented 3 months ago

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?

cacato86 commented 1 month ago

Any updates about this feature @skydoves ?

nilufer32 commented 1 month ago

@skydoves any plans to address this?

skydoves commented 4 weeks ago

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!