NumberPicker
NumberPicker copied to clipboard
The wheel keeps on scrolling
https://user-images.githubusercontent.com/24404413/108030469-4d849e00-7055-11eb-9cf5-fd664c6437f9.mp4
The number is reset on unchecking the checkbox. Then some time this happens on reset. What is the best way to reset the number picker?
I'm using this control with np_wrapSelectorWheel set to false so I didn't see the same behaviour as you, but I saw a problem which may have the same cause. My problem sometimes occurred when using setValue. Thought I'd post my workaround in case it helps.
So it looks like in the computeScroll() function, it's possible for line 1236 scrollBy(currentScrollerX - mPreviousScrollerX, 0); to be called with the result of currentScollerX - mPreviousScrollerX being something similar to the minimum value of int (-2147483648). This results in the code entering while (mCurrentScrollOffset - mInitialScrollOffset < -gap) { at line 1333 and continue to loop around for a very long time.
I don't know much about the library but I get the impression that the problem may related to mPreviousScrollerX not being reset correctly.
My workaround was to call smoothScroll(false, 0) immediately after using setValue. I used smoothScroll because there is a line in there that sets mPreviousScrollerX to 0.
same issue exist after smoothscroll