S
S
Stalder2017-09-19 12:01:53
React
Stalder, 2017-09-19 12:01:53

React Native. How to do fine-tuning in ScrollView?

There is a ScrollView with elements in it. There is some pointer in the interface that "shows" the selected value in the sheet. It is necessary to make sure that at the end of the scrolling by the user, the sheet is aligned so that the value closest to the pointer becomes opposite it.
The movement itself can be implemented through scrollTo (), and it's not a problem to calculate the coordinate either. It's not very clear when to call it. There are properties onMomentumScrollEnd and onScrollDragEnd (you can find out from him through velocity whether the movement stopped at the moment when the finger was removed). But if you just shove the alignment method there, then when scrolling with several touches, anomalies occur, and the scroll may not be to the expected object. Maybe there is another normal way, but I write a curved bike?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question