Remember the view morph scope across recompositions (#184)
This commit is contained in:
@@ -383,13 +383,12 @@ fun CalendarHost(
|
|||||||
transitionSpec = { viewSwitch },
|
transitionSpec = { viewSwitch },
|
||||||
label = "view-switch",
|
label = "view-switch",
|
||||||
) { currentView ->
|
) { currentView ->
|
||||||
CompositionLocalProvider(
|
val sharedScope = this@SharedTransitionLayout
|
||||||
LocalViewMorph provides if (reduceMotion) {
|
val visibilityScope = this@AnimatedContent
|
||||||
null
|
val viewMorph = remember(reduceMotion, sharedScope, visibilityScope, morphBounds, morphFade) {
|
||||||
} else {
|
if (reduceMotion) null else ViewMorphScope(sharedScope, visibilityScope, morphBounds, morphFade)
|
||||||
ViewMorphScope(this@SharedTransitionLayout, this@AnimatedContent, morphBounds, morphFade)
|
}
|
||||||
},
|
CompositionLocalProvider(LocalViewMorph provides viewMorph) {
|
||||||
) {
|
|
||||||
when (currentView) {
|
when (currentView) {
|
||||||
CalendarView.Week -> WeekScreen(
|
CalendarView.Week -> WeekScreen(
|
||||||
selectedView = currentView,
|
selectedView = currentView,
|
||||||
|
|||||||
Reference in New Issue
Block a user