Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jetpack Navigation Component with Jetpack Compose compatible?

I've been searching through documentation and I could not find a confirmation. Does anyone know if the navigation and compose component from Android Jetpack are compatible with each other? I know that Jetpack Compose is not production ready and is only in developer preview mode, however I am testing with it and cannot seem to configure my project to work with both of these jetpack components.

Any information would be highly appreciated.

like image 761
ljtomev Avatar asked Dec 18 '22 12:12

ljtomev


1 Answers

Long-term, there will be first-class support in the Navigation component for Jetpack Compose. Google has indicated this on several occasions, mostly in the Kotlinlang Slack #compose channel.

Right now (30 June 2020), Navigation knows nothing about Compose. Eventually, my guess is that the Navigation DSL will support referencing composables (or lambdas that update states), but that is just a guess.

If you want to use both today, one option would be to continue using fragments:

  • Have Compose define the UI for those fragments
  • Have Navigation route between the fragments

Later, when Navigation directly supports Compose, you could "unwind" those fragments and do everything directly in Compose+Navigation.

Alternatively, there are non-Navigation routing options available from third parties (though, like Compose, they are all fairly new).

like image 145
CommonsWare Avatar answered Dec 21 '22 11:12

CommonsWare