Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModalBottomSheetLayout not opening when closing the keyboard simultaneaously inside Fragment #130

Open
sarthak-paytail opened this issue Jan 8, 2023 · 0 comments

Comments

@sarthak-paytail
Copy link

sarthak-paytail commented Jan 8, 2023

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") } } } } }

@sarthak-paytail sarthak-paytail changed the title ModalBottomSheetLayout not opening when closing the keyboard simultaneaously ModalBottomSheetLayout not opening when closing the keyboard simultaneaously inside Fragment Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant