https://kotlinlang.org logo
#compose
Title
# compose
v

Vlad Gorbunov

04/05/2020, 10:50 AM
Hello, i am experiencing wierd behaviour when using
Card
inside
AdapterList
For example this code:
Copy code
@Composable
fun ArticleAdapterList(data: List<Article>) {
    AdapterList(data = data) { item ->
        Column {
            Column {
                Text(text = item.title)
                Text(text = item.content.take(200))
            }
        }
    }
}
works just fine, but once i change it to:
Copy code
@Composable
fun ArticleAdapterList(data: List<Article>) {
    AdapterList(data = data) { item ->
        Card(shape = RoundedCornerShape(8.dp), elevation = 4.dp, modifier = Modifier.fillMaxWidth() + Modifier.padding(8.dp)) {
            Column {
                Text(text = item.title)
                Text(text = item.content.take(200))
            }
        }
    }
}
i am getting
java.lang.IllegalStateException: Node should be attached to an owner
once i start scrolling anyone with similar issue? Thanx
v

Val Salamakha

04/06/2020, 2:00 AM
I got the same error, but not from start. It happened after playing some time with scrolling on AS-4.1-alpha04 compose 0.1.0-dev08. I
t

Timo Drick

04/06/2020, 2:03 PM
For me it is finaly more or less working in dev-08. But onDispose is not called for the composables. Maybe this is also the reason why it will show wired behavior after some time. So still not able to use AdapterList espacially for showing lists of images.
v

Vlad Gorbunov

04/06/2020, 2:06 PM
Yeah, i am leaking things too, but i am also presenting quite a lot of stuff from database on first start and it takes a while until VerticalScroller gets drawn… 🤯
k

Kismet

04/06/2020, 3:27 PM
Hi Vlad, how are you able to run with
Copy code
0.1.0-dev08
?
I have static function error, i thought 0.1.0-dev08 was broken?
v

Vlad Gorbunov

04/06/2020, 3:37 PM
it would be nice to see your error, but generally, i had to split app into modules so that kapt + experimental suicide squad (room, flow, compose) does not reside in single module so: • separate module for database (room only) • aggregator data module which already provides ready to consume data (flow only) • feature modules with ui + viewModels (compose only)
k

Kismet

04/06/2020, 7:45 PM
Thanks!
v

Val Salamakha

04/07/2020, 12:16 AM
The error has nothing with any data as text, because it arises without them.
r

Ryan Mentley

04/08/2020, 12:13 PM
But onDispose is not called for the composables.
https://issuetracker.google.com/issues/150174792
👍 2