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

RulerPicker can't handle negative values properly #8

Open
carloteran19 opened this issue Oct 21, 2024 · 0 comments
Open

RulerPicker can't handle negative values properly #8

carloteran19 opened this issue Oct 21, 2024 · 0 comments

Comments

@carloteran19
Copy link

carloteran19 commented Oct 21, 2024

Hello,

First of all, thank you very much for your work on RulerPicker. It has provided a ton of value to us.

Problem Description:
The RulerPicker component does not handle negative values correctly. When using a range that includes negative numbers, the component resets to the initial value after reaching a certain positive value, instead of continuing to the maximum value.

Expected Behavior:
The RulerPicker should smoothly scroll through the entire specified range, including negative values, without resetting or jumping to unexpected values.

Steps to Reproduce:

  1. Set up a React Native project with the RulerPicker component.
  2. Implement the RulerPicker with the following props:
<RulerPicker
  min={-50}
  max={150}
  step={1}
  fractionDigits={0}
  initialValue={50}
  onValueChange={(number) => console.log(number)}
  unit="°F"
  height={200}
/>
  1. Run the application and interact with the RulerPicker.
  2. Scroll the picker from the initial value (50°F) towards higher values.
  3. Observe that after reaching approximately 113°F, the picker resets back to the initial value (50°F) instead of continuing to 150°F.

Additional Information:

  • The issue appears to be related to how the component calculates values, particularly when the range includes negative numbers.
  • The problem likely stems from the calculateCurrentValue function in the utils file, which may not account for ranges with negative values correctly.
Issue.Ruler.Picker.mov
@carloteran19 carloteran19 changed the title Value sets back to Initial Value after first scroll RulerPicker can't handle negative values properly Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant