mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-26 14:53:41 +03:00
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:
parent
25737ac22b
commit
12ae69f06e
1 changed files with 15 additions and 13 deletions
|
@ -149,23 +149,25 @@ private fun <T> WheelPicker(
|
|||
}
|
||||
|
||||
val scope = rememberCoroutineScope()
|
||||
val processManualInput: () -> Unit = {
|
||||
scope.launch {
|
||||
items
|
||||
.indexOfFirst { it.toString() == value.text }
|
||||
.takeIf { it >= 0 }
|
||||
?.apply {
|
||||
internalOnSelectionChanged(this)
|
||||
lazyListState.scrollToItem(this)
|
||||
}
|
||||
showManualInput = false
|
||||
}
|
||||
}
|
||||
|
||||
BasicTextField(
|
||||
modifier = Modifier
|
||||
.align(Alignment.Center)
|
||||
.showSoftKeyboard(true)
|
||||
.clearFocusOnSoftKeyboardHide {
|
||||
scope.launch {
|
||||
items
|
||||
.indexOfFirst { it.toString() == value.text }
|
||||
.takeIf { it >= 0 }
|
||||
?.apply {
|
||||
internalOnSelectionChanged(this)
|
||||
lazyListState.scrollToItem(this)
|
||||
}
|
||||
|
||||
showManualInput = false
|
||||
}
|
||||
},
|
||||
.clearFocusOnSoftKeyboardHide(processManualInput),
|
||||
onKeyboardAction = { processManualInput() },
|
||||
state = value,
|
||||
lineLimits = TextFieldLineLimits.SingleLine,
|
||||
keyboardOptions = KeyboardOptions(
|
||||
|
|
Loading…
Reference in a new issue