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

Stuie

07/08/2022, 11:57 PM
I'm trying Jetbrains Compose and Decompose for the first time. I'm building an app based on an example that uses a
ScreenConfig
sealed class for navigation, and a
ComponentContext.router
that constructs the screen that is needed for every
pop
and
push
. This all works fine for a single window application, but now that I want a second window I'm having some trouble. I created a
@Composable
with a
Window
at the top-level, created an entry in the
ScreenConfig
for it, as I did for other navigation destinations. When that destination is reached the initial window content becomes blank, and the new window appears correctly. I've used GitHub search but haven't managed to find a sample repository that handles multiple windows with Decompose. The only documentation I can find is unrelated Decompose.
Is there some particular way to trigger a new window to be opened without affecting the existing one?
a

Adam Brown

07/09/2022, 2:46 AM
i handle it in the desktop specific module (not source set), that way on Android it can open another Activity, I'm not at a computer right now so cant provide an example, sorry 😕
s

Stuie

07/09/2022, 3:17 AM
Ah, my app is desktop only, just a single module.
a

Arkadii Ivanov

07/09/2022, 7:59 AM
I played with windows a while ago - https://pastebin.com/K66P08Yj
s

Stuie

07/09/2022, 6:18 PM
Awesome, looks good at first glance. I'll try to give it a go later and see how it goes. Thank you very much for your help. 🙂
👍 1
6 Views