Does anyone know if the accompanist navigation lib...
# compose
m
Does anyone know if the accompanist navigation libraries support combining the animated and bottom sheet navigators? Looking at the code would suggest so:
Copy code
@ExperimentalAnimationApi
@Composable
fun rememberAnimatedNavController(
    vararg navigators: Navigator<out NavDestination>
): NavHostController {
    val animatedNavigator = remember { AnimatedComposeNavigator() }
    return rememberNavController(animatedNavigator, *navigators)
}
I assume i would pass the resolve of a rememberBottomSheetNavigator() call?
m
thanks. i believe i can accomplish the same thing with the constructor, but this confirms what i think is the right way to do this.
I hope animation gets eventually folded into the main navigation library. It seems silly to have it external when it's built into the xml based version. I know why it was done (animation was experimental)
i
Animation APIs in Compose (specifically
AnimatedContent
) are still experimental
But yes, the correct way to pass it into
rememberAnimatedNavController
, just like the docs say you should do with
rememberNavController
: https://google.github.io/accompanist/navigation-material/
The
+=
method was suggested only prior to that API existing, but isn't recommended anymore, since it is doing work on every composition vs only the once
­čĹŹ 2