I have a `TextField` inside `ModalBottomSheet`. Wh...
# compose
a
I have a
TextField
inside
ModalBottomSheet
. What I'm seeking to do is set focus on the TextField when opening the sheet, so I used:
Copy code
LaunchedEffect(Unit) {
   focusRequester.requestFocus()
}
But as you can see, the sheet shown under the keyboard when opening the sheet for some time, is there a way to ensure the sheet shown above the keyboard always?
j
It looks like the TextField is focused in the video. What are you looking for?
a
@Jonathan I think the problem is not about having the focus, but about keyboard/modal animation running in two times: first keyboard overlaps the modal and then the modal is pushed on top of it. Which seems a bit junky yes.
👌 1
j
You can prevent the TextField from getting focused until the sheet is fully expanded. Also does the TextField have the Modifier.imePadding() modifier attached so that it "dodged" the keyboard?
a
As @Anthony Mamode said, I just want to git red of the overlapping between sheet and keyboard, preventing focus on TextField until fully expanded will delay showing the keyboard. I want to push the sheet while showing the keyboard as happens when clicks on TextField
j
I’m not sure what you want is possible due to how bottom sheet animates its content into view, not sure. I was able to achieve the following fairly easily by waiting to focus the keyboard until the sheet is expanded. It doesn’t look terrible to me.
👍 2