question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pager in 0.19.0 reporting `currentPage` as 0 which is wrong.

See original GitHub issue

Describe the bug

In some situations, this line will cause problems. For some unknown reasons, the currentLayoutPageInfo would become null and the current page is set to 0 while it was a non-zero value a couple milliseconds ago.

To Reproduce

Steps to reproduce the behavior: I’ll attach a composable file for you. What I’m doing here is syncing the pager at the top with the horizontal row at the bottom. This code works as expected on 0.18.0. But even after changing the deprecated functions and stuff, the currentPage is reported as 0 right after being the correct value. You can try scrolling the pager and see the weird selection behavior for the ThumbnailsRow.

Expected behavior

The code I attached is working as expected on 0.18.0.

Environment:

  • Android OS version: I tested on Android 12
  • Device: Emulator, Pixel 5a
  • Accompanist version: 0.19.0

Additional context

Check out the line with Log.d("Compose", "$selectedIndex"). When used in Preview, the problem may not show up. In an application, it does show up more.

ImageGalleryView.kt

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
akuchinkecommented, Oct 1, 2021

I also stumbled upon this as is completely breaks the Pager Indicator Component. One thing to note: it seem the issue only appears if you set itemSpacing to a value >0.

0reactions
andkulikovcommented, Jan 10, 2022

Has this fix been released? I’m currently using 0.20.2 version and it’'s still present there.

Please try to use the latest version (0.20.3 if you are on Compose 1.0) and file a new bug if you still see it

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Why in HorizontalPager is the page number returned ...
The HorizontalPager pre-draws a pair of adjacent pages, ... for the first page and for the second, but currentPage is 0 in both...
Read more >
Views current_page incorrect when out of range - Drupal
The current page count in views is incorrect when requesting a page that is past the page limit based on the number of...
Read more >
Usage - mkdocstrings
The identifier is a string identifying the object you want to document. The format of an identifier can vary from one handler to...
Read more >
Changelog - Cypress Documentation
Fixed a regression in 12.0.0 where .contains() received multiple elements as a ... The cy.session() command no longer clears the page between setup...
Read more >
Release Notes - FastAPI
The current page still doesn't have a translation for this language. ... Bump Starlette to version 0.22.0 to fix bad encoding for query...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found