-
Notifications
You must be signed in to change notification settings - Fork 304
Description
If my keyboard is opened, then on clicking of button if i try to hide my keyboard and change sheetState to show() then my keyboard hides but my sheet is not visible.
Mimicing opening of sheetState on result from api call.
Note - Sheet is shown for first time only. Its also working fine on emulator on Api level 33 but not below that
Note - If using preview then its working fine, but if using it inside fragment then its not working
Link to StackOverflow - https://stackoverflow.com/questions/74958610/bottom-sheet-not-being-shown-if-hiding-keyboard?noredirect=1#comment132284233_74958610
setContent { val sheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden) val key = LocalSoftwareKeyboardController.current ModalBottomSheetLayout( sheetState = sheetState, sheetContent = { repeat(20) { Text(text = "$it") } } ) { Column { var otpResponse by remember { mutableStateOf<Boolean?>(null) } if (otpResponse == false) { LaunchedEffect(key1 = Unit, block = { delay(180) otpResponse = true }) } if (otpResponse == true) { LaunchedEffect(key1 = Unit, block = { sheetState.show() }) } Column { var string by remember { mutableStateOf("") } TextField(value = string, onValueChange = { string = it }) Button(onClick = { key?.hide() otpResponse = false }) { Text(text = "TEST") } } } } }