[Pager] When rememberSaveable has input, the width of the item will change currentPage.
Description I have a pointer variable and I want to recreate the PagerState when it changes, like this:
val state = rememberSaveable(pointer, saver = PagerState.Saver) { PagerState() }
HorizontalPager(
count = 10,
modifier = Modifier.fillMaxSize(),
state = state,
) {
Text(text = "Chapter is empty")
}
When the width of the HorizontalPager's content is sufficient, everything works fine. But if the width is small, like this:
Text(text = "Chapter is")
Every time the pointer changes, it will trigger three recompose, each time the currentPage is 0,2,0.
When the content is more complex, there seems to be some sort of competition between the last two compose, causing the page to jump to the third page incorrectly.
Additional context composeVersion = 1.3.0-alpha01 accompanistVersion = 0.24.13-rc
What do you mean by "content is sufficient"? Is there a chance you can try to come up with a sample fully reproducing the issue you described?
Here is a sample: https://github.com/FishHawk/accompanist-issue-1249
Toggle the pager size and see how the currentPage changes.
Like this: https://user-images.githubusercontent.com/46566858/180692942-624ead0c-fe1b-4114-85b9-c2b5525c3de7.mp4
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.