I noticed weird behaviour when using `errorContain...
# compose
a
I noticed weird behaviour when using
errorContainerColor
in OutlinedTextField, it appears only with Dark mode, when
IsError
value is changed, the TextField color highlight? Before switching from one color to another, am I missing something?
🧵 1
Copy code
val customTextSelectionColors = TextSelectionColors(
    handleColor = CustomColors.primary,
    backgroundColor = CustomColors.primary.copy(alpha = .4f)
)

CompositionLocalProvider(LocalTextSelectionColors provides customTextSelectionColors) {
    OutlinedTextField(
        value = textValue,
        singleLine = true,
        textStyle = customTypography.bold(),
        shape = RoundedCornerShape(8.dp),
        isError = isError,
        keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
        onValueChange = { value ->
            val newValue = value.copy(
                text = value.text.filter { it.isDigit() }
            )
            onValueChange(newValue)
        },
        colors = OutlinedTextFieldDefaults.colors(
            focusedTextColor = CustomColors.dynamicBlack,
            unfocusedTextColor = CustomColors.dynamicBlack,
            errorTextColor = CustomColors.dynamicBlack,
            unfocusedBorderColor = Color.Transparent,
            focusedBorderColor = Color.Transparent,
            cursorColor = CustomColors.primary,
            errorContainerColor = MaterialTheme.colorScheme.errorContainer,
            errorBorderColor = Color.Transparent,
            focusedContainerColor = Color.LightGray.copy(alpha = 0.2f),
            unfocusedContainerColor = Color.LightGray.copy(alpha = 0.2f)
        ),
        modifier = Modifier.fillMaxWidth(),
        trailingIcon = {
            Text(
                text = stringResource(Res.string.px),
                style = customTypography.regular(),
                color = CustomColors.labelSecondary,
            )
        }
    )
}
Did you experienced something like that before? @mohamed rejeb