Swipe to reveal or perform an action. Try interactive Storybook demo.
npm install react-swipe-action
import { SwipeAction } from 'react-swipe-action'
import 'react-swipe-action/dist/index.css'
const App = () => {
return (
<SwipeAction
main={(handle) => <button onClick={() => { alert('Click') }} style={{ position: 'relative' }}>
Button
{handle}
</button>}
endAction={{
content: (
<button
type="button"
onClick={() => { alert('Right action') }}
>
Right action
</button>
),
onLongSwipe: () => { alert('Right action') },
background: <div style={{ backgroundColor: 'red' }} />,
}}
/>
)
}