Filippo Vigani
02/06/2025, 4:13 PMColumn
with a search field or a LazyColumn
with a search field (and the rest of its items).
The goal is to share the same search field composable, without resetting its state. Something like:
fun MyComposable(){
if(condition) {
Column{
SearchField()
MyLoading()
}
} else {
LazyColumn{
SearchField()
items(...)
}
}
This is a simplified example of my scenario, but just so you get the idea.
The issue I have is that anything remembered inside SearchField
will be reset when switching the condition, because the compose tree structure is different.
In my case I am not able to hoist the state of SearchField
, and would like to somehow share the composition for it.
I would also like to avoid using a LazyColumn
in the first case.
Is there any way to do it? Any ideas?Filippo Vigani
02/06/2025, 4:17 PM