Skip to content

Commit

Permalink
Merge pull request #28 from arkivanov/fix-NoClassDefFoundError-in-Jet…
Browse files Browse the repository at this point in the history
…pack-Children

Workaround for NoClassDefFoundError in Jetpack Children function
  • Loading branch information
arkivanov authored Dec 28, 2020
2 parents 85dba21 + df5977c commit 386f7af
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,22 @@ typealias ChildContent<C, T> = @Composable (child: T, configuration: C) -> Unit

typealias ChildAnimation<C, T> = @Composable (child: T, configuration: C, ChildContent<C, T>) -> Unit

@Composable
fun <C : Parcelable, T : Any> Children(
routerState: Value<RouterState<C, T>>,
content: ChildContent<C, T>
) {
// Workaround https://github.com/arkivanov/Decompose/issues/25
val animation: ChildAnimation<C, T> = { child, configuration, function -> function(child, configuration) }

Children(routerState = routerState, animation = animation, content = content)
}

@OptIn(ExperimentalRestorableStateHolder::class)
@Composable
fun <C : Parcelable, T : Any> Children(
routerState: Value<RouterState<C, T>>,
animation: ChildAnimation<C, T> = { child, configuration, childContent -> childContent(child, configuration) },
animation: ChildAnimation<C, T>,
content: ChildContent<C, T>
) {
val holder = key(routerState) { rememberRestorableStateHolder<C>() }
Expand Down

0 comments on commit 386f7af

Please sign in to comment.