android: hide keyboard when not needed (#4689)

* android: hide keyboard when not needed

* revert some parts

* more places

* unused

* delay

* comment
This commit is contained in:
Stanislav Dmitrenko
2024-08-14 17:59:53 +00:00
committed by GitHub
parent e9baeba31f
commit 789c762c81
3 changed files with 36 additions and 4 deletions
@@ -36,11 +36,12 @@ import chat.simplex.common.model.ChatController.appPrefs
import chat.simplex.common.model.ChatModel
import chat.simplex.common.ui.theme.CurrentColors
import chat.simplex.common.views.chat.*
import chat.simplex.common.views.helpers.SharedContent
import chat.simplex.common.views.helpers.generalGetString
import chat.simplex.common.views.helpers.*
import chat.simplex.res.MR
import dev.icerock.moko.resources.StringResource
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.filter
import java.lang.reflect.Field
import java.net.URI
@@ -84,6 +85,13 @@ actual fun PlatformTextField(
freeFocus = true
}
}
LaunchedEffect(Unit) {
snapshotFlow { ModalManager.start.modalCount.value }
.filter { it > 0 }
.collect {
freeFocus = true
}
}
val isRtl = LocalLayoutDirection.current == LayoutDirection.Rtl
AndroidView(modifier = Modifier, factory = {