Skip to content

Instantly share code, notes, and snippets.

@hosembafer
Last active April 25, 2019 14:25
Show Gist options
  • Save hosembafer/a3b8f4fc9895fa29335991ee55336260 to your computer and use it in GitHub Desktop.
Save hosembafer/a3b8f4fc9895fa29335991ee55336260 to your computer and use it in GitHub Desktop.
react-swipe-to-dismiss: App.js
const MessageItem = ({message, onDismiss}) => {
const ref = useRef(null);
const swipeableMessageProps = useSwipeToDismiss(ref, onDismiss, false, 100, 'right');
return <div ref={ref} className={'Message'} {...swipeableMessageProps}>
{message}
</div>;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment