Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commonize "material-navigation" module. #1504

Merged
merged 2 commits into from
Aug 27, 2024
Merged

Conversation

terrakok
Copy link
Member

@terrakok terrakok commented Aug 20, 2024

Make "material-navigation" multiplatform.

Fixes https://youtrack.jetbrains.com/issue/CMP-1365

Testing

Checked the module manually
image

commonMain.dependencies {
    implementation(compose.runtime)
    implementation(compose.foundation)
    implementation(compose.material)
    implementation("org.jetbrains.androidx.navigation:navigation-compose:...")
    implementation("org.jetbrains.compose.material:material-navigation:...")
}
@Composable
internal fun App() = AppTheme {

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

    ModalBottomSheetLayout(bottomSheetNavigator) {
        NavHost(navController, startDestination = "start") {
            composable("start") {
                Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
                    Column {
                        Text("START")
                        Button(onClick = { navController.navigate("screen_1") }) {
                            Text("NEXT")
                        }
                        Button(onClick = { navController.navigate("bottomSheet") }) {
                            Text("Bottom Sheet")
                        }
                    }
                }
            }
            composable("screen_1") {
                Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
                    Column {
                        Text("SCREEN 1")
                        Button(onClick = { navController.popBackStack() }) {
                            Text("EXIT")
                        }
                    }
                }
            }
            bottomSheet("bottomSheet") {
                Box(contentAlignment = Alignment.Center) {
                    Column {
                        Text("Bottom Sheet")
                        Button(onClick = { navController.navigate("bottomSheet") }) {
                            Text("More sheet")
                        }
                        Button(onClick = { navController.popBackStack() }) {
                            Text("EXIT")
                        }
                    }
                }
            }
        }
    }
}

Release Notes

Features - Multiple Platforms

  • New multiplatform module "material-navigation" (in beta status)

Because it is the latest published material-navigation version
@terrakok terrakok requested review from MatkovIvan and igordmn August 20, 2024 12:54
@terrakok terrakok force-pushed the k.tskh/material-navigation branch from 848aa6e to a88343a Compare August 21, 2024 07:45
@terrakok terrakok force-pushed the k.tskh/material-navigation branch from a88343a to 7c60e68 Compare August 21, 2024 09:05
@terrakok terrakok requested a review from MatkovIvan August 21, 2024 09:44
@terrakok terrakok merged commit c96b59a into jb-main Aug 27, 2024
6 checks passed
@terrakok terrakok deleted the k.tskh/material-navigation branch August 27, 2024 14:00
@igordmn
Copy link
Collaborator

igordmn commented Aug 27, 2024

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants