I have OutlinedTextField like so.
OutlinedTextField(
value = value,
onValueChange = {
value = it
},
keyboardActions = KeyboardActions(
onDone = {
onResult(value)
}
),
modifier = Modifier
.fillMaxWidth()
.height(26.dp)
.focusRequester(focusRequester),
singleLine = true,
maxLines = 1
)
under the hood, I used BaseTextField and I just set keyboardActions there like so.
// If color is not provided via the text style, use content color as a default
val textColor = textStyle.color.takeOrElse {
colors.textColor(enabled).value
}
val mergedTextStyle = textStyle.merge(TextStyle(color = textColor))
BasicTextField(
value = value,
onValueChange = {
if (it.text.length <= maxLength) {
onValueChange(it.text)
}
},
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
)
How can I catch 'enter key' with OutlinedTextField? I set it to 'Done' Action. And done is not called and also the keyboard doesn't disappear.