'compose NavHost Start the white Screen
My app starts with navigation globally, but I found that when I set the following code, the app will remain blank after startup unless I manually touch the screen.
rememberSystemUiController().setStatusBarColor(
Color.Transparent,
darkIcons = true //This sentence must be set
)
fun AppNavigation(
appNavController:NavHostController = LocalAppNavController.current
) {
NavHost(
navController = appNavController,
startDestination = Screen.Splash.route
) {
composable(route = Screen.Splash.route) {
SplashScreen()
}
composable(route = Screen.HelloScreen.route) {
HelloScreen()
}
composable(route = Screen.HomeScreen.route) {
val popItem = remember{
mutableStateOf(NULL_MEDIA_ITEM)
}
CompositionLocalProvider(
LocalHomeNavController provides rememberNavController(),
LocalNetViewModel provides hiltViewModel(),
LocalUserViewModel provides hiltViewModel(),
LocalHomeViewModel provides hiltViewModel(),
LocalPopWindowItem provides popItem
){
LocalUserViewModel.current.initializeController()
HomeScreen()
}
}
}
}
Solution 1:[1]
It seems like a known issue: https://issuetracker.google.com/issues/227926002
As of comments - different Xiaomi models affected. My POCO one affected too.
Solution 2:[2]
Put your AppNavigation fun in Scaffold:
YourAppTheme {
Scaffold {
AppNavigation()
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | uptoyou |
Solution 2 | Max Mayers |