I have a composable like here.
@Composable
fun MyBasicTextField() {
val keyboardController = LocalSoftwareKeyboardController.current
val focusRequester = remember{ FocusRequester() }
BasicTextField(
modifier = Modifier
.focusRequester(focusRequester),
keyboardActions = keyboardActions ?: KeyboardActions(onAny = { keyboardController?.hide() }),
)
LaunchedEffect(Unit) {
Log.d(TAG, "focusRequester.requestFocus()")
focusRequester.requestFocus()
}
}
- When the screen where this composable is used opens for the first time, always the keyboard is shown (above log message is visible).
- Then I leave the app at that state and open another app (opening a link on that screen, which opens the default browser for instance)
- Tapping on the BACK button (triangle) leaved the other app (e.g. webbrowser) and comes back to the initial screen: Either with opened Android keyboard on some devices or without any keyboard showing.
I have the feeling that the screen did not notice the missing keyboard (which disappreared while leaving the app for the browser) and thus does not recompose anything?
Can I flag to compose the screen from fresh everytime I re-/compose it?