This commit is contained in:
Roshan Varughese 2024-09-09 10:55:06 +12:00
parent 1c5a4d223c
commit f94183142f

View File

@ -149,34 +149,28 @@ private fun <T> WheelPicker(
} }
val scope = rememberCoroutineScope() 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( BasicTextField(
modifier = Modifier modifier = Modifier
.align(Alignment.Center) .align(Alignment.Center)
.showSoftKeyboard(true) .showSoftKeyboard(true)
.clearFocusOnSoftKeyboardHide { .clearFocusOnSoftKeyboardHide {
scope.launch { processManualInput()
items
.indexOfFirst { it.toString() == value.text }
.takeIf { it >= 0 }
?.apply {
internalOnSelectionChanged(this)
lazyListState.scrollToItem(this)
}
showManualInput = false
}
}, },
onKeyboardAction = { onKeyboardAction = {
scope.launch { processManualInput()
items
.indexOfFirst { it.toString() == value.text }
.takeIf { it >= 0 }
?.apply {
internalOnSelectionChanged(this)
lazyListState.scrollToItem(this)
}
showManualInput = false
}
}, },
state = value, state = value,
lineLimits = TextFieldLineLimits.SingleLine, lineLimits = TextFieldLineLimits.SingleLine,