user924
user924

Reputation: 12293

compose.material.navigation.bottomSheet - "Using a material import while also using the material3 library" warning. But what's the alternative?

So I'm trying to define BottomSheet as navigation routes using compose.material.navigation.bottomSheet based on the example from official docs:

val bottomSheetNavigator = rememberBottomSheetNavigator()
val navController = rememberNavController(bottomSheetNavigator)

ModalBottomSheetLayout(bottomSheetNavigator) {
    NavHost(navController, Destinations.Home) {
        composable(Destinations.Home) {
            HomeScreen(
                showSheet = {
                    navController.navigate(Destinations.Sheet + "?arg=From Home Screen")
                },
                showFeed = { navController.navigate(Destinations.Feed) }
            )
        }
        composable(Destinations.Feed) { Text("Feed!") }
        bottomSheet(Destinations.Sheet + "?arg={arg}") { backstackEntry ->
            val arg = backstackEntry.arguments?.getString("arg") ?: "Missing argument :("
            BottomSheet(
                showFeed = { navController.navigate(Destinations.Feed) },
                showAnotherSheet = {
                    navController.navigate(Destinations.Sheet + "?arg=${UUID.randomUUID()}")
                },
                arg = arg
            )
        }
    }
}

but it gives this warning

Using a material import while also using the material3 library

and I can't find out if such functionality available withing material3 libraries

enter image description here

Upvotes: 0

Views: 66

Answers (2)

BenjyTec
BenjyTec

Reputation: 10887

Please have a look at Ticket #328949006 at the Google Issue Tracker. It seems that this functionality is currently not supported with Material3, but there are some alternatives:

  • Library by Hrach on GitHub
  • Library by EyGraber on GitHub
  • Snippet by FlaringApp on GitHub (only supports navigating to one BottomSheet at a time)

You can star the issue in the Issue Tracker and leave a comment to draw more attention to it.

Upvotes: 1

Kristy Welsh
Kristy Welsh

Reputation: 8362

This just means you are mixing Material2 and Material3 components.

Upvotes: 0

Related Questions