Thread
#compose
    m

    Mohamed Elfiky

    1 year ago
    is this exception known
    Layer is redrawn for LayoutNode in state NeedsRelayout
    ?
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    no, it is not expected for sure. did you reproduce it on alpha05? could you please file a bug if you can stable reproduce it?
    m

    Mohamed Elfiky

    1 year ago
    thanks, this is the code maybe something i am doing wrong
    @Composable
    fun Test() {
        val state = rememberLazyListState()
        val selectedIndex = if (state.firstVisibleItemScrollOffset > 120) {
            state.firstVisibleItemIndex + 1
        } else {
            state.firstVisibleItemIndex
        }.coerceIn(0, 9)
    
        LazyRowForIndexed(
            items = (0..10).toList(),
            state = state,
        ) { index, item ->
                Card(
                    modifier = Modifier
                        .padding(horizontal = 4.dp, vertical = 16.dp)
                        .width(
                            animate(target = if (selectedIndex == index) 200.dp else 100.dp)
                        )
                        .height(120.dp),
                ) {
                    val imageId = when(index % 3) {
                        0 -> R.drawable.surffing_1
                        1 -> R.drawable.surrfing_2
                        else -> R.drawable.surffing_3
                    }
                    Image(
                        asset = imageResource(id = imageId),
                        contentScale = ContentScale.Crop
                    )
                }
        }
    }
    when i remove the Image no crashes happens. should i file a bug?
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    is it on alpha05?
    m

    Mohamed Elfiky

    1 year ago
    yes
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    Thanks. I filled a bug to investigate it: https://issuetracker.google.com/issues/171309350
    m

    Mohamed Elfiky

    1 year ago
    thanks
    should i file a bug from the beginning next time?
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    it is completely fine to ask here first if it is a known issue already before filling
    v

    Vincent tiensi

    1 year ago
    Just wanted to chime in since I can’t seem to comment on the issue directly. I’m getting the same error with a LazyColumn. For additional error info
    Layer is redrawn for LayoutNode in state NeedsRelayout [LayoutNode@80444f4 children: 0 measureBlocks: MeasuringIntrinsicsMeasureBlocks@f8be41d{ measureBlock=androidx.compose.foundation.ImageKt$Image$1$1@97f2692 }]
    . It may possibly be image related, I haven’t looked to deeply into it but it happens intermittently as my list paginates.
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    on what version of compose?
    v

    Vincent tiensi

    1 year ago
    1.0.0-alpha06
    is supposedly also an issue in the jetsnack sample app as well https://github.com/android/compose-samples/issues/236
    a

    Alexjlockwood

    1 year ago
    i just started seeing the issue vincent is seeing as well on alpha07
    JulianK

    JulianK

    1 year ago
    I'm experiencing the same issue in alpha07. Didn't have this exception on alpha05 (skipped 06).
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    it should be fixed in alpha08
    a

    allan.conda

    1 year ago
    I’m getting slightly different error:
    Layer is redrawn for LayoutNode in state NeedsRemeasure
    Is this the same issue with same fix?
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    most likely yes
    a

    allan.conda

    1 year ago
    glad to hear! 🙏