Updated on 2026-08-14

This commit is contained in:
Tangem 2025-01-09 11:45:37 +03:00
parent 477a3c11dd
commit 88a80a7d3a
49 changed files with 68 additions and 70 deletions

View file

@ -2,7 +2,6 @@ package com.tangem.core.ui.components.bottomsheets
import androidx.activity.compose.BackHandler
import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.compose.foundation.background
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
@ -99,7 +98,7 @@ inline fun <reified T : TangemBottomSheetConfigContent> DefaultBottomSheet(
crossinline title: @Composable (BoxScope.(T) -> Unit),
crossinline content: @Composable (ColumnScope.(T) -> Unit),
) {
var isVisible by remember { mutableStateOf(value = config.isShow) }
var isVisible by remember { mutableStateOf(value = config.isShown) }
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = skipPartiallyExpanded)
if (isVisible && config.content is T) {
@ -114,8 +113,8 @@ inline fun <reified T : TangemBottomSheetConfigContent> DefaultBottomSheet(
)
}
LaunchedEffect(key1 = config.isShow) {
if (config.isShow) {
LaunchedEffect(key1 = config.isShown) {
if (config.isShown) {
isVisible = true
} else {
sheetState.collapse { isVisible = false }

View file

@ -3,12 +3,12 @@ package com.tangem.core.ui.components.bottomsheets
/**
* Tangem bottom sheet config
*
* @property isShow flag that determine if bottom sheet is shown
* @property isShown flag that determine if bottom sheet is shown
* @property onDismissRequest lambda be invoked when bottom sheet is dismissed
* @property content content config
*/
data class TangemBottomSheetConfig(
val isShow: Boolean,
val isShown: Boolean,
val onDismissRequest: () -> Unit,
val content: TangemBottomSheetConfigContent,
) {

View file

@ -112,7 +112,7 @@ private fun Preview_NotificationBottomSheet(
MessageBottomSheet(
config = TangemBottomSheetConfig(
content = params,
isShow = true,
isShown = true,
onDismissRequest = {},
),
)

View file

@ -279,7 +279,7 @@ private fun Preview_TokenReceiveBottomSheet(
) {
TangemThemePreview {
val config = TangemBottomSheetConfig(
isShow = true,
isShown = true,
content = params,
onDismissRequest = {},
)

View file

@ -76,7 +76,7 @@ fun EventMessageEffect(
@Composable
private fun MessageBottomSheet(message: BottomSheetMessage, onDismissRequest: () -> Unit) {
val config = TangemBottomSheetConfig(
isShow = true,
isShown = true,
content = MessageBottomSheetUM(
iconResId = message.iconResId,
title = message.title,