aipok

    aipok

    1 year ago
    Does anyone know how fake/pass navController to make a preview for BottomNavigation?
    k

    knthmn

    1 year ago
    The alternative is to factor out the composable to accept simple values and lambdas
    @Composable fun BottomNavigation(navController: NavController) {
        val currentDestination by navController.observeDestinationAsState()
        BottomNavigation(currentDestination, navController::navigate)
    }
    
    @Composable fun BottomNavigation(destination: String, navigate: (String) -> Unit) { ... }
    and you can use the second composable for previews
    i

    Ian Lake

    1 year ago