fix keyboard progress increment getting stuck at 6 #572
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This fixes #155
see #155 (comment) for details of the issue
The gist of it, on initial load
ReactSlider
callssetMax(128)
due toDEFAULT_TOTAL_STEPS = 128
which calls the
AbsSeekBar.java
'ssetMax()
https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/widget/AbsSeekBar.java;l=586-595;drc=c8c729556d69aa27fff24e5412140563fc1527af
and internally updates
mKeyProgressIncrement
to6
that causes keyboard input to jump 6 steps:
https://android.googlesource.com/platform/frameworks/base/+/711efaa0297f845c60a1de0acce680493f90bf02/core/java/android/widget/AbsSeekBar.java#1053
after setting
ReactSlider.setMaxValue
, ifmax
is not high enough, thekeyProgressIncrement
will still get stuck at6
due to this logic in
AbsSeekBar
:https://android.googlesource.com/platform/frameworks/base/+/711efaa0297f845c60a1de0acce680493f90bf02/core/java/android/widget/AbsSeekBar.java#590
Test Plan:
Render a simple Slider
use the keyboard to navigate to the slider (tabs on android or use a virtual keyboard)
Verify that LEFT and RIGHT arrow moves the thumb according to the
step
prop