Fixed focusing next focusable element after selecting an item
This commit is contained in:
parent
1a64f24457
commit
e08df3b871
|
@ -13,9 +13,7 @@ import androidx.compose.material.icons.filled.Close
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusDirection
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.*
|
||||
import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
|
@ -50,6 +48,7 @@ fun <T> AutocompleteTextField(
|
|||
Box(Modifier.fillMaxWidth()) {
|
||||
OutlinedTextField(
|
||||
value = searchQuery,
|
||||
singleLine = true,
|
||||
onValueChange = { query ->
|
||||
searchQuery = query
|
||||
onValueChange(null)
|
||||
|
@ -88,7 +87,8 @@ fun <T> AutocompleteTextField(
|
|||
suggestions = emptyList()
|
||||
expanded = false
|
||||
onValueChange(null)
|
||||
}
|
||||
textFieldFocus.requestFocus()
|
||||
}.focusProperties { canFocus = false }
|
||||
)
|
||||
}
|
||||
},
|
||||
|
@ -113,6 +113,8 @@ fun <T> AutocompleteTextField(
|
|||
searchQuery = it.invoke(item)
|
||||
}
|
||||
expanded = false
|
||||
|
||||
textFieldFocus.freeFocus()
|
||||
focusManager.moveFocus(FocusDirection.Down)
|
||||
}
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue