gpaligot
01/15/2020, 2:04 PMTextField
in my screen but the component have a weird behavior. When I type any text in the text field, there isn’t any visual in the component on the screen. Someone has already encountered this issue?
You can find my code here:
@Composable
fun Password(data: LoginForm) {
MyTextField(
hint = "Password",
keyboardType = KeyboardType.Password,
imeAction = ImeAction.Done,
onValueChange = { data.email = it }
)
}
@Composable
fun MyTextField(
hint: String,
onValueChange: (text: String) -> Unit,
keyboardType: KeyboardType = KeyboardType.Text,
imeAction: ImeAction = ImeAction.Unspecified
) {
val typography = +MaterialTheme.typography()
val model = +state { "" }
Padding(left = 8.dp, right = 8.dp, top = 8.dp) {
Column {
Text(
text = hint,
style = typography.subtitle1
)
HeightSpacer(height = 8.dp)
TextField(
value = model.value,
onValueChange = onValueChange,
keyboardType = keyboardType,
imeAction = imeAction,
textStyle = typography.body1,
modifier = ExpandedWidth
)
}
}
}
Siyamed
01/15/2020, 2:23 PMgpaligot
01/15/2020, 2:35 PMstate
and @Model
data class. Everything is ok now!