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

Updated shared transitions sample #798

Merged
merged 1 commit into from
Oct 17, 2024
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
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
Loading