Greetings Everyone. I'm working on a KMP project t...
# multiplatform
a
Greetings Everyone. I'm working on a KMP project targeting android and desktop. My project structure is attached below. I've developed 4 composable screens including one splash screen. Now, what I want to do is that upon starting application splash screen should be displayed for a couple of seconds followed by screen A and then connect screens with each other i.e., upon a button click on a screen navigate to the next screen along with passing some data from one screen to another. I looked over the internet and tried implementing
NavController
but it isn't working under common module. How can I achieve this? Any help would be appreciated.
ł
You can create your own navigation, like here: https://proandroiddev.com/diy-compose-multiplatform-navigation-with-decompose-94ac8126e6b5 There is no ‘official’ library for navigation. I recommend making your own where you have full control over what you want to have.
p
The NavController is only Android, you will need a navigation library. There are a couple with similar API to compose navigation,
precompose
is the one I remember. Different API but very advanced features is
decompose
and
voyager
. If you want something simple but need to handle the lifecycle state on your own use this one bellow: https://github.com/chRyNaN/navigation If none of them fit your needs go to GitHub and search for one, there are a couple more that I might have missed.
But as the comment above said, making your own or working with one that you fully understand is key. Your navigation lib is something you want to have full knowledge of how internal works.
ł
a
Thank you @Łukasz Nowakowski and @Pablichjenkov. I would look into the shared references. Also, can you please help me with the splash screen part.
p
It is something preventing you from presenting the splash screen and after some delay or at specific event in your App present the next screen?
154 Views