From a40a0a1eea6ff3d04f8dbef0af51708c3bd64f4a Mon Sep 17 00:00:00 2001 From: Arkadii Ivanov Date: Wed, 16 Oct 2024 23:37:16 +0100 Subject: [PATCH] Updated shared transitions sample --- .../shared/sharedtransitions/SharedTransitionsContent.kt | 2 ++ .../shared/sharedtransitions/gallery/GalleryContent.kt | 4 ++-- .../sample/shared/sharedtransitions/photo/PhotoContent.kt | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsContent.kt b/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsContent.kt index c02b38380..9536e3684 100644 --- a/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsContent.kt +++ b/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/SharedTransitionsContent.kt @@ -14,6 +14,7 @@ import com.arkivanov.decompose.extensions.compose.experimental.stack.animation.f import com.arkivanov.decompose.extensions.compose.experimental.stack.animation.plus import com.arkivanov.decompose.extensions.compose.experimental.stack.animation.scale import com.arkivanov.decompose.extensions.compose.experimental.stack.animation.stackAnimation +import com.arkivanov.decompose.extensions.compose.stack.animation.predictiveback.materialPredictiveBackAnimatable import com.arkivanov.sample.shared.sharedtransitions.SharedTransitionsComponent.Child.GalleryChild import com.arkivanov.sample.shared.sharedtransitions.SharedTransitionsComponent.Child.PhotoChild import com.arkivanov.sample.shared.sharedtransitions.gallery.GalleryContent @@ -35,6 +36,7 @@ internal fun SharedTransitionsContent( PredictiveBackParams( backHandler = component.backHandler, onBack = component::onBack, + animatable = ::materialPredictiveBackAnimatable, ) }, ), diff --git a/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/gallery/GalleryContent.kt b/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/gallery/GalleryContent.kt index 3f353bd40..b491cf1d3 100644 --- a/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/gallery/GalleryContent.kt +++ b/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/gallery/GalleryContent.kt @@ -42,8 +42,8 @@ internal fun SharedTransitionScope.GalleryContent( contentDescription = null, modifier = Modifier .aspectRatio(1F) - .sharedElement( - state = rememberSharedContentState(key = image.id), + .sharedBounds( + sharedContentState = rememberSharedContentState(key = image.id), animatedVisibilityScope = animatedVisibilityScope, ) .clickable { component.onImageClicked(index = index) }, diff --git a/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/photo/PhotoContent.kt b/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/photo/PhotoContent.kt index 73ec6889b..be8b7c18f 100644 --- a/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/photo/PhotoContent.kt +++ b/sample/shared/compose/src/commonMain/kotlin/com/arkivanov/sample/shared/sharedtransitions/photo/PhotoContent.kt @@ -32,9 +32,10 @@ internal fun SharedTransitionScope.PhotoContent( painter = painterResource(component.image.resourceId), contentDescription = null, modifier = Modifier - .sharedElement( - state = rememberSharedContentState(key = component.image.id), + .sharedBounds( + sharedContentState = rememberSharedContentState(key = component.image.id), animatedVisibilityScope = animatedVisibilityScope, + renderInOverlayDuringTransition = false, ) .fillMaxWidth() .weight(1F)