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.
yarn add react-native-swipe-gesture-handler
import { SwipeGesture } from "react-native-swipe-gesture-handler";
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');
}
}
}
<SwipeGesture
onSwipePerformed={onSwipePerformed}
>
<View>
Your View Component
</View>
</SwipeGesture>