Luis Daivid
11/12/2021, 5:22 AMZoltan Demant
11/12/2021, 5:39 AMvar textFieldValueState by remember {
mutableStateOf(
TextFieldValue(
text = valueOrEmpty,
selection = TextRange(
index = valueOrEmpty.length
)
)
)
}
Luis Daivid
11/12/2021, 5:43 AMZoltan Demant
11/12/2021, 5:46 AM.copy
instead of assigning a new TextFieldValue.Luis Daivid
11/12/2021, 5:50 AMZoltan Demant
11/12/2021, 5:54 AMZoltan Demant
11/12/2021, 5:56 AMTextFieldValue
in onValueChange
anytime the user types anything:
onValueChange = { newValue ->
textFieldValueState = newValue
}
Luis Daivid
11/12/2021, 5:58 AMZoltan Demant
11/12/2021, 6:05 AMonValueChange
callback anytime it does, and as long as you update your remembered textFieldValue - the cursor will move accordingly (Im using this in a beta version of my app and it works).Luis Daivid
11/12/2021, 6:08 AM