NTP-46402 | Fixing execution of onSuccess and onFailure actions of ValidateDataAction (#740)

This commit is contained in:
Aparna Vadlamani
2025-04-22 16:34:21 +05:30
committed by GitHub
parent e93a7f26e2
commit f8d17efed8
2 changed files with 12 additions and 7 deletions

View File

@@ -58,7 +58,9 @@ data class ValidateDataAction(
} else {
onFailure
}
uiTronActionData?.actions?.forEach { actionDetails.actionCallbackFlow?.emit(it) }
uiTronActionData?.actions?.forEach {
actionDetails.actionHandler.performAction(it, actionDetails.actionCallbackFlow)
}
}
}

View File

@@ -47,7 +47,9 @@ import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.platform.TextToolbar
import androidx.compose.ui.platform.TextToolbarStatus
import androidx.compose.ui.text.PlatformTextStyle
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
@@ -148,7 +150,7 @@ class CustomTextFieldRenderer(private val uiTronRenderer: UiTronRenderer) :
uiTronViewModel = uiTronViewModel,
isTextTransformedValueUpdated = isTextTransformedValueEdited,
)
mutableStateOf(input)
mutableStateOf(TextFieldValue(input, TextRange(input.length)))
}
var isFocused by remember { mutableStateOf(false) }
var borderColor by remember { mutableStateOf(property.colors?.unfocusedBorderColor) }
@@ -356,14 +358,15 @@ class CustomTextFieldRenderer(private val uiTronRenderer: UiTronRenderer) :
onValueChange = { input ->
val editedInput =
onInputValueChange(
input = input,
input = input.text,
property = property,
customTextFieldData = customTextFieldData,
uiTronViewModel = uiTronViewModel,
isTextTransformedValueUpdated = mutableStateOf(false),
)
isTextTransformedValueEdited.value = true
inputValue = editedInput
inputValue =
TextFieldValue(editedInput, TextRange(editedInput.length))
},
singleLine = property.singleLine ?: false,
visualTransformation =
@@ -376,7 +379,7 @@ class CustomTextFieldRenderer(private val uiTronRenderer: UiTronRenderer) :
),
)
}
if (inputValue.isEmpty()) {
if (inputValue.text.isEmpty()) {
property.hintStyle?.let {
TextRenderer()
.Render(
@@ -409,14 +412,14 @@ class CustomTextFieldRenderer(private val uiTronRenderer: UiTronRenderer) :
}
uiTronViewModel.handle[property.errorMessageLayoutId.getDataId()] =
TextData(customTextFieldData.errorMessage)
} else if (inputValue.isNotNullAndNotEmpty()) {
} else if (inputValue.text.isNotNullAndNotEmpty()) {
if (isFocused) {
borderColor = property.colors?.focusedBorderColor
} else {
borderColor = property.colors?.unfocusedBorderColor
}
val successText =
getTransformedText(property.successTextTransformation, inputValue)
getTransformedText(property.successTextTransformation, inputValue.text)
if (successText.isNotNullAndNotEmpty()) {
property.successView?.let {
UiTronRenderer(