https://kotlinlang.org logo
#decompose
Title
# decompose
v

Vaibhav Jaiswal

03/12/2024, 11:07 AM
@Arkadii Ivanov In Stack Navigation, how can I create a parent component for two screen level components? Eg
Copy code
RootComponent 
  |-> ScreenAComponent
  |-> ScreenBComponent
  ............
I want to have a parent component only for ScreenA and ScreenB, Which is alive till either of the component is alive, and should destroy when none of the two component is in the Stack
a

Arkadii Ivanov

03/12/2024, 11:19 AM
If possible, extract ScreenA and ScreenB into a separate component (ScreenAB), and place ScreenAB in Root. Otherwise, that component would be "shared", not a parent. I think in this case you would need to manage the shared component manually via Child Slot.
2 Views