Hi everyone, we've noticed that the recommendation...
# compose
t
Hi everyone, we've noticed that the recommendation for storing TextField's state has changed to using the TextFieldState class. Given that we're migrating parts of our app from XML to Compose, we had hoped to immediately follow the best practices here, but the Material 3 version containing these changes has apparently been in alpha since October. Is there any indication to when version 1.4 of Material 3 will be released? We'd prefer not shipping with an alpha version, so if the release is still far away, we'll probably have to use StateFlow<String> as a fallback.
n
you can use StateFlow<String> with
TextField
👎🏾 1
t
We realize this, but we've read in the documentation that this has some synchronization caveats: https://developer.android.com/develop/ui/compose/text/migrate-state-based#viewmodel-stateflow
a
1. You can go with
Stateflow<String>
and when material becomes stable then you can migrate just this part(it should not be much effort) 2. Or you can create you own wrapper composable function and then when material becomes stable then you don't have to touch other area and you just have to update your wrapper Also remember that if you edit text backing state is not coming from outside from some reactive field then even the old approach will work for you. This is explained here