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

Can't switch dark theme in compose-m3 1.2.0+ and NestedNavigator #489

Open
qdsfdhvh opened this issue Sep 20, 2024 · 2 comments
Open

Can't switch dark theme in compose-m3 1.2.0+ and NestedNavigator #489

qdsfdhvh opened this issue Sep 20, 2024 · 2 comments

Comments

@qdsfdhvh
Copy link
Contributor

qdsfdhvh commented Sep 20, 2024

Hi, I'm using voyager with compose-multiplatform 1.6.11 and I'm having an issue with the dark theme switching, codes like this:

setContent {
    var isNight by remember {
        mutableStateOf(false)
    }
    SwitchthemeinnestednavigatorTheme(isNight) {
        Navigator(HiddenScreen) {
            Navigator(HiddenScreen) { // ✅ if hide this line
                Scaffold { innerPadding ->
                    ...
                }
            }
        }
    }
}
implementation(compose.material3) // same with 1.2.1 🚫
// implementation("androidx.compose.material3:material3:1.1.2") // ✅
// implementation("androidx.compose.material3:material3:1.2.0") // 🚫
// implementation("androidx.compose.material3:material3:1.2.1") // 🚫
// implementation("androidx.compose.material3:material3:1.3.0") // 🚫

Nested Navigator will cause the dark theme to not switch, currently, I found two workaround:

  1. remove nested navigator.

  2. downgrade compose-md3 to 1.1.0+.

But I haven't found the real reason yet and need to ask for help.

demo: https://github.com/qdsfdhvh/switch-theme-in-nested-navigator

@hristogochev
Copy link

This may be related to #486 and #484, seems like the newest versions of compose partially break nested navigation in voyager.

@hristogochev
Copy link

hristogochev commented Oct 18, 2024

This is an issue with Compose Multiplatform.

I've opened a workaround PR for Voyager.

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

No branches or pull requests

2 participants