Hi everyone! someone is using navTypes in compose ...
# multiplatform
s
Hi everyone! someone is using navTypes in compose multiplatform? I see that the version 2.9.0-alpha08 is include now in compose library and now is possible use them starting a thread to see the problem related navigator
🧵 4
what is my problem? i have my app where i rememmber de navigator, also i observe a global state manager (an object) to control general logic, like if show top bar, bottom bar... and i define my navHost, the problem is that whenever i change something in my global state manager the composable change and start again the pages and the nav host set to the start navigation. my app is something like this
Copy code
@Composable
fun AppScaffold() {
    val navController = rememberNavController()
    val shouldShowBottomBar = remember { mutableStateOf(true) }. // these val are set by my globalStateManager
    val drawerContent = remember { mutableStateOf<(@Composable () -> Unit)?>(null) }
    val snackbarContent = remember { mutableStateOf<(@Composable () -> Unit)?>(null) }
    val floatingActionButtonState = remember { mutableStateOf(FloatingActionButtonState()) }
    val scope = rememberCoroutineScope()

    CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
        ModalNavigationDrawer(
            drawerState = rememberDrawerState(DrawerValue.Closed),
            drawerContent = {
                CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
                    drawerContent.value?.invoke()
                }
            },
            gesturesEnabled = drawerContent.value != null
        ) {
            CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
                Scaffold(
                    topBar = {
 if (show topbar.value.show) {
                        TopAppBar(
                            title = { Text("Title") },
                            modifier = Modifier
                                .fillMaxWidth()
                                .heightIn(max = 56.dp)
                        )
                    },
                    floatingActionButton = {
                        if (floatingActionButtonState.value.show) {
                            FloatingActionButton(onClick = { /* Do something */ }) {
                                Icon(Icons.Default.Add, contentDescription = "FAB")
                            }
                        }
                    },
                    bottomBar = {
                        if (shouldShowBottomBar.value) {
                            BottomAppBar {
                                // Bottom navigation items
                            }
                        }
                    },
                    snackbarHost = {
                        SnackbarHost(hostState = remember { SnackbarHostState() }) { data ->
                            snackbarContent.value?.invoke(data)
                        }
                    },
                ) { paddingValues ->
                    MainNavigationController(
                        navController = navController,
                        paddingValues = paddingValues
                    )
                }
            }
        }
    }
}
someone else has experienced that?