Hey everyone. I have a HorizontalPager where each ...
# compose
d
Hey everyone. I have a HorizontalPager where each page contains a screen of my app. I am using the following setup (see thread) to show the screens when the Pager is at each index. But whenever I swipe to a screen that has already been opened before, it recomposes and I don't know how to make it not recompose.
Copy code
HorizontalPager(
state = pagerState,
) { page ->
        when (page) {
            0 -> {
                // ...
            }

            1 -> {
                // ...
            }

            2 -> {
                // ...
            }
        }
}
This is a performance optimization that pagers make by default. To change its behavior, increase
beyondBoundsPageCount
in your HorizontalPager to be greater than 0.
d
That was it, thank you
🙌 1