Hello… Is there any workaround to make `BringIntoV...
# compose
n
Hello… Is there any workaround to make
BringIntoViewRequester
works in the following situation: 1.
TextField
is at the bottom of the screen and the user tap on it and it gain focus. 2. System keyboard is displayed and the
TextField
becoming visible because of the following:
Copy code
Modifier.bringIntoViewRequester(bringIntoViewRequester)
.onFocusChanged {
    if (it.isFocused) {
        coroutineScope.launch {
            delay(300)
            bringIntoViewRequester.bringIntoView()
        }
    }
}
3. The user now press the system back key and the keyboard is closed, but the
TextField
still has focus. 4. Finally, if the user tap on the
TextField
again. The keyboard is opened on top of the
TextField
and the
BringIntoViewRequester
is not triggered again because the focus haven’t changed. I know there’s a ticket kinda related to this… https://issuetracker.google.com/u/0/issues/192043120 Any suggestion?
r
You should use another event called
onFocusEvent
n
onFocusEvent
is triggered several times.
r
Copy code
.onFocusEvent { state ->
  if (state.isFocused) { ...
n
I remember that I have tried this before and didn’t worked. But I tried it now and worked… Let me see if I’ll get any bad side effect 🙂 Thanks @rsktash
147 Views