diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheetWithFooter.kt b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheetWithFooter.kt index 479fe79469..643453a4bc 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheetWithFooter.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/bottomsheets/modal/TangemModalBottomSheetWithFooter.kt @@ -32,6 +32,7 @@ import com.tangem.core.ui.res.LocalBottomSheetAlwaysVisible import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemThemePreview import com.tangem.core.ui.utils.WindowInsetsZero +import com.tangem.core.ui.utils.toPx /** * Modal bottom sheet with [content], [footer] and optional [title]. @@ -154,6 +155,21 @@ inline fun BasicModalBottomSheetWit val initial = 0 val scrollState = rememberScrollState(initial = initial) + val isKeyboardOpen by rememberIsKeyboardVisible() + val buttonHeight = TangemTheme.dimens.spacing80 + val contentBottomPadding = TangemTheme.dimens.spacing80 + // Offset calculation for keyboard scroll adjustment: + // 1) Button height (footer) + // 2) Column content bottom padding + // 3) Additional spacing (40dp) for visual comfort when keyboard is open + val scrollOffset = buttonHeight.toPx() + buttonHeight.toPx() + 40.dp.toPx() + + LaunchedEffect(isKeyboardOpen) { + if (isKeyboardOpen) { + scrollState.animateScrollTo(scrollState.value + scrollOffset.toInt()) + } + } + Column( modifier = Modifier .systemBarsPadding() @@ -186,7 +202,7 @@ inline fun BasicModalBottomSheetWit Column( modifier = Modifier .verticalScroll(state = scrollState) - .padding(bottom = TangemTheme.dimens.spacing80), + .padding(bottom = contentBottomPadding), ) { content(model) } @@ -199,7 +215,7 @@ inline fun BasicModalBottomSheetWit Box( modifier = Modifier .fillMaxWidth() - .height(80.dp) + .height(buttonHeight) .align(Alignment.BottomCenter), ) { footer(model)