Updated on 2026-08-14
This commit is contained in:
parent
4e38f0e822
commit
897e2f223a
2 changed files with 4 additions and 12 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 64ae04d2086e5a605dd4da3cba4af32a60d46c79
|
||||
Subproject commit 985642c135606ba1f59fd739127aec03024da79b
|
||||
|
|
@ -1,11 +1,9 @@
|
|||
package com.tangem.tap.common.compose.extensions
|
||||
|
||||
import android.content.Context
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import com.tangem.tap.common.extensions.hideKeyboard
|
||||
|
||||
@Composable
|
||||
fun LazyListState.OnBottomReached(loadMoreThreshold: Int, loadMore: () -> Unit) {
|
||||
|
|
@ -25,13 +23,7 @@ fun LazyListState.OnBottomReached(loadMoreThreshold: Int, loadMore: () -> Unit)
|
|||
|
||||
@Composable
|
||||
fun LazyListState.HideKeyboardOnScroll() {
|
||||
val context = LocalContext.current
|
||||
val view = LocalView.current
|
||||
LaunchedEffect(firstVisibleItemIndex) {
|
||||
if (firstVisibleItemIndex > 1) {
|
||||
val inputMethodManager =
|
||||
context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0)
|
||||
}
|
||||
if (isScrollInProgress) {
|
||||
LocalView.current.hideKeyboard()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue