Skip to content

Commit

Permalink
Merge pull request #798 from arkivanov/update-shared-transitions-anim…
Browse files Browse the repository at this point in the history
…ation-sample

Updated shared transitions sample
  • Loading branch information
arkivanov authored Oct 17, 2024
2 parents 3376b24 + a40a0a1 commit 6dcca39
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,6 +36,7 @@ internal fun SharedTransitionsContent(
PredictiveBackParams(
backHandler = component.backHandler,
onBack = component::onBack,
animatable = ::materialPredictiveBackAnimatable,
)
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6dcca39

Please sign in to comment.