react-native-swipe-gesture-handler
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

react-native-swipe-gesture-handler

This is a simple react native geture handler package which will save you tons of hours to detect the gesture handle for swiping on your phone.

How to install

yarn add react-native-swipe-gesture-handler

Import

import { SwipeGesture } from "react-native-swipe-gesture-handler";

Define a handler Function

    const onSwipePerformed = (action) => {
      
      switch(action){
        case 'left':{
          console.log('left Swipe performed'); 
          break;
        }
         case 'right':{ 
          console.log('right Swipe performed');
          break;
        }
         case 'up':{ 
          console.log('up Swipe performed'); 
          break;
        }
         case 'down':{ 
          console.log('down Swipe performed'); 
          break;
        }
         default : {
         console.log('Undeteceted action');
         }
      }
    }

Add Swipte Gesture around your View or other component

    <SwipeGesture  
    onSwipePerformed={onSwipePerformed} 
    >
          <View>
          Your View Component
          </View>

    </SwipeGesture>

Package Sidebar

Install

npm i react-native-swipe-gesture-handler

Weekly Downloads

78

Version

1.0.6

License

MIT

Unpacked Size

15.5 kB

Total Files

8

Last publish

Collaborators

  • lonare