-
-
Notifications
You must be signed in to change notification settings - Fork 771
Description
When using Koin Navigation 3 integration, the provided koinEntryProvider() always returns:
(Any) -> NavEntry<Any>This works as long as NavDisplay is inferred as NavDisplay.
However, when using a typed SceneStrategy, such as:
rememberSupportingPaneSceneStrategy<Route>()NavDisplay becomes explicitly typed as NavDisplay, and the compiler then expects:
(Route) -> NavEntry<Route>This causes a type mismatch, even though the setup works correctly at runtime.
Reproduction
@Composable
fun NavHost(
backStack: NavBackStack<Route>,
onBack: () -> Unit
) {
val entryProvider = koinEntryProvider()
val sceneStrategy = rememberSupportingPaneSceneStrategy<Route>()
NavDisplay(
backStack = backStack,
onBack = onBack,
sceneStrategy = sceneStrategy,
entryProvider = entryProvider // ❌ type mismatch
)
}Compiler error:
Argument type mismatch: actual type is "Function1<Any, NavEntry<Any>>", but "Function1<Route, NavEntry<Route>>" was expected.
Important observation
If sceneStrategy is removed, the code compiles and works:
NavDisplay(
backStack = backStack,
onBack = onBack,
entryProvider = entryProvider // ✅ compiles
)This happens because NavDisplay is inferred as NavDisplay when no typed SceneStrategy is provided.
Environment
-
koin-compose-navigation3: 4.2.0-beta2
-
navigation3: 1.0.0
-
material3-adaptive-navigation3: 1.3.0-alpha05