Is there a way to send Lambda to Screen compose using voyager... so that actions can be taken at platform level
lets say I have an action to increase/decrease volume but on android side its implementain is different and for ios its different
p
Pablichjenkov
11/30/2023, 7:33 PM
You can declare an interface in commonMain and pass the implementation to your Voyager Screen.
Pablichjenkov
11/30/2023, 7:33 PM
Or inject it in the Screen ViewModel
👍 1
v
Vlad
12/05/2023, 10:05 AM
The voyager will crash on android at least on attempt to pack your passed interface into a bundle after you minimize your app
Vlad
12/05/2023, 10:09 AM
I generally see 2 ways of passing some outside objects/listeners into the compose app:
• Common one - inject the objects into VMs
• Compose way one - pass them into Local composition and access them anywhere down the tree
m
Mahmoo
12/05/2023, 10:10 AM
Implemented this with pre-compose
It's very similar to compose navigation on Android... So it does the job for me... Thanks for the response
👍 1
Mahmoo
12/05/2023, 10:11 AM
I actually needed to pass lambda when I am creating a nav graph ... So yeah pre-compose navigation solves this for me