Removed the delay and requestFocus() as it suddenly works without

This commit is contained in:
dankito 2024-09-05 00:13:43 +02:00
parent c80d75c409
commit 40ae222dfc
1 changed files with 0 additions and 8 deletions

View File

@ -39,8 +39,6 @@ fun <T> AutocompleteTextFieldNew(
var suggestionsFetchJob: Job? = null
val textFieldFocus = remember { FocusRequester() }
val keyboardController = LocalSoftwareKeyboardController.current
val interactionSource = remember { MutableInteractionSource() }
val coroutineScope = rememberCoroutineScope()
@ -57,11 +55,6 @@ fun <T> AutocompleteTextFieldNew(
if (expanded == false && suggestions.isNotEmpty()) {
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()
}
},
interactionSource = interactionSource,
label = { Text(label) },
maxLines = 1,
trailingIcon = {