Skip to content

0.1.0

Compare
Choose a tag to compare
@github-actions github-actions released this 19 Feb 07:46
· 208 commits to master since this release

Update dependencies

Added

  • New: Add optional transitionAnimations parameter to NavHost @composable functions.
    Animations can be overridden with NavHostDefaults.transitionAnimations
    or disabled with NavHostTransitionAnimations.noAnimations.
    Default animations are the same as default animations in AndroidX's NavHost.

Changed

  • Breaking: Add a Modifier parameter to content of NavDestination:

    @InternalNavigationApi
    public sealed interface ContentDestination<T : BaseRoute> : NavDestination {
      // other members...
      public val content: @Composable (route: T, modifier: Modifier) -> Unit
    }

    This change effects ScreenDestination and OverlayDestination as well.
    The modifier parameter should be passed to the content of NavDestination
    (a.k.a the root @Composable of the destination), for example:

    @Immutable
    @Parcelize
    data class DetailScreenRoute(val id: String) : NavRoute
    
    @JvmField
    val DetailScreenDestination = ScreenDestination<DetailScreenRoute> { route, modifier ->
      DetailScreen(modifier = modifier, route = route)
    }
    
    @Composable
    internal fun DetailScreen(modifier: Modifier, route: DetailScreenRoute) {
      Scaffold(
        modifier = modifier, // <--- Pass the modifier to the root @Composable
        topBar = { /* ... */ },
      ) {
        //* ... */
      }
    }