Open jibe-n opened 2 months ago
To make it more obvious, passing spring()
here brings back the old behavior and removes the delay.
val sheetState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
animationSpec = spring(),
)
val bottomSheetNavigator = remember(sheetState) {
BottomSheetNavigator(sheetState = sheetState)
}
or if you don't need to override the sheet state, just
val bottomSheetNavigator = rememberBottomSheetNavigator(
animationSpec = spring(),
)
Hi! 👋
I'm currently using compose-destinations 2.1.0-beta11 and I noticed a slight delay when a bottom sheet is opened.
This delayed animation only happens when I pass a customised sheet state to my
BottomSheetNavigator
instead of doingrememberBottomSheetNavigator()
, like so:After digging a bit, I noticed that the
ModalBottomSheetDefaults.AnimationSpec
fromandroidx.compose.material
(which defaults theanimationSpec
ofrememberModalBottomSheetState()
) was recently changed from aSpringSpec()
to atween()
animation, leading to this delay. For more context, this change was made to resolve this issue: https://issuetracker.google.com/issues/285847707As a temporary solution, I just pass a
SpringSpec()
to theanimationSpec
parameter of therememberModalBottomSheetState()
constructor which removes this delay, but I was wondering if that's something you would be able to look into because I think this problem might happen in future releases.I'm not sure why this is happening, I made 2 sample projects that respectively use
androidx.compose.material3:material3:1.3.0-rc01
for one andandroidx.compose.material:material:1.7.0-rc01
for the other (which both use the newly changedtween()
animationSpec
in their bottom sheet implementation) to see if that delay exists but none of them have the issue.You can reproduce this delayed behaviour by simply adding a
tween()
animationSpec
in thePlaygroundScaffold.kt
file when declaring the bottom sheet navigator.