Hi, i am having problems with BasicSecureTextField...
# compose-ios
f
Hi, i am having problems with BasicSecureTextField on iOS. When obfuscation mode is used, the actual text gets transformed as well into obfuscation characters. I am using Compose Multiplatform 1.7.0 with iOS 18.0 simulator. Other platforms (Android, Desktop) i have tested works just fine. Is there workaround to this ? Thank you
a
It's not so obvious how to reproduce your issue. For me it works fine. Need your code to verify if there is an issue.
f
Hi @Andrei Salavei Thank you for responding !. Here is my code used on my application. You can try replace the dimension value i assigned.
Copy code
BasicSecureTextField(
    state = password,
    modifier = Modifier
        .fillMaxWidth(loginConfiguration.basicTextFieldWidth)
        .height(30.dp)
        .offset {
            loginConfiguration.basicTextFieldOffset
        }
        .clip(CircleShape)
        .border(
            0.3.dp,
            Color.White.copy(0.4F),
            shape = CircleShape
        ),
    cursorBrush = SolidColor(Color.White),
    decorator = {
        Box(modifier = Modifier.fillMaxWidth()) {
            Row(modifier = Modifier.fillMaxWidth(0.9F)) {
                Card(
                    modifier = Modifier
                        .fillMaxHeight()
                        .width(40.dp),
                    colors = CardDefaults.cardColors(
                        containerColor = passwordCardColor
                    ),
                    shape = CircleShape
                ) {
                    Column(
                        modifier = Modifier.fillMaxSize(),
                        verticalArrangement = Arrangement.Center,
                        horizontalAlignment = Alignment.CenterHorizontally
                    ) {
                        Icon(
                            imageVector = Icons.Outlined.Lock,
                            contentDescription = null,
                            tint = Color.White
                        )
                    }
                }
                TextFieldDefaults.DecorationBox(
                    value = password.toString(),
                    innerTextField = it,
                    enabled = true,
                    singleLine = true,
                    visualTransformation = PasswordVisualTransformation(),
                    interactionSource = remember {
                        MutableInteractionSource()
                    },
                    contentPadding = PaddingValues(horizontal = 12.dp),
                    colors = TextFieldDefaults.colors(
                        unfocusedIndicatorColor = Color.Transparent,
                        focusedIndicatorColor = Color.Transparent,
                        focusedContainerColor = Color.Transparent,
                        unfocusedContainerColor = Color.Transparent,
                    )
                )
            }
            Row(
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(horizontal = 6.dp, vertical = 4.dp),
                horizontalArrangement = Arrangement.End
            ) {
                IconButton(onClick = {
                    viewModel.togglePasswordVisibility()
                }) {
                    Icon(
                        imageVector = if (viewModel.shouldShowPassword)
                            Icons.Outlined.Visibility
                        else Icons.Outlined.VisibilityOff,
                        contentDescription = "",
                        tint = Color.White
                    )
                }
            }
        }
    },
    textStyle = TextStyle(color = Color.White),
    textObfuscationMode = if (viewModel.shouldShowPassword)
        TextObfuscationMode.Visible else TextObfuscationMode.RevealLastTyped
)
a
I see. It looks like a known issue: https://youtrack.jetbrains.com/issue/CMP-6996
f
Thank you @Andrei Salavei!
Any updates for this issue ?
a
You can tract the progress in the issue - we're working on it right now.
j
@Andrei Salavei do you know what was different in your setup above in case where it worked....just wondering about workaround for now
a
You can check the issue here. There was a workaround in comments, but I didn't try it.
j
I had some issues with that....not sure if that was based on older version maybe of some dependencies.
I'll take another go at using it tomorrow.
fwiw this still seems to be issue in latest 1.8.0 alpha
f
Yes, the changelog did not seems to indicate that this has been fixed sadly...