Skip to content

Commit

Permalink
add animated content scope into nav destination scope
Browse files Browse the repository at this point in the history
  • Loading branch information
vkatz committed May 20, 2024
1 parent 15107ad commit cebc713
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ fun <T> rememberNavController(
}

@Composable
private fun <Args> DestinationContent(entry: NavEntry<Args>) {
val scope = remember(entry) { NavDestinationScopeImpl(entry) }
private fun <Args> AnimatedVisibilityScope.DestinationContent(entry: NavEntry<Args>) {
val scope = remember(entry) { NavDestinationScopeImpl(entry, this) }
with(entry.destination) {
scope.PlatformContentWrapper {
Content()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.composegears.tiamat

import androidx.compose.animation.AnimatedVisibilityScope
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import kotlin.properties.ReadOnlyProperty
Expand All @@ -9,7 +10,7 @@ import kotlin.reflect.KProperty
* A NavDestinationScope provides a scope for the children of NavDestination<Args> entity
*/
@Stable
abstract class NavDestinationScope<Args> internal constructor() {
abstract class NavDestinationScope<Args> internal constructor() : AnimatedVisibilityScope {
internal abstract val navEntry: NavEntry<Args>
}

Expand All @@ -18,7 +19,9 @@ abstract class NavDestinationScope<Args> internal constructor() {
*/
internal open class NavDestinationScopeImpl<Args>(
override val navEntry: NavEntry<Args>,
) : NavDestinationScope<Args>()
private val animatedVisibilityScope: AnimatedVisibilityScope
) : NavDestinationScope<Args>(),
AnimatedVisibilityScope by animatedVisibilityScope

/**
* Destination base interface
Expand Down

0 comments on commit cebc713

Please sign in to comment.