I have a TextField in ModalBottomSheet.
If i open the TextField and focus on it, i cannot close either the textField or the ModalBottomSheet.
I’ve seen some GoogleBugFixe, but no one is working even when i’m upgrading to the latest version of every libraries.
This is a weird behaviour.
Can someone help me please ?
ps : I have OnBackGestureEnabled = true
BackHandler(keyboardIsOpen) {
if (keyboardIsOpen)
localFocus.clearFocus()
}
if (openBottomSheet) {
ModalBottomSheet(
onDismissRequest = { openBottomSheet = false },
sheetState = bottomSheetState,
shape = RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp),
containerColor = White,
contentWindowInsets = { WindowInsets(0) }
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(start = 16.dp, end = 16.dp, bottom = 4.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Card(
modifier = Modifier
.padding(horizontal = 16.dp)
.size(150.dp),
colors = CardDefaults.cardColors(
containerColor = uiState.spaceColor
),
shape = RoundedCornerShape(12.dp)
) {
uiState.spaceBitmap?.let {
Image(
modifier = Modifier
.fillMaxSize()
.padding(6.dp)
.clip(RoundedCornerShape(6.dp)),
bitmap = it.asImageBitmap(),
contentDescription = "Image Space",
contentScale = ContentScale.Crop
)
}
if (uiState.spaceBitmap == null) {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Icon(
modifier = Modifier.size(60.dp),
imageVector = uiState.spaceIcon ?: Icons.Rounded.Kitchen,
contentDescription = uiState.spaceIcon?.name ?: Icons.Rounded.Kitchen.name,
tint = uiState.spaceColor.generateOnColor()
)
}
}
}
Spacer12()
SpaceModifyTextField(
modifier = Modifier
.fillMaxWidth()
.clearFocusOnKeyboardDismiss(),
query = uiState.spaceName,
hint = "Entrez un nom",
localFocusManager = localFocusManager,
onQueryChanged = spaceDetailsViewModel::setSpaceName
)
Spacer8()
IconListRow(
isPremium = uiState.isPremiumActive,
spaceColor = uiState.spaceColor,
selectedIcon = uiState.spaceIcon,
launchCamera = {
localFocusManager.clearFocus()
spaceDetailsViewModel.launchCamera(true)
},
onPremiumFeature = toPremium,
setSpaceIcon = {
localFocusManager.clearFocus()
spaceDetailsViewModel.setSpaceIcon(it)
}
)
}
}
}