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 authored and GitHub committed 2024-08-14 18:59:53 +01:00
1 parent e9baeba31f
commit 789c762c81
3 files changed
+36 -4

No files matched your search

@@ -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 = {