ReactNative ScrollView scroll threshold

I am trying to figure out how to set a threshold for an RN ScrollView .

This is because if you have multiple vertical scrollable views in a horizontal ScrollView, scrolling the views is very difficult.

So I just need something that keeps scrolling horizontally until the finger swipes horizontally for a specific pixel.

Does anyone know how to do this?

+7


source to share


1 answer


You can use the built-in scroll event on onScrollEnd to get the scroll speed and then scroll horizontally if it has passed a certain amount. On most vertical / horizontal scrolls, most users only scroll in one direction. If you really want to implement distance scrolling, you will need to connect PanResponder to your component and compare the distances between Grant and Release events.



0


source







All Articles