Bobrovsky
Bobrovsky

Reputation: 14246

Remove edge animation in HorizontalPager

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.

Upvotes: 0

Views: 1623

Answers (1)

Lucas.K
Lucas.K

Reputation: 614

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

Upvotes: 1

Related Questions