Jetpack Compose Vertical Scrolling is interrupted by Horizontal Scrolling

2.2k Views Asked by At

I have create a Column having 5 Rows, Column has vertical scrolling enabled and Rows has horizontal scrolling enabled.

Sometimes when I try to fling or scroll vertically, Rows consume the gesture and stops vertical scroll to happen.

is there a way to enable horizontal scroll only when certain x-delta is dragged/swipped/scrolled?

enter image description here

code to reproduce :

                val colors = remember {
                    listOf(
                        Color.Blue,
                        Color.Green,
                        Color.Cyan,
                        Color.Magenta
                    )
                }

                Box(
                    modifier = Modifier

                ) {
                    Column(
                        modifier = Modifier
                            .padding(top = 200.dp)
                            .fillMaxSize()
                            .verticalScroll(rememberScrollState())
                    ) {
                        repeat(5) {
                            Row(
                                modifier = Modifier
                                    .fillMaxWidth()
                                    .padding(8.dp)
                                    .horizontalScroll(rememberScrollState())
                            ) {
                                repeat(5) {
                                    Box(
                                        modifier = Modifier
                                            .size(200.dp)
                                            .background(
                                                color = remember {
                                                    colors.random()
                                                }
                                            )
                                    )
                                }
                            }
                        }
                    }
                }

Edit 1: this is a bug in compose issue added to tracker

0

There are 0 best solutions below