Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-14 12:44:16 +05:00
parent c4bbacd9c3
commit d293f60a6d
14 changed files with 60 additions and 13 deletions

View file

@ -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,
)
}
}

View file

@ -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>(