Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TodoApp. Update Decompose to 0.2.0, enable navigation animations. #544

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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