I have a form made of multiple `TextField` s and w...
# compose
g
I have a form made of multiple
TextField
s and we hide and show those depending on some conditions. I wonder how to manage correctly the "next button" of the keyboard 🤔 If a
TextFied
is inside
AnimatedVisibility() {}
, when not visible, is it part of the composition still or not? Will the keyboard go to the next one?
s
If I were to guess, the
TextField
will not exist in composition after it has animated out. But during animating in or out it will be, so that may be tricky in some cases. What have you tried so far? Is it not working now? This seems to be the official documentation of how to handle focus and next/previous items yourself. https://developer.android.com/reference/kotlin/androidx/compose/ui/focus/FocusProperties.
d
Stylianos is correct, anything in
AnimatedVisibility
is removed from the tree once the exit animations are finished. If your goal is to skip the content that is being animated out, you'll need to handle the focus yourself. The focus system doesn't have any idea which item is transient and disappearing.
g
Thank you both @Doris Liu and @Stylianos Gakis, We're going to investigate more deeply and manage the focus ourselves 😊