I am implementing a PasswordInput
composable using Jetpack compose, which is literally one of the examples provided by the Android developers website:
@Composable
fun PasswordInput() {
var password by remember { mutableStateOf("admin") }
TextField(
value = password,
onValueChange = { password = it },
label = { Text(text = stringResource(id = R.string.prompt_password)) },
modifier = Modifier
.fillMaxWidth(),
visualTransformation = PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password)
)
}
Here I default my password to "admin", which is five characters long. It shows five asterisks.
But if a user presses the enter key there, the password field becomes six characters long.
Questions:
- Why does it do that?
- How can it be modified to not do that?