ReactNative ScrollView scroll threshold
Asked Answered
A

1

7

I am trying to understand how can I set a threshold for the RN ScrollView.

This is because if you have multiple vertical scrollable View in a horizontal ScrollView then the scrolling of the Views is very difficult.

So i just need something that holds the horizontal scrolling until the finger swipe horizontally for a certain pixel-span.

Has anyone a clue about how to archive this?

Aurochs answered 23/3, 2017 at 9:30 Comment(3)
Did you found a solution for this?Tungting
I'm also getting beaten by this. I have a webview that I want to scroll vertically inside a scrollview that scrolls horizontally. The scrollview steals the gesture in the middle of a vertical scroll on the webview. Bummer... On iOS is working great.Westbrooke
I'm also having this same problem, as e.g. on Oculus a scrollable element with clickable elements inside prefers to always scroll.Alexio
D
0

You can use the native scroll event in onScrollEnd to get the velocity of the scroll, then only scroll horizontally if it's past a certain amount. On most vertical/horizontal scrolls, most users only scroll in one direction. If you truly want to implement a distance based scroll, you would need to attach a PanResponder to your component and compare the distnaces of the Grant and Release events.

Desert answered 2/12, 2018 at 3:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.