Skip to content

Commit 91ea1af

Browse files
committed
fix: use preset transitions for in-sheet nav
1 parent d54f349 commit 91ea1af

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

app/src/main/java/to/bitkit/ui/nav/SheetSceneStrategy.kt

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
package to.bitkit.ui.nav
22

33
import androidx.compose.animation.AnimatedContent
4-
import androidx.compose.animation.core.FastOutSlowInEasing
5-
import androidx.compose.animation.core.tween
6-
import androidx.compose.animation.fadeIn
7-
import androidx.compose.animation.fadeOut
8-
import androidx.compose.animation.slideInHorizontally
9-
import androidx.compose.animation.slideOutHorizontally
10-
import androidx.compose.animation.togetherWith
114
import androidx.compose.runtime.Composable
125
import androidx.navigation3.runtime.NavEntry
136
import androidx.navigation3.scene.OverlayScene
@@ -68,8 +61,6 @@ data class SheetProperties(
6861
val size: SheetSize = SheetSize.LARGE,
6962
)
7063

71-
private const val MS_ANIM_DURATION = 300
72-
7364
private data class IndexedEntry<T : Any>(
7465
val index: Int,
7566
val entry: NavEntry<T>,
@@ -102,32 +93,9 @@ internal class SheetScene<T : Any>(
10293
transitionSpec = {
10394
val isForward = targetState.index > initialState.index
10495
if (isForward) {
105-
// Forward navigation: slide in from right, slide out to left
106-
slideInHorizontally(
107-
initialOffsetX = { it },
108-
animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing)
109-
) + fadeIn(
110-
animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing),
111-
initialAlpha = 0.8f
112-
) togetherWith slideOutHorizontally(
113-
targetOffsetX = { -it / 3 },
114-
animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing)
115-
) + fadeOut(
116-
animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing),
117-
targetAlpha = 0.8f
118-
)
96+
Transitions.screenDefault.invoke(this)
11997
} else {
120-
// Backward navigation: slide in from left, slide out to right
121-
slideInHorizontally(
122-
initialOffsetX = { -it / 3 },
123-
animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing)
124-
) + fadeIn(
125-
animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing),
126-
initialAlpha = 0.8f
127-
) togetherWith slideOutHorizontally(
128-
targetOffsetX = { it },
129-
animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing)
130-
)
98+
Transitions.screenDefaultPop.invoke(this)
13199
}
132100
},
133101
label = "SheetContentTransition",

0 commit comments

Comments
 (0)