Skip to content

Commit

Permalink
Lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
Animeboynz committed Sep 9, 2024
1 parent 1c5a4d2 commit f941831
Showing 1 changed file with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,34 +149,28 @@ 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
}
processManualInput()
},
onKeyboardAction = {
scope.launch {
items
.indexOfFirst { it.toString() == value.text }
.takeIf { it >= 0 }
?.apply {
internalOnSelectionChanged(this)
lazyListState.scrollToItem(this)
}
showManualInput = false
}
processManualInput()
},
state = value,
lineLimits = TextFieldLineLimits.SingleLine,
Expand Down

0 comments on commit f941831

Please sign in to comment.