-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
iOS Slider Discrete Values Issue #394
Comments
@dangrima90 could you create a PR? |
@farfromrefug sure I'll give it a go :) |
@farfromrefug here's the PR #395 As mentioned in the PR description unfortunately I didn't manage to get the demos working on my machine, however I tested the same code in my local project and it's working fine. |
@farfromrefug @dangrima90 I see this issue is still open and after using the slider with the most up-to-date version I'm not sure if the PR #395 that was merged resolves everything. I've created a demo repo that uses Nativescript Angular(I'd imagine it's the same issue with any flavor) to reproduce the issue: https://github.com/brianrclow/slider-initial-value-issue The issue is the numberOfDiscreteValues being 1 more than expected for some min/max values does not set the initial "dot" in the correct spot on the slider. In my demo repo, I show this issue with 2 sliders. Slider 1 Outcome: slider initial dot position is in the middle at the "50" tic mark position. Slider 2 Outcome: slider initial dot position is in the middle at the "60" tic mark position not where I would expect it to be at the "50" tic mark position, 1 to the left, off center. I'm not entirely sure how to best solve this as it seems removing the "+1" that was added in the PR solves it. Taking Interested in your thoughts and if you've come to a similar understanding. Thanks. |
Here is a video of it in an app I'm working on: https://www.youtube.com/shorts/rxUXB-EbOec |
@brianrclow i try to take a look at it. I hope it is not a native bug cause the lib is not maintained anymore :s |
@farfromrefug I don't think it a native bug but I am not 100% sure. I imagine it's just a math error in calculating the number of ticks which effects where the initial value position is at. |
I think I've found a bug with how the
numberOfDiscreteValues
is being calculated for iOS. I'm currently using@nativescript-community/[email protected]
I have the following example:
Min Value: 1000
Max Value: 10000
Step Size: 1000
When debugging I've noticed that
numberOfDiscreteValues
is being to set to 9 instead of 10. This is resulting in a continuous slider rather than a discrete one. From what I'm seeing the calculation is a difference of max and min, rather than the number of values.Here the calculation:
ui-material-components/src/slider/slider.ios.ts
Lines 71 to 76 in f889849
ui-material-components/src/slider/slider.ios.ts
Lines 80 to 88 in f889849
With the above logic the
numberOfDiscreteValues
is one less than the correct value.I'm not blocked with the issue as I'm setting the
numberOfDiscreteValues
myself. I'm using NativeScript-Vue, here's a sample logic that is working for me:The text was updated successfully, but these errors were encountered: