I have the following issue in compose.
I have a ModalBottomSheet which has a TextField. The keyboard does not show up when I click inside the text field. On an emulator I can type in some input with my computer keyboard shows up. On a real device though I don't have that possibility with makes the ModalBottomSheet useless.
I read this article about the same issue and there identifying the version compose-ui 1.4.0 as source of the problem. So I went to this page where they state that the issue has been fixed with version. After updating my gradle as follows the keyboard still does not show up.
implementation "androidx.compose.material3:material3:1.1.0-rc01"
implementation "androidx.compose.material3:material3-window-size-
class:1.1.0-rc01"
implementation 'androidx.compose.ui:ui:1.4.2'
In case someone comes across here with a similar issue, ensure you have the isFocusable set to true (see below):
ModalBottomSheet(
onDismissRequest = onDismissRequest,
dragHandle = null,
containerColor = Color.Transparent,
scrimColor = Color.Transparent,
modifier = Modifier
.fillMaxSize()
.statusBarsPadding()
.navigationBarsPadding(),
sheetState = sheetState,
shape = RectangleShape,
properties = ModalBottomSheetProperties(
securePolicy = SecureFlagPolicy.SecureOff,
isFocusable = true, // IMPORTANT!!! This must be true so TextField can show keyboard
shouldDismissOnBackPress = false
)
) {
CheckoutSheetScaffold(checkout = checkout, onDismissRequest = onDismissRequest)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With