acefalobi / android-stepper

A library for creating a wizard-like step-through user interface that uses navigation components and menus for displaying steps with advanced customization.
Apache License 2.0
325 stars 38 forks source link

Stepper doesn't go to previous step on back button press #36

Closed roozbehzarei closed 2 years ago

roozbehzarei commented 2 years ago

I'm using SafeArgs plugin to navigate and pass arguments between fragments. I also have nested fragments in my app. First layer fragment shows the stepper and a FragmentContainerView which also has the setup code for the stepper:

val localNavHost = childFragmentManager.findFragmentById(R.id.order_host_view) as NavHostFragment
localController = localNavHost.navController
binding.stepper.setupWithNavController(localController)
}

When I navigate to a fragment using SafeArgs the stepper automatically updates and highlights the second step, but when I press the back button, it navigates back to the first step but the stepper is still highlighting the second one. Is this a bug with the stepper or am I doing something wrong?

PS: Both of my FragmentContainerView's have their app:defaultNavHost attribute set to true, one with the main nav_graph and one for the nested fragments and the stepper.

roozbehzarei commented 2 years ago

There was a misspelling in my stepper menu.