Hi, i am trying to use decompose. I have 2 screen...
# decompose
a
Hi, i am trying to use decompose. I have 2 screens 1. Dashboard 2. Details In details Screen, I have a button, once clicked it will show a player view at the bottom and it should be visibile on both Screen (Dashbaord and Details). Any idea how i can achieve that ?
s
Sounds like the parent component which holds Dashboard/Details should handle the player and show the player UI alongside the active child. When the parent creates any of the child components, it passes a callback that allows the child to show the player. You can see a similar thing in this example where the main component passes
onArticleSelected
to the list component. Similarly, you probably want a
onShowPlayer
.
a
Also, if the player has some logic, then it might be reasonable to extract it to a separate component. Then you can use Child Overlay in the parent to show/hide the player.
a
@Arkadii Ivanov i think the overlay works like a dialog in android. I want the whole screen to be enabled. The play will be at the bottom and use can interact with Dashboard and Details Screens.
a
No, Overlay is just a child component that can be activated/deactivated.
It doesn't stop the hosting component.
s
I've had the same misconception about Child Overlay at first. Doesn't help that the documentation's example is creating a dialog with it. So when you're scanning the docs to get an overview of the library and its tools, you think that's what it's for.
a
@Arkadii Ivanov @s3rius I have attached a dialog like
Copy code
dialogNavigation.activate(DialogConfig(output.playlist))
and it is working fine. Now i have a usecase to send data to the dialog once it is active. Like i have activated it, now if there is any out from others screens, i want to update it.
a
There are two ways. 1. You should be able to get the instance of the dialog from the state Value returned by the childOverlay/childSlot function. Then just call a method on that instance. 2. You can create PublishSubject/SharedFlow in the parent component, and pass it as an Observable/Flow to the dialog component. Then just send data in there.
a
Best, thanks