diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/util/expansion/NumberCommaTransformation.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/util/expansion/NumberCommaTransformation.kt index 41571e44..64b539b4 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/util/expansion/NumberCommaTransformation.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/util/expansion/NumberCommaTransformation.kt @@ -13,7 +13,9 @@ class NumberCommaTransformation : VisualTransformation { NumberFormat.getNumberInstance(Locale.US).format(this ?: 0) override fun filter(text: AnnotatedString): TransformedText { - val newText = AnnotatedString(text.text.toLongOrNull().formatWithComma() + "원") + val newText = AnnotatedString( + text = if (text.text.isEmpty()) "" else text.text.toLongOrNull().formatWithComma() + "원" + ) return TransformedText( text = newText, offsetMapping = object : OffsetMapping { diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/textfield/TypingPriceField.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/textfield/TypingPriceField.kt index 8732e923..ab98ea26 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/textfield/TypingPriceField.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/textfield/TypingPriceField.kt @@ -61,15 +61,13 @@ fun TypingPriceField( innerPadding: PaddingValues = PaddingValues(0.dp), textFieldHeight: Dp = 35.dp, keyboardOptions: KeyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword), + textFormat : VisualTransformation = NumberCommaTransformation(), fieldSubjectContent: (@Composable () -> Unit) = { FieldSubject() }, leadingIconContent: (@Composable () -> Unit)? = null, trailingIconContent: (@Composable () -> Unit)? = null, errorMessageContent: (@Composable () -> Unit) = { }, ) { val interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } - val numberCommaTransFormation = remember { NumberCommaTransformation() } - val textFormat = - if (textValue.isEmpty()) VisualTransformation.None else numberCommaTransFormation var isTextFieldFocused by remember { mutableStateOf(false) } val scope = rememberCoroutineScope() val currentColor = if (isError) Negative else if (isTextFieldFocused) Primary3 else Gray500