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?

Alessandro Annini
  • 1,531
  • 2
  • 17
  • 32
  • Did you found a solution for this? – Yogesh Lolusare Dec 18 '17 at 06:42
  • 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. – Douglas Schmidt Jul 13 '18 at 14:15
  • I'm also having this same problem, as e.g. on Oculus a scrollable element with clickable elements inside prefers to always scroll. – mtkopone Oct 25 '18 at 11:52

1 Answers1

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.

Nerdragen
  • 2,976
  • 2
  • 11
  • 22