From ea1bf4f3a8c7c5989ec5b74244786a9a19f4ec64 Mon Sep 17 00:00:00 2001 From: dokar3 <68095777+dokar3@users.noreply.github.com> Date: Wed, 22 Jul 2026 19:19:24 +0800 Subject: [PATCH] Prevent duplicate chip submission --- .../kotlin/com/dokar/chiptextfield/BasicChipTextField.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/BasicChipTextField.kt b/chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/BasicChipTextField.kt index b98a3a3..eb4c04e 100644 --- a/chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/BasicChipTextField.kt +++ b/chiptextfield-core/src/commonMain/kotlin/com/dokar/chiptextfield/BasicChipTextField.kt @@ -597,12 +597,8 @@ private fun Input( BasicTextField( value = value, - onValueChange = filterNewLines { newValue, hasNewLine -> - if (hasNewLine && newValue.text.isNotEmpty() && tryAddNewChip(newValue)) { - onValueChange(TextFieldValue()) - } else { - onValueChange(newValue) - } + onValueChange = filterNewLines { newValue, _ -> + onValueChange(newValue) }, modifier = modifier .focusRequester(focusRequester) @@ -623,6 +619,7 @@ private fun Input( }, enabled = enabled, readOnly = readOnly, + singleLine = true, textStyle = textStyle.copy(color = textColor), keyboardOptions = keyboardOptions.copy(imeAction = ImeAction.Done), keyboardActions = KeyboardActions(