Updated on 2026-08-14
This commit is contained in:
parent
c4bbacd9c3
commit
d293f60a6d
14 changed files with 60 additions and 13 deletions
|
|
@ -10,10 +10,15 @@ package com.tangem.core.ui.components.bottomsheets
|
|||
data class TangemBottomSheetConfig(
|
||||
val isShown: Boolean,
|
||||
val onDismissRequest: () -> Unit,
|
||||
val dismissOnClickOutside: () -> Boolean = { true },
|
||||
val content: TangemBottomSheetConfigContent,
|
||||
) {
|
||||
|
||||
companion object {
|
||||
val Empty = TangemBottomSheetConfig(false, {}, TangemBottomSheetConfigContent.Empty)
|
||||
val Empty = TangemBottomSheetConfig(
|
||||
isShown = false,
|
||||
onDismissRequest = {},
|
||||
content = TangemBottomSheetConfigContent.Empty,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -88,7 +88,17 @@ inline fun <reified T : TangemBottomSheetConfigContent> DefaultModalBottomSheetW
|
|||
noinline footer: @Composable (BoxScope.(T) -> Unit)?,
|
||||
) {
|
||||
var isVisible by remember { mutableStateOf(value = config.isShown) }
|
||||
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = skipPartiallyExpanded)
|
||||
val sheetState = rememberModalBottomSheetState(
|
||||
skipPartiallyExpanded = skipPartiallyExpanded,
|
||||
confirmValueChange = { sheetValue ->
|
||||
if (config.dismissOnClickOutside().not()) {
|
||||
// Ignore transitions to hidden (prevents dismiss on outside click/back press)
|
||||
sheetValue != SheetValue.Hidden
|
||||
} else {
|
||||
true
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
if (isVisible && config.content is T) {
|
||||
BasicModalBottomSheetWithFooter<T>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue