https://kotlinlang.org logo
Title
m

Mike Digman

05/09/2023, 3:21 AM
Hey folks, basic question, is
LazyVerticalStaggeredGrid
available for the canvas target? I'd imagine so because it's in foundation. I used it on a desktop jvm target no problem. However, I'm getting messy dependency issues when attempting to build for canvas.
The build error:
Module "org.jetbrains.compose.foundation:foundation" has a reference to symbol [ File '/mnt/agent/work/172e546b22c60d2b/compose/frameworks/support/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasureResult.kt' <- androidx.compose.foundation.lazy.staggeredgrid/LazyStaggeredGridPositionedItem|null[0] ]. Neither the module itself nor its dependencies contain such declaration.

This could happen if the required dependency is missing in the project. Or if there is a dependency of "org.jetbrains.compose.foundation:foundation" that has a different version in the project than the version that "org.jetbrains.compose.foundation:foundation" was initially compiled with. Please check that the project configuration is correct and has consistent versions of all required dependencies.
o

Oleksandr Karpovich [JB]

05/09/2023, 10:22 AM
What Compose Multiplatform version do you use? Do you target k/wasm or k/js?
It should be available. I guess some dependencies got messed up. For example 1.4.0 is mixed with 1.4.0-dev-wasm06
m

Mike Digman

05/09/2023, 3:43 PM
Ah I see, I'm using Compose MPP 1.4.0 with Kotlin 1.8.20. The build.gradle file I'm using for web canvas:
kotlin {
    js(IR) {
        binaries.executable()
    }
}
compose.experimental {
    web.application {}
}
o

Oleksandr Karpovich [JB]

05/09/2023, 3:45 PM
1.4.0 should work fine for k/js. Do you have a reproducer?
m

Mike Digman

05/09/2023, 3:45 PM
If 1.4.0 is mixed with 1.4.0-dev-wasm06, is there a way to know which build to use that'll support LazyVerticalStaggeredGrid?
Let me work on some repro code
This breaks the build with the above error on Compose MPP 1.4.0:
@OptIn(ExperimentalFoundationApi::class)
 @Composable fun LazyBuildFailureTest() {
     LazyVerticalStaggeredGrid(StaggeredGridCells.Adaptive(100.dp)) {
         item {
             Box(Modifier.background(color = Color.Blue).size(100.dp))
         }
     }
 }
Should I file a bug for ya?
o

Oleksandr Karpovich [JB]

05/09/2023, 3:57 PM
Yes, please 🙏