From 104497e49a92445b62cfac253fc8d34873b7fb16 Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Sun, 19 Nov 2023 18:33:42 +0100 Subject: [PATCH] Fix suggestions showing after search --- app/shared/src/commonMain/kotlin/components/SearchBar.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/shared/src/commonMain/kotlin/components/SearchBar.kt b/app/shared/src/commonMain/kotlin/components/SearchBar.kt index 5b8a1b9..c2aadef 100644 --- a/app/shared/src/commonMain/kotlin/components/SearchBar.kt +++ b/app/shared/src/commonMain/kotlin/components/SearchBar.kt @@ -18,8 +18,6 @@ import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.rotate -import androidx.compose.ui.focus.FocusRequester -import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.input.key.* import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp @@ -51,7 +49,6 @@ fun SearchBar(updateSounds: SoundUpdater) { var selectedSuggestion by remember(showSuggestions) { mutableStateOf(-1) } val scope = rememberCoroutineScope() val updates = remember { MutableStateFlow(value) } - val focusRequester = remember { FocusRequester() } fun updateSearch(to: String) { updates.tryEmit(to) @@ -100,8 +97,8 @@ fun SearchBar(updateSounds: SoundUpdater) { true }) { DockedSearchBar( - value, ::updateSearch, { focusRequester.freeFocus() }, showSuggestions, ::showSuggestions, - modifier = Modifier.fillMaxWidth().padding(horizontal = 5.dp).focusRequester(focusRequester), + value, ::updateSearch, { showSuggestions(false) }, showSuggestions, ::showSuggestions, + modifier = Modifier.fillMaxWidth().padding(horizontal = 5.dp), placeholder = { Text(strings.searchExplainer, color = ColorScheme.current.textColor.copy(alpha = .7f)) }, trailingIcon = { TrailingIcon(value, {