Skip to content

Commit

Permalink
Fix suggestions showing after search
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Nov 19, 2023
1 parent e72be2f commit 104497e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/shared/src/commonMain/kotlin/components/SearchBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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, {
Expand Down

0 comments on commit 104497e

Please sign in to comment.