Accompanist Nested HorizontalPager disable swipes in parent

Viewed 514

I have a nested HorizontalPager like

HorizontalPager(
   count = list.size
) {
   HorizontalPager(
    count = list2.size
   ) {
     //items
   }
 }

is there any way to disable horizontal scrolling in parents pager, but enable in childrens.

This solution disables scroll in all childs views and it isn't what i need

private val HorizontalScrollConsumer = object : NestedScrollConnection {
    override fun onPreScroll(available: Offset, source: NestedScrollSource) = available.copy(y = 0f)
    override suspend fun onPreFling(available: Velocity) = available.copy(y = 0f)
}

fun Modifier.disabledHorizontalPointerInputScroll(disabled: Boolean = true) =
    if (disabled) this.nestedScroll(HorizontalScrollConsumer) else this
0 Answers
Related