Updated on 2026-08-14

This commit is contained in:
Tangem 2022-06-10 13:06:35 +04:00
parent 66e7c424f0
commit 4e38f0e822

View file

@ -28,8 +28,10 @@ fun LazyListState.HideKeyboardOnScroll() {
val context = LocalContext.current
val view = LocalView.current
LaunchedEffect(firstVisibleItemIndex) {
val inputMethodManager =
context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0)
if (firstVisibleItemIndex > 1) {
val inputMethodManager =
context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0)
}
}
}