ljtomev
ljtomev

Reputation: 1093

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.

Upvotes: 4

Views: 2098

Answers (2)

Ziv Kesten
Ziv Kesten

Reputation: 1242

There is now support for compose navigation with 1.0.0-alpha06 release. https://developer.android.com/jetpack/compose/navigation

Upvotes: 5

CommonsWare
CommonsWare

Reputation: 1007584

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).

Upvotes: 6

Related Questions