Skip to content

Commit

Permalink
Update Docs and Sample to use new API for adding custom Navigators
Browse files Browse the repository at this point in the history
Fixes #744
  • Loading branch information
jossiwolf committed Sep 29, 2021
1 parent 6611ebd commit 59325c2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
9 changes: 3 additions & 6 deletions docs/navigation-material.md
Expand Up @@ -18,9 +18,8 @@ This features composable bottom sheet destinations.
```kotlin
@Composable
fun MyApp() {
val navController = rememberNavController()
val bottomSheetNavigator = rememberBottomSheetNavigator()
navController.navigatorProvider += bottomSheetNavigator
val navController = rememberNavController(bottomSheetNavigator)
}
```

Expand All @@ -29,9 +28,8 @@ This features composable bottom sheet destinations.
```kotlin
@Composable
fun MyApp() {
val navController = rememberNavController()
val bottomSheetNavigator = rememberBottomSheetNavigator()
navController.navigatorProvider += bottomSheetNavigator
val navController = rememberNavController(bottomSheetNavigator)
ModalBottomSheetLayout(bottomSheetNavigator) {
NavHost(navController, Destinations.Home) {
// We'll define our graph here in a bit!
Expand All @@ -45,9 +43,8 @@ This features composable bottom sheet destinations.
```kotlin
@Composable
fun MyApp() {
val navController = rememberNavController()
val bottomSheetNavigator = rememberBottomSheetNavigator()
navController.navigatorProvider += bottomSheetNavigator
val navController = rememberNavController(bottomSheetNavigator)
ModalBottomSheetLayout(bottomSheetNavigator) {
NavHost(navController, Destinations.Home) {
composable(route = "home") {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
@@ -1,6 +1,6 @@
[versions]
compose = "1.0.2"
composesnapshot = "-" # a single character = no snapshot
composesnapshot = "7778007" # a single character = no snapshot

# gradlePlugin and lint need to be updated together
gradlePlugin = "7.0.2"
Expand All @@ -13,7 +13,7 @@ okhttp = "3.12.13"
coil = "1.3.0"

androidxtest = "1.4.0"
androidxnavigation = "2.4.0-alpha09"
androidxnavigation = "2.4.0-SNAPSHOT"

[libraries]
compose-ui-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
Expand Down
Expand Up @@ -198,9 +198,9 @@ internal class BottomSheetNavigatorTest {
val sheetState = ModalBottomSheetState(ModalBottomSheetValue.Hidden)

composeTestRule.setContent {
navController = rememberNavController()
navigator = remember { BottomSheetNavigator(sheetState) }
navController = rememberNavController(navigator)
if (savedState != null) navController.restoreState(savedState)
navigator = remember(navController) { BottomSheetNavigator(sheetState) }
navController.navigatorProvider += navigator
if (compositionState == 0) {
ModalBottomSheetLayout(
Expand Down
Expand Up @@ -58,9 +58,8 @@ private object Destinations {
@OptIn(ExperimentalMaterialNavigationApi::class)
@Composable
fun BottomSheetNavDemo() {
val navController = rememberNavController()
val bottomSheetNavigator = rememberBottomSheetNavigator()
navController.navigatorProvider += bottomSheetNavigator
val navController = rememberNavController(bottomSheetNavigator)

ModalBottomSheetLayout(bottomSheetNavigator) {
NavHost(navController, Destinations.Home) {
Expand Down

0 comments on commit 59325c2

Please sign in to comment.