Skip to content

Commit

Permalink
Merge pull request #513 from 07jasjeet/main
Browse files Browse the repository at this point in the history
Search Screen: Minor UX fix
  • Loading branch information
07jasjeet authored Dec 27, 2024
2 parents 6ec7c05 + 7c2e1f2 commit 1fa26e5
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusManager
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.LocalWindowInfo
import androidx.compose.ui.platform.SoftwareKeyboardController
Expand All @@ -44,6 +46,7 @@ fun <T> SearchScreen(
},
onErrorShown: () -> Unit,
focusRequester: FocusRequester = remember { FocusRequester() },
focusManager: FocusManager = LocalFocusManager.current,
window: WindowInfo = LocalWindowInfo.current,
content: @Composable () -> Unit
) {
Expand Down Expand Up @@ -112,6 +115,7 @@ fun <T> SearchScreen(
.pointerInput(key1 = "Keyboard") {
// Tap to hide keyboard.
detectTapGestures {
focusManager.clearFocus()
keyboardController?.hide()
}
}
Expand Down

0 comments on commit 1fa26e5

Please sign in to comment.