Search code examples
androidandroid-jetpack-composelazycolumn

Migrate jetpack compose from 1.0.5 to 1.1.1 : Card issue


I'm facing a weird issue with the latest stable version of Jetpack compose. When I was using version 1.0.5 everything was fine with LazyColumn

I'm migrating an app from Jetpack compose version 1.0.5 to 1.1.1

but when I run the app, it shows some vertical gap between the LazyColumn items enter image description here

When I checked, the contentPadding it still 0.dp on the LazyDsl.kt

contentPadding: PaddingValues = PaddingValues(0.dp)

I also haven't used any verticalArrangement

TIA


Solution

  • After spending lots of hours, I found that the padding was generated by onClick on JetpackCompose Card. I fixed it using Modifier.clickable{} as below:

    Before

        Card(
             elevation = paddingZero,
             onClick = { 
             // listener here
             }
        )
    

    After

        Card(
            elevation = paddingZero,
            modifier = Modifier.clickable {
                // listener here
            }
        )
    

    This fixed my issue. I hope this can be helpful to someone who is having same issue.