react-native-gesture-view

A View component with swipe gestures

Usage no npm install needed!

<script type="module">
  import reactNativeGestureView from 'https://cdn.skypack.dev/react-native-gesture-view';
</script>

README

GestureView

Detects swipes in any <View> element including the swipe direction.

Usage

You should use GestureView as a normal <View> element:

render () {
  return (
    <GestureView onSwipeUp={this.onSwipeUp}>
      <Text>Swipe up for awesomeness</Text>
    </GestureView>
  )
}

Props

  • onSwipeUp an optional function that's triggered when the view detects a swipe to the up direction
  • onSwipeDown an optional function that's triggered when the view detects a swipe to the down direction
  • onSwipeLeft an optional function that's triggered when the view detects a swipe to the left direction
  • onSwipeRight an optional function that's triggered when the view detects a swipe to the right direction
  • onUnhandleSwipe an optional function that's triggered when the swipe was inside the threshold
  • swipeThreshold the amount of pixels that the swipe needs to have before being interpreted as a swipe. Defaults to 120
  • quadrantThreshold an angle that's computed into each quadrant, use it to make wider/narrowed quadrants. Defaults to 30