android / compose-samples

Official Jetpack Compose samples.
https://developer.android.com/jetpack/compose
Apache License 2.0
19.82k stars 4.71k forks source link

[Bug]: ModelBottomSheet Overlap with NavigationBars Android Compose #1430

Open chauhanazad opened 2 months ago

chauhanazad commented 2 months ago

Is there an existing issue for this?

Is there a StackOverflow question about this issue?

Is this an issue related to one of the samples?

Sample app

Other (bug not related to sample app)

What happened?

Below is the code, ModalBottomsheet overlap with Navigationbars. I tried adding padding but still same.

ModalBottomSheet(
        onDismissRequest = {
            onDismiss()
        },
        sheetState = bottomSheetState,
        modifier = Modifier.windowInsetsPadding(WindowInsets.navigationBars),
        windowInsets = WindowInsets.ime,
        content = {
            Column(
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(start = 16.dp, end = 16.dp),
                horizontalAlignment = Alignment.CenterHorizontally,
            ) {
                TextField(
                    value = accountName,
                    onValueChange = { accountName = it },
                    placeholder = {
                        Text(
                            text = stringResource(id = R.string.account_name_hint),
                            fontFamily = FontFamily(Font(R.font.opensans_regular))
                        )
                    },
                    textStyle = TextStyle.Default.copy(
                        fontSize = 20.sp,
                        fontFamily = FontFamily(Font(R.font.opensans_medium))
                    ),
                    colors = TextFieldDefaults.colors(
                        unfocusedContainerColor = Color.White,
                        disabledTextColor = Color.Transparent,
                        focusedIndicatorColor = Color.Transparent,
                        unfocusedIndicatorColor = Color.Transparent,
                        disabledIndicatorColor = Color.Transparent
                    ),
                    modifier = Modifier
                        .shadow(shape = RoundedCornerShape(8.dp), elevation = 2.dp)
                        .fillMaxWidth(),
                    isError = accountNameError.value,
                    singleLine = true,

                    )
}
}

Relevant logcat output

No response

Code of Conduct

moksh-tehlan commented 1 month ago

can u add a screenshot?? and also in which app?