Skip to content

Commit

Permalink
TodoApp. Update Decompose to 0.2.0, enable navigation animations. (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkivanov authored Mar 29, 2021
1 parent 963ab0d commit 1849838
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 27 deletions.
2 changes: 1 addition & 1 deletion examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object Deps {
}

object Decompose {
private const val VERSION = "0.1.9"
private const val VERSION = "0.2.0"
const val decompose = "com.arkivanov.decompose:decompose:$VERSION"
const val decomposeIosX64 = "com.arkivanov.decompose:decompose-iosx64:$VERSION"
const val decomposeIosArm64 = "com.arkivanov.decompose:decompose-iosarm64:$VERSION"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
@file:Suppress("EXPERIMENTAL_API_USAGE")

package example.todo.common.ui

import androidx.compose.runtime.Composable
import com.arkivanov.decompose.extensions.compose.jetbrains.Children
import com.arkivanov.decompose.extensions.compose.jetbrains.animation.child.crossfadeScale
import example.todo.common.root.TodoRoot
import example.todo.common.root.TodoRoot.Child

@Composable
fun TodoRootContent(component: TodoRoot) {
// Crossfade does not preserve UI state properly since (probably) 0.3.0-build146.
// Uncomment when https://issuetracker.google.com/u/1/issues/178729296 is fixed.
Children(routerState = component.routerState /*, animation = crossfade()*/) { child, _ ->
when (child) {
Children(routerState = component.routerState, animation = crossfadeScale()) {
when (val child = it.instance) {
is Child.Main -> TodoMainContent(child.component)
is Child.Edit -> TodoEditContent(child.component)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TodoRootComponent internal constructor(
router<Configuration, Child>(
initialConfiguration = Configuration.Main,
handleBackButton = true,
componentFactory = ::createChild
childFactory = ::createChild
)

override val routerState: Value<RouterState<*, Child>> = router.state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TodoRootTest {
todoEdit = { _, itemId, output -> TodoEditFake(itemId, output) }
)

private val TodoRoot.activeChild: Child get() = routerState.value.activeChild.component
private val TodoRoot.activeChild: Child get() = routerState.value.activeChild.instance

private val Child.component: Any
get() =
Expand Down

0 comments on commit 1849838

Please sign in to comment.