NTP-46402 | Restore cursor movement functionality (#748)

This commit is contained in:
Aparna Vadlamani
2025-04-28 14:38:56 +05:30
committed by GitHub
parent e2eddffcbd
commit 8e05d46a17

View File

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