Browse Source

Updated Decompose to 0.1.0 in Todo example (#78)

Co-authored-by: Arkadii Ivanov <>
pull/88/head
Arkadii Ivanov 4 years ago committed by GitHub
parent
commit
5ebc5e1f5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt
  2. 4
      examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/RouterStateComposable.kt
  3. 4
      examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/ValueComposable.kt

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

@ -35,7 +35,7 @@ object Deps {
}
object Decompose {
private const val VERSION = "0.0.10"
private const val VERSION = "0.1.0"
const val decompose = "com.arkivanov.decompose:decompose:$VERSION"
}
}

4
examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/RouterStateComposable.kt

@ -19,7 +19,7 @@ private typealias SavedState = Map<String, List<Any?>>
@Composable
fun <C : Parcelable, T : Any> Value<RouterState<C, T>>.children(render: @Composable() (child: T, configuration: C) -> Unit) {
val parentRegistry: UiSavedStateRegistry? = UiSavedStateRegistryAmbient.current
val children = remember { Children<C>() }
val children = remember(value) { Children<C>() }
if (parentRegistry != null) {
onDispose {
@ -32,7 +32,7 @@ fun <C : Parcelable, T : Any> Value<RouterState<C, T>>.children(render: @Composa
}
}
invoke { state ->
observe { state ->
val activeChildConfiguration = state.activeChild.configuration
val currentChild: ActiveChild<C>? = children.active

4
examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/ValueComposable.kt

@ -29,6 +29,6 @@ fun <T : Any> Value<T>.asState(): State<T> {
}
@Composable
operator fun <T : Any> Value<T>.invoke(render: @Composable() (T) -> Unit) {
render(asState().value)
fun <T : Any> Value<T>.observe(observer: @Composable() (T) -> Unit) {
observer(asState().value)
}

Loading…
Cancel
Save