5

I know with Navigation Component, you can easily set up your toolbar to work with it (https://developer.android.com/guide/navigation/navigation-ui#create_a_toolbar).

You call setupWithNavController and it all magically happens. Then, you get a back arrow whenever you aren't at the start destination.

I am currently working with Jetpack Compose and I'm still new to it. I'm trying to see if navigation component is able to do something similar with the TopAppBar in a Scaffold.

Is there an easy way to set up the nav component with the TopAppBar, or do my navigation icons (back arrows) need to be done manually (call navController.popBackStack as the onClick for these icons)?

SmallGrammer
  • 893
  • 9
  • 19

1 Answers1

1

In compose, as of compose 1.0.1, at least, you must manually implement it. For a complete understanding, check out this codelab. People are trying to make coding as easy as possible. If it could be automatically done, what you're asking for, it would have been the recommended way in the official codelab, but it isn't. You can file a feature request though.

Richard Onslow Roper
  • 5,477
  • 2
  • 11
  • 42