Removed the delay and requestFocus() as it suddenly works without
This commit is contained in:
parent
c80d75c409
commit
40ae222dfc
|
@ -39,8 +39,6 @@ fun <T> AutocompleteTextFieldNew(
|
||||||
var suggestionsFetchJob: Job? = null
|
var suggestionsFetchJob: Job? = null
|
||||||
|
|
||||||
val textFieldFocus = remember { FocusRequester() }
|
val textFieldFocus = remember { FocusRequester() }
|
||||||
val keyboardController = LocalSoftwareKeyboardController.current
|
|
||||||
val interactionSource = remember { MutableInteractionSource() }
|
|
||||||
|
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
|
|
||||||
|
@ -57,11 +55,6 @@ fun <T> AutocompleteTextFieldNew(
|
||||||
if (expanded == false && suggestions.isNotEmpty()) {
|
if (expanded == false && suggestions.isNotEmpty()) {
|
||||||
expanded = true
|
expanded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delay to ensure menu is fully displayed before requesting focus
|
|
||||||
delay(100)
|
|
||||||
textFieldFocus.requestFocus() // Request focus back to TextField
|
|
||||||
keyboardController?.show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +79,6 @@ fun <T> AutocompleteTextFieldNew(
|
||||||
fetchSuggestionsAsync()
|
fetchSuggestionsAsync()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
interactionSource = interactionSource,
|
|
||||||
label = { Text(label) },
|
label = { Text(label) },
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
|
|
Loading…
Reference in New Issue