Fix WheelPicker Manual Input (#1209)

* Fix WheelPicker Manual Input

* Lambda

* inline

* Update WheelPicker.kt

---------

Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
(cherry picked from commit 339dc33f5833b224c01577da3da081deecdbbca2)
This commit is contained in:
Roshan Varughese 2024-09-15 02:43:03 +12:00 committed by Secozzi
parent 25737ac22b
commit 12ae69f06e
No known key found for this signature in database
GPG key ID: DD93E0B3A962AA86

View file

@ -149,11 +149,7 @@ private fun <T> WheelPicker(
}
val scope = rememberCoroutineScope()
BasicTextField(
modifier = Modifier
.align(Alignment.Center)
.showSoftKeyboard(true)
.clearFocusOnSoftKeyboardHide {
val processManualInput: () -> Unit = {
scope.launch {
items
.indexOfFirst { it.toString() == value.text }
@ -162,10 +158,16 @@ private fun <T> WheelPicker(
internalOnSelectionChanged(this)
lazyListState.scrollToItem(this)
}
showManualInput = false
}
},
}
BasicTextField(
modifier = Modifier
.align(Alignment.Center)
.showSoftKeyboard(true)
.clearFocusOnSoftKeyboardHide(processManualInput),
onKeyboardAction = { processManualInput() },
state = value,
lineLimits = TextFieldLineLimits.SingleLine,
keyboardOptions = KeyboardOptions(