diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt index 8341a0792c..c7913c1fc6 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt @@ -64,6 +64,13 @@ internal fun WalletScreen( val snackbarHostState = remember(::SnackbarHostState) val isAutoScroll = remember { mutableStateOf(value = false) } + var alertConfig by remember { mutableStateOf(value = null) } + + val config = alertConfig + if (config != null) { + WalletAlert(state = config, onDismiss = { alertConfig = null }) + } + WalletContent( state = state, walletsListState = walletsListState, @@ -72,14 +79,9 @@ internal fun WalletScreen( onAutoScrollReset = { isAutoScroll.value = false }, bottomSheetHeaderHeightProvider = bottomSheetHeaderHeightProvider, bottomSheetContent = bottomSheetContent, + alertConfig = alertConfig, ) - var alertConfig by remember { mutableStateOf(value = null) } - - alertConfig?.let { - WalletAlert(state = it, onDismiss = { alertConfig = null }) - } - WalletEventEffect( event = state.event, selectedWalletIndex = state.selectedWalletIndex, @@ -100,6 +102,7 @@ private fun WalletContent( bottomSheetHeaderHeightProvider: () -> Dp, onAutoScrollReset: () -> Unit, bottomSheetContent: @Composable () -> Unit, + alertConfig: WalletAlertState?, ) { var selectedWalletIndex by remember { mutableIntStateOf(state.selectedWalletIndex) } val selectedWallet = state.wallets[selectedWalletIndex] @@ -207,6 +210,7 @@ private fun WalletContent( snackbarHostState = snackbarHostState, bottomSheetHeaderHeightProvider = bottomSheetHeaderHeightProvider, bottomSheetContent = bottomSheetContent, + alertConfig = alertConfig, ) { scaffoldContent() } @@ -230,6 +234,7 @@ private fun BaseScaffoldManageTokenRedesign( snackbarHostState: SnackbarHostState, bottomSheetHeaderHeightProvider: () -> Dp, bottomSheetContent: @Composable () -> Unit, + alertConfig: WalletAlertState?, content: @Composable () -> Unit, ) { val scaffoldState = rememberBottomSheetScaffoldState() @@ -252,7 +257,7 @@ private fun BaseScaffoldManageTokenRedesign( val keyboardShown by keyboardAsState() // expand bottom sheet when keyboard appears LaunchedEffect(keyboardShown is Keyboard.Opened) { - if (keyboardShown is Keyboard.Opened) { + if (keyboardShown is Keyboard.Opened && alertConfig == null) { scaffoldState.bottomSheetState.expand() } }