Skip to content

Commit 1849838

Browse files
authored
TodoApp. Update Decompose to 0.2.0, enable navigation animations. (#544)
1 parent 963ab0d commit 1849838

File tree

5 files changed

+8
-27
lines changed

5 files changed

+8
-27
lines changed

examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ object Deps {
4949
}
5050

5151
object Decompose {
52-
private const val VERSION = "0.1.9"
52+
private const val VERSION = "0.2.0"
5353
const val decompose = "com.arkivanov.decompose:decompose:$VERSION"
5454
const val decomposeIosX64 = "com.arkivanov.decompose:decompose-iosx64:$VERSION"
5555
const val decomposeIosArm64 = "com.arkivanov.decompose:decompose-iosarm64:$VERSION"

examples/todoapp/common/compose-ui/src/commonMain/kotlin/example/todo/common/ui/Crossfade.kt

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/todoapp/common/compose-ui/src/commonMain/kotlin/example/todo/common/ui/TodoRootUi.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
@file:Suppress("EXPERIMENTAL_API_USAGE")
2+
13
package example.todo.common.ui
24

35
import androidx.compose.runtime.Composable
46
import com.arkivanov.decompose.extensions.compose.jetbrains.Children
7+
import com.arkivanov.decompose.extensions.compose.jetbrains.animation.child.crossfadeScale
58
import example.todo.common.root.TodoRoot
69
import example.todo.common.root.TodoRoot.Child
710

811
@Composable
912
fun TodoRootContent(component: TodoRoot) {
10-
// Crossfade does not preserve UI state properly since (probably) 0.3.0-build146.
11-
// Uncomment when https://issuetracker.google.com/u/1/issues/178729296 is fixed.
12-
Children(routerState = component.routerState /*, animation = crossfade()*/) { child, _ ->
13-
when (child) {
13+
Children(routerState = component.routerState, animation = crossfadeScale()) {
14+
when (val child = it.instance) {
1415
is Child.Main -> TodoMainContent(child.component)
1516
is Child.Edit -> TodoEditContent(child.component)
1617
}

examples/todoapp/common/root/src/commonMain/kotlin/example/todo/common/root/integration/TodoRootComponent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class TodoRootComponent internal constructor(
5454
router<Configuration, Child>(
5555
initialConfiguration = Configuration.Main,
5656
handleBackButton = true,
57-
componentFactory = ::createChild
57+
childFactory = ::createChild
5858
)
5959

6060
override val routerState: Value<RouterState<*, Child>> = router.state

examples/todoapp/common/root/src/commonTest/kotlin/example/todo/common/root/integration/TodoRootTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class TodoRootTest {
5151
todoEdit = { _, itemId, output -> TodoEditFake(itemId, output) }
5252
)
5353

54-
private val TodoRoot.activeChild: Child get() = routerState.value.activeChild.component
54+
private val TodoRoot.activeChild: Child get() = routerState.value.activeChild.instance
5555

5656
private val Child.component: Any
5757
get() =

0 commit comments

Comments
 (0)