Getting weird Error when trying LazyColumn() in Jetpack compose
Asked Answered
A

1

5

I am trying to run a simple LazyColumn Object, but am unable to run it without this weird error. Here is my code:

@Composable 
fun Test(){
    LazyColumn() {
        Text(text = "Placeholder", fontSize= 30.sp)
        Spacer(modifier = Modifier.padding(10.dp))
    }
}

Here are the errors:

org.jetbrains.kotlin.diagnostics.SimpleDiagnostic@74c0fa2 (error: could not render message)

org.jetbrains.kotlin.diagnostics.SimpleDiagnostic@c077eec3 (error: could not render message)

Is it something wrong with my code, or is it a bug? *I wanted to test the scroll function by copy and pasting the lines after the LazyColumn() statement over and over

Audio answered 9/4, 2021 at 17:35 Comment(0)
O
8

With 1.0.0-beta04 you can use:

val itemsList = (0..50).toList()
LazyColumn() {
    items(itemsList) {
        Text(text = "Placeholder", fontSize = 30.sp)
        Spacer(modifier = Modifier.padding(10.dp))
    }
}

In the LazyListScope in order to display the items you have to use one the provided functions:item, items, itemsindexed and stickyHeader.

Oba answered 9/4, 2021 at 18:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.