SearchToolbar: Check initial search query to open keyboard by default (#9297)

This commit is contained in:
Ivan Iskandar 2023-04-06 09:15:56 +07:00 committed by GitHub
parent 88bf1a706b
commit 182e642cfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 3 deletions

View File

@ -45,7 +45,6 @@ fun BrowseSourceToolbar(
var selectingDisplayMode by remember { mutableStateOf(false) }
SearchToolbar(
initialShowKeyboard = searchQuery.isNullOrEmpty(),
navigateUp = navigateUp,
titleContent = { AppBarTitle(title) },
searchQuery = searchQuery,

View File

@ -232,7 +232,6 @@ fun SearchToolbar(
scrollBehavior: TopAppBarScrollBehavior? = null,
visualTransformation: VisualTransformation = VisualTransformation.None,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
initialShowKeyboard: Boolean = true,
) {
val focusRequester = remember { FocusRequester() }
@ -257,7 +256,7 @@ fun SearchToolbar(
.fillMaxWidth()
.focusRequester(focusRequester)
.runOnEnterKeyPressed(action = searchAndClearFocus)
.showSoftKeyboard(initialShowKeyboard)
.showSoftKeyboard(remember { searchQuery.isEmpty() })
.clearFocusOnSoftKeyboardHide(),
textStyle = MaterialTheme.typography.titleMedium.copy(
color = MaterialTheme.colorScheme.onBackground,