Hello! Any clue on why my bottom sheet is showing ...
# compose-android
m
Hello! Any clue on why my bottom sheet is showing when I set Hidden as the initialValue of the state?
Copy code
val bottomSheetScaffoldState = rememberBottomSheetScaffoldState(
            bottomSheetState =

            rememberStandardBottomSheetState(
                initialValue = SheetValue.Hidden,
                skipHiddenState = false
            )
        )
       BottomSheetScaffold(
            scaffoldState = bottomSheetScaffoldState,
            sheetPeekHeight = INFO_SHEET_PEEK_HEIGHT,
            sheetContent = { JobInfoSheet(jobInfoSlice = form.value.jobInfoSlice) }) {
            ... content
    }
a
Not sure, but it happens with ModalBottomSheet too.
It's annoying because we have to unnecessarily use a state variable to control showing it
m
How come something within the bottom sheet content lambda ?
j
What's the peek height?
BottomSheetScaffold
always shows at the peek height
m
It's 200dp. Which is fine . But I'd like the sheet to start hidden as the initial value I'm passing is hidden
Otherwise the API is misleading
Even more weird:
Copy code
@ExperimentalMaterial3Api
val SheetState.jobInfoPeekHeight: Dp
    get() = when(targetValue) {
        SheetValue.Hidden -> 0.dp
        else -> INFO_SHEET_PEEK_HEIGHT.dp
    }.also {
        Log.e("Marco","peekHeight: $it  target value: $targetValue")
    }
Ive created this to modify the peek property b ut it seems something its updating the state as I get the following logs
2023-09-04 215303.540 22898-22898 Marco energy.octopus.fieldservices.debug E peekHeight: 0.0.dp target value: Hidden 2023-09-04 215303.603 22898-22898 Marco energy.octopus.fieldservices.debug E peekHeight: 200.0.dp target value: PartiallyExpanded 2023-09-04 215305.421 22898-22898 Marco energy.octopus.fieldservices.debug E peekHeight: 200.0.dp target value: PartiallyExpanded