I'm learning compose, and one of the screens I'm writing has a number of text fields on it. to make things easier on myself, I put the text fields into a mutable list, and I'm finding that i can't update the text field input if I try to update a text saver through the list. When I added in logging, the
it
only ever registered the first key pressed, as if the previous keystrokes were not saved. Did I miss something in how this works?
example of what I'm trying to do (if needed, I can provide more than just the barebones) :
var textSaver1 by rememberSaveable(stateSaver = TextFieldValue.Saver) { mutableStateOf(TextFieldValue()) }
. . .create 15 more
var textSavers1Through4 = mutableListOf(textsaver1, textsaver2, textsaver3, textsaver4)
Box {
OutlinedTextField( value = textSavers1Through4[0],
onValueChange = {
textSavers1Through4[0] = it
}
)
}
In case it matters, I'm using Kotlin version 1.8.20 and compose version 1.4.0. (And just to be clear - it works as expected if I don't use the mutable list, I'm just confused as to why the mutable list seems to make it not work)