How can I remove a Composable function entirely from UI Tree without losing state so that it does no...
l
How can I remove a Composable function entirely from UI Tree without losing state so that it does not visible, take spaces, consume events etc.? When I write like
if(someState) Content()
, the internal states may fly away. (such as value remembered by
remember {}
) Generally speaking, can I prevent emitting the nodes? (Maybe linking to another composition with wrapper Applier which conditionally delegates to parent applier..? - this would overkill)
👍 1
y
Do you mind sharing your use-case? just interested on why would you need that. In terms of internal state, have you considered hoisting it up to the parent and just passing the state to
Content()
when you want to display it?
l
I had a use case but I now think just setting alpha = 0f would appropriate. So it was just curiosity; is it possible?
Hoisting state would be okay. But regarding performance, it would be
a little little bit
slower? I thought this when I implement custom animation to navigation; things still happen in the back stack so I wanted to get rid of them out of UI tree.
199 Views