@@ -19,17 +19,16 @@ import androidx.compose.animation.core.spring
1919import androidx.compose.animation.fadeIn
2020import androidx.compose.animation.fadeOut
2121import androidx.compose.runtime.Composable
22- import androidx.compose.runtime.compositionLocalOf
23- import androidx.compose.runtime.staticCompositionLocalOf
2422import androidx.compose.ui.Alignment.Companion.Center
2523import androidx.compose.ui.Modifier
2624import androidx.compose.ui.geometry.Rect
2725import androidx.compose.ui.graphics.Path
2826import androidx.compose.ui.layout.ContentScale
27+ import androidx.compose.ui.platform.LocalInspectionMode
2928import androidx.compose.ui.unit.Density
3029import androidx.compose.ui.unit.LayoutDirection
3130import androidx.navigation3.ui.LocalNavAnimatedContentScope
32- import com.getcode.navigation. animation.LocalSharedTransitionScope
31+ import com.getcode.animation.LocalSharedTransitionScope
3332
3433sealed class SharedTransition (
3534 val key : String ,
@@ -84,7 +83,7 @@ val CircleOverlayClip: OverlayClip =
8483@Composable
8584fun Modifier.sharedBoundsTransition (
8685 key : String ,
87- animatedVisibilityScope : AnimatedVisibilityScope = LocalNavAnimatedContentScope .current ,
86+ animatedVisibilityScope : AnimatedVisibilityScope ? = null ,
8887 sharedTransitionScope : SharedTransitionScope = LocalSharedTransitionScope .current,
8988 enter : EnterTransition = fadeIn(),
9089 exit : ExitTransition = fadeOut(),
@@ -95,12 +94,18 @@ fun Modifier.sharedBoundsTransition(
9594 placeholderSize : PlaceholderSize = AnimatedSize ,
9695 clipInOverlayDuringTransition : OverlayClip = ParentClip ,
9796): Modifier {
97+ if (LocalInspectionMode .current) {
98+ return this
99+ }
100+
101+ val animatedScope = animatedVisibilityScope ? : LocalNavAnimatedContentScope .current
102+
98103 return with (sharedTransitionScope) {
99104 this @sharedBoundsTransition.sharedBounds(
100105 sharedContentState = rememberSharedContentState(key = key),
101106 enter = enter,
102107 exit = exit,
103- animatedVisibilityScope = animatedVisibilityScope ,
108+ animatedVisibilityScope = animatedScope ,
104109 boundsTransform = boundsTransform,
105110 renderInOverlayDuringTransition = renderInOverlayDuringTransition,
106111 resizeMode = resizeMode,
@@ -114,7 +119,7 @@ fun Modifier.sharedBoundsTransition(
114119@Composable
115120fun Modifier.sharedBoundsTransition (
116121 transition : SharedTransition ,
117- animatedVisibilityScope : AnimatedVisibilityScope = LocalNavAnimatedContentScope .current ,
122+ animatedVisibilityScope : AnimatedVisibilityScope ? = null ,
118123 sharedTransitionScope : SharedTransitionScope = LocalSharedTransitionScope .current,
119124 zIndexInOverlay : Float = 0f,
120125 renderInOverlayDuringTransition : Boolean = true,
@@ -139,17 +144,23 @@ fun Modifier.sharedBoundsTransition(
139144@Composable
140145fun Modifier.sharedElementTransition (
141146 key : String ,
142- animatedVisibilityScope : AnimatedVisibilityScope = LocalNavAnimatedContentScope .current ,
147+ animatedVisibilityScope : AnimatedVisibilityScope ? = null ,
143148 sharedTransitionScope : SharedTransitionScope = LocalSharedTransitionScope .current,
144149 boundsTransform : BoundsTransform = DefaultTransform ,
145150 placeholderSize : PlaceholderSize = AnimatedSize ,
146151 zIndexInOverlay : Float = 0f,
147152 renderInOverlayDuringTransition : Boolean = true,
148153): Modifier {
154+ if (LocalInspectionMode .current) {
155+ return this
156+ }
157+
158+ val animatedScope = animatedVisibilityScope ? : LocalNavAnimatedContentScope .current
159+
149160 return with (sharedTransitionScope) {
150161 this @sharedElementTransition.sharedElement(
151162 sharedContentState = rememberSharedContentState(key = key),
152- animatedVisibilityScope = animatedVisibilityScope ,
163+ animatedVisibilityScope = animatedScope ,
153164 boundsTransform = boundsTransform,
154165 placeholderSize = placeholderSize,
155166 zIndexInOverlay = zIndexInOverlay,
@@ -161,7 +172,7 @@ fun Modifier.sharedElementTransition(
161172@Composable
162173fun Modifier.sharedElementTransition (
163174 transition : SharedTransition ,
164- animatedVisibilityScope : AnimatedVisibilityScope = LocalNavAnimatedContentScope .current ,
175+ animatedVisibilityScope : AnimatedVisibilityScope ? = null ,
165176 boundsTransform : BoundsTransform ? = null,
166177 sharedTransitionScope : SharedTransitionScope = LocalSharedTransitionScope .current,
167178 placeholderSize : PlaceholderSize = AnimatedSize ,
@@ -190,6 +201,10 @@ fun Modifier.sharedElementTransitionWithCallerManagedVisibility(
190201 renderInOverlayDuringTransition : Boolean = true,
191202 clipInOverlayDuringTransition : OverlayClip = ParentClip ,
192203): Modifier {
204+ if (LocalInspectionMode .current) {
205+ return this
206+ }
207+
193208 return with (sharedTransitionScope) {
194209 this @sharedElementTransitionWithCallerManagedVisibility.sharedElementWithCallerManagedVisibility(
195210 sharedContentState = rememberSharedContentState(key = key),
0 commit comments