0

I am using HorizontalPager from the Accompanist package and I would like to disable/remove the edge animation. Is it possible?

I am building an infinite scroller with just 5 pages. And it is possible to scroll to the first or to the last page before my app recreates the set of pages. The pager uses an animation to notify that an edge page is reached. I would like to disable that animation.

Bobrovsky
  • 13,789
  • 19
  • 80
  • 130
  • 1
    This will also work for HorizontalPager. https://stackoverflow.com/questions/69468212/remove-lazycolumn-overscroll-effect-in-jetpack-compose – Lucas.K Jul 14 '22 at 12:57

1 Answers1

1

You can wrap the HorizontalPager like this to remove the animation:

CompositionLocalProvider(
                    LocalOverScrollConfiguration provides null
                ) {
                    HorizontalPager(count = 10) { page ->
                        // Our page content
                        Text(
                            text = "Page: $page",
                            modifier = Modifier.fillMaxWidth()
                        )
                    }
                }

source: Remove LazyColumn overscroll effect in Jetpack Compose

Lucas.K
  • 574
  • 3
  • 12