Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] App crashes if forcing RTL layout direction with WormIndicatorType #207

Open
zszekeres65 opened this issue Jan 9, 2025 · 0 comments
Labels

Comments

@zszekeres65
Copy link

🐛 Bug Report

Describe the Bug
Using the WormIndicatorType can cause a crash (IllegalArgumentException: Padding must be non-negative) if the user forces RTL layout direction.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Go to System Settings > Developer Options
  2. Enable 'Force RTL layout direction'
  3. Open a sample app that implements WormIndicatorType
  4. Sample app crashes with IllegalArgumentException

Expected Behavior
App should not crash.

Actual Behavior
App crashes.

Screenshots or Videos
N/A

Environment

  • Library version: [5.1.0]
  • Android version: [14]
  • Device: [Samsung S22]
  • ViewPager for Jetpack Compose or XML: Jetpack Compose
  • ViewPager type: ViewPager2

Additional Context
The width measurements stays LTR direction, which results a bigger value of firstDotPositionX than the lastDotPositionX. The value of distanceBetween2DotsDp will be negative and multiplying with this value cause negative paddings.
Locally, I could fix the issue by getting the current LayoutDirection and setting the firstDotPositionX and lastDotPositionX based on that's value.

@zszekeres65 zszekeres65 added the bug label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant