Hi! I'm trying to run nav3 with newest compose mul...
# multiplatform
b
Hi! I'm trying to run nav3 with newest compose multiplatform 1.10-beta02. It runs fine in apps, but i have problem with
@Preview
i get
Copy code
java.lang.IllegalStateException: No NavigationEventDispatcher was provided via LocalNavigationEventDispatcherOwner
  at androidx.navigationevent.compose.NavigationEventHandlerKt.NavigationEventHandler(NavigationEventHandler.kt:82)
  at androidx.navigationevent.compose.NavigationEventHandlerKt.NavigationBackHandler(NavigationEventHandler.kt:148)
  at androidx.navigation3.ui.NavDisplayKt__NavDisplayKt.NavDisplay(NavDisplay.kt:296)
  at androidx.navigation3.ui.NavDisplayKt.NavDisplay  at androidx.navigation3.ui.NavDisplayKt__NavDisplayKt.NavDisplay(NavDisplay.kt:208)
  at androidx.navigation3.ui.NavDisplayKt.NavDisplay  at lol.omg.bartek.zdrowko.AppKt$App$1$2.invoke(App.kt:63)
I tested
androidx.compose.ui.tooling.preview.Preview
and
import androidx.compose.ui.tooling.preview.Preview
both gives same error. Some ideas how can I fix that
p
What are you @Preview-ing? Are you trying to pass in a navController to the Composable?
b
NavDisplay, i understand it won't work?
p
Can you paste a little bit of your code here in a code block?
b
Copy code
@Composable
@Preview
fun App() {
    val backStack = remember { mutableStateListOf(Home) }

    MaterialTheme {
        NavigationSuiteScaffold(
            navigationSuiteItems = {}

        ) {
            NavDisplay(
                backStack = backStack,
                entryProvider = entryProvider {
                    entry<Home> {
                        Column {
                            Text("Tesutuytt")
                        }
                    }
                }
            )
        }
    }
}
p
I don't think you can / should do a preview like this? Will Compose Hot Reload not work better for your use case?
Are you trying to get a quicker feedback cycle than deploying to a device each time?
b
ok, maybe for main app entrypoint is not the best solution, i haven't thought about that
i just wanted to see how my app looks like at the beginning
p
Understood 🙂
198 Views