@1ohooks/swipeable

The @1ohooks/swipeable
package provides hooks for handling swipe gestures in React applications.
Installation
Install the package with:
npm install @1ohooks/swipeable
yarn add @1ohooks/swipeable
Documentation
useHorizontalSwipeMinimum
The useHorizontalSwipeMinimum
hook allows you to detect horizontal swipe gestures.
import { useHorizontalSwipeMinimum } from '@1ohooks/swipeable';
function MyComponent() {
useHorizontalSwipeMinimum(50, () => {
}, () => {
});
return (
);
}
useVerticalSwipeMinimum
The useVerticalSwipeMinimum
hook allows you to detect vertical swipe gestures.
import { useVerticalSwipeMinimum } from '@1ohooks/swipeable';
function MyComponent() {
useVerticalSwipeMinimum(50, () => {
}, () => {
});
return (
);
}
useSwipe
The useSwipe
hook provides a more versatile way to handle swipe gestures with customizable options.
import { useSwipe } from '@1ohooks/swipeable';
function MyComponent() {
const { swipeDistance } = useSwipe({
threshold: 50,
onSwipeLeft: () => {
},
onSwipeRight: () => {
},
});
return (
);
}
Requirements
Usage
You can easily integrate the swipe gestures into your React components by importing and using the provided hooks.
For more advanced usage and configuration options, refer to the individual hook documentation.