accompanist icon indicating copy to clipboard operation
accompanist copied to clipboard

[Navigation Material] Unexpected transition animation when navigating between BottomSheetNavigator.Destinations

Open lilemma opened this issue 2 years ago • 11 comments

Description When navigating to from one BottomSheetNavigator.Destination to another BottomSheetNavigator.Destination, the current sheet slides down vertically, and the new sheet slides vertically up.

Steps to reproduce

val bottomSheetNavigator = rememberBottomSheetNavigator()
val navController = rememberAnimatedNavController(bottomSheetNavigator)
val scaffoldState = rememberScaffoldState()

ModalBottomSheetLayout(bottomSheetNavigator = bottomSheetNavigator) {
    Scaffold(
        scaffoldState = scaffoldState,
        snackbarHost = { scaffoldState.snackbarHostState }
    ) {
        AnimatedNavHost(navController = navController, startDestination = "home") {
            composable("home") {
                Button(onClick = {
                    navController.navigate("firstSheet")
                }) {
                    Text(text = "Show sheet")
                }
            }
            bottomSheet("firstSheet") {
                Button(onClick = {
                    navController.navigate("secondSheet")
                }) {
                    Text(text = "Show second sheet")
                }
            }
            bottomSheet("secondSheet") {
                Button(onClick = {
                    navController.navigate("firstSheet")
                }) {
                    Text(text = "Show first sheet")
                }
            }
        }
    }
}

Expected behavior The documentation for BottomSheetNavigator: The sheetContent will always host the latest entry of the back stack. When navigating from a BottomSheetNavigator.Destination to another BottomSheetNavigator.Destination, the content of the sheet will be replaced instead of a new bottom sheet being shown.

The way I interprete the documentation, I would expect the content for ModalBottomSheetLayout to be replaced, and not dismissing the sheet and showing a new one whenever I navigate from one BottomSheetNavigator.Destination to another BottomSheetNavigator.Destination.

If this is just the default and only behaviour for showing bottomsheets, I would suggest the NavGraphBuilder.bottomSheet to support the params enterTransition, exitTransition, (maybe popEnterTransition and popExitTransition) as NavGraphBuilder.composable

lilemma avatar Aug 30 '22 12:08 lilemma

@jbw0033 This sounds like a reasonable request to me. It's still blocked by upstream Swipeable work but would be nice to support in the future. WDYT?

jossiwolf avatar Sep 23 '22 16:09 jossiwolf

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Oct 24 '22 04:10 github-actions[bot]

@jossiwolf I agree, that this would be a nice - also as stated in #1176, designers/UX designers are really keen on requesting more fin-grained handling of bottomsheet size/transitions. 🙌

MarcLFJ avatar Oct 24 '22 05:10 MarcLFJ

@jossiwolf @jbw0033 I Agree with @MarcLFJ . Please help us by helping satisfy our designers 🥹

lilemma avatar Oct 24 '22 06:10 lilemma

@jossiwolf Any news on this issue/request? :)

MarcLFJ avatar Feb 03 '23 08:02 MarcLFJ

Hi! Not yet, we are working on more stability improvements for the time being :)

jossiwolf avatar Feb 05 '23 18:02 jossiwolf

@jossiwolf Is this actually still waiting on dependency (Potentially the swipeable issue which was fixed not long ago?) or should the label be changed to something else? :)

MarcLFJ avatar Feb 08 '23 12:02 MarcLFJ

@jossiwolf any updates on this?

AnkitSuda avatar Mar 03 '23 11:03 AnkitSuda

@jossiwolf Any info or timeline for this issue? :)

MarcLFJ avatar Mar 16 '23 10:03 MarcLFJ

@jossiwolf Since the https://issuetracker.google.com/issues/167966118 has been fixed, can we expect this to be looked into anytime in the near future?

lilemma avatar Mar 27 '23 08:03 lilemma

Apologies, while the main blocker has been fixed, this is not high on our overall list of priorities. We are happy accept design suggestions or contributions though!

jossiwolf avatar Mar 27 '23 09:03 jossiwolf

With the release of Compose Material 1.7.0-alpha04, the Material team has added a new artifact: androidx.compose.material:material-navigation, which fully replaces Accompanist Navigation Material.

As such, we are closing all issues here on Accompanist and will be fully deprecating Accompanist Navigation Material in an upcoming release.

A number of issues were fixed as part of the migration, but if you're still seeing an issue, please file an issue with a sample project that reproduces your issue and the Material team will take a look.

ianhanniballake avatar Mar 08 '24 06:03 ianhanniballake