Fixed
Status Update
Comments
jb...@google.com <jb...@google.com> #2
You don't need to do step 1 or 2 - ensuring you've called addNavigator() before setGraph() is enough.
Specifically, seehttps://issuetracker.google.com/issues/110763345#comment2
Also mentioned is the fact that you can override createFragmentNavigator(), call navController.navigatorProvider.addNavigator() there, then return super.createFragmentNavigator().
Specifically, see
Also mentioned is the fact that you can override createFragmentNavigator(), call navController.navigatorProvider.addNavigator() there, then return super.createFragmentNavigator().
ap...@google.com <ap...@google.com> #3
It's may also be of interest that I am making use of a custom navigator to implement conditional routing. My custom destination/nodes simply implement an interface like this:
interface DynamicNode {
@IdRes
fun getDestination(context: Context, @IdRes destinationIn: Int, argsIn: Bundle?) : Int
}
The Navigator then implements a navigate method that simply calls NavController.navigate using the ID returned by the DynamicNode and returns null, essentially performing a redirect. It would be cool to see something like this baked-in with a later version of the Navigation component.
interface DynamicNode {
@IdRes
fun getDestination(context: Context, @IdRes destinationIn: Int, argsIn: Bundle?) : Int
}
The Navigator then implements a navigate method that simply calls NavController.navigate using the ID returned by the DynamicNode and returns null, essentially performing a redirect. It would be cool to see something like this baked-in with a later version of the Navigation component.
Description
Component used: Navigation
Version used: 2.8.0-beta06
Given a data class like:
If you do
navigate(ScreenBRoute)
, you get a Lint warning, but you don't get the same kind of error when doingpopBackStack(ScreenBRoute, inclusive = false)
.Ideally, it would warn you and offer it to replace to
popBackStack<ScreenBRoute>(inclusive = false)
.