From 9ba33ef48c68de520628f48c44105ad99b336348 Mon Sep 17 00:00:00 2001 From: Alex Sokol / y9san9 Date: Mon, 19 Feb 2024 00:59:01 +0300 Subject: [PATCH] fix: composable invocation fix --- .../di/android/compose/navigation/NavController.kt | 10 ++++++++-- gradle/libs.versions.toml | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/compose/src/main/kotlin/app/meetacy/di/android/compose/navigation/NavController.kt b/compose/src/main/kotlin/app/meetacy/di/android/compose/navigation/NavController.kt index 528fd2e..fad21b7 100644 --- a/compose/src/main/kotlin/app/meetacy/di/android/compose/navigation/NavController.kt +++ b/compose/src/main/kotlin/app/meetacy/di/android/compose/navigation/NavController.kt @@ -1,3 +1,5 @@ +@file:Suppress("NAME_SHADOWING") + package app.meetacy.di.android.compose.navigation import androidx.compose.runtime.* @@ -26,6 +28,10 @@ public fun NavigationScreen( } @Composable -public fun buildNavigationDI(di: DI): DI = di + di { - val navController by provider { LocalNavController.current } +public fun buildNavigationDI(di: DI): DI { + val navController = LocalNavController.current + + return di + di { + val navController by constant(navController) + } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6632aa0..7f3ba9e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ composeCompiler = "1.5.6" androidxNavigation = "2.7.7" lifecycle = "2.6.1" -mdi = "0.0.33" +mdi = "0.0.34" [libraries]