Skip to content

Commit

Permalink
Fix crash because of incompatible lifecycle and compose versions
Browse files Browse the repository at this point in the history
Signed-off-by: Yurii Surzhykov <yuriisurzhykov@gmail.com>
  • Loading branch information
yuriisurzhykov committed May 29, 2024
1 parent d7d1268 commit 85d1ac8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ espressoCore = "3.5.1"
androidx-lifecycle = "2.8.1"
activityCompose = "1.9.0"
composeBom = "2024.05.00"
androidx-compose-runtime = "1.6.7"
androidx-compose-runtime = "1.7.0-beta02"
androidx-compose-kotlin-compiler-ext = "1.5.14"
retrofit = "2.9.0"
kotlinx-coroutines = "1.8.0"
Expand Down Expand Up @@ -50,6 +50,7 @@ androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", versi
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" }
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtime-compose-android = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose-android", version.ref = "androidx-lifecycle" }

androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
Expand Down Expand Up @@ -88,7 +89,6 @@ androidx-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomato
androidx-benchmark-macro-junit4 = { group = "androidx.benchmark", name = "benchmark-macro-junit4", version.ref = "benchmarkMacroJunit4" }
androidx-profileinstaller = { group = "androidx.profileinstaller", name = "profileinstaller", version.ref = "profileinstaller" }
material = { group = "com.google.android.material", name = "material", version.ref = "materialVersion" }
androidx-lifecycle-runtime-compose-android = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose-android", version.ref = "androidx-lifecycle" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ internal fun LocationDetails(
viewModel: LocationDetailsViewModel,
modifier: Modifier = Modifier
) {
val state: State by viewModel.detailsResponse.collectAsStateWithLifecycle()
val state: State by viewModel.detailsResponse.collectAsStateWithLifecycle(lifecycleOwner = androidx.compose.ui.platform.LocalLifecycleOwner.current)
BackgroundImage(modifier = modifier.fillMaxSize())
if (state != State.None) {
Content(state = state, modifier = modifier.fillMaxSize())
Expand Down

0 comments on commit 85d1ac8

Please sign in to comment.