FlexibleBottomSheet
FlexibleBottomSheet copied to clipboard
Initial state not working and not able to be set.
- Library Version : com.github.skydoves:flexible-bottomsheet-material3:0.1.2
- Affected Device(s) : Pixel 8 Pro SDK 34
Initial state not working or not able to be set.
Tracing the library code, calling rememberFlexibleBottomSheetState calls a private function rememberFlexibleSheetState which has a default parameter of initialValue: FlexibleSheetValue = FlexibleSheetValue.Hidden. The public method does not take that parameter, however, the initial state should evaluate to hidden regardless.
In my most basic implementation, the sheet always starts off a not hidden, intermediately expanded.
val sheetState = rememberFlexibleBottomSheetState(
isModal = false
)
FlexibleBottomSheet(
windowInsets = WindowInsets(0, 0, 0, 0),
onDismissRequest = { },
sheetState = sheetState,
) {
CircularProgressIndicator()
}
}
It's not clear how to set the initial state, or if it's supported. Am I missing something obvious?
Wrapping the entire FlexibleBottomSheet in an if statement and check some state before showing works, but then it gets awkward to have a nice animation to hide it when that state changes, it would just abruptly disappear.
Expected Behaviour:
- there is a way to set the initial state value
- initial state value is respected.
I had the same problem, any idea how to solve this @skydoves ?
Checking the code seems relative easy to fix, just adding the initialValue to the public fun rememberFlexibleBottomSheetState would work.
Thanks for your time!
Any updates on this issue?