Skip to content

Commit

Permalink
Use ontouchend
Browse files Browse the repository at this point in the history
  • Loading branch information
mrseanbaines committed Jul 5, 2020
1 parent fb75bca commit 5ffe9be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hooks/use-on-click-outside.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ const useOnClickOutside = (ref: React.RefObject<any>, handler?: Handler): void =
handler?.(e)
}

document.addEventListener('click', listener)
// document.addEventListener('touchstart', listener)
document.addEventListener('mousedown', listener)
document.addEventListener('touchend', listener)

return () => {
document.removeEventListener('click', listener)
// document.removeEventListener('touchstart', listener)
document.removeEventListener('mousedown', listener)
document.removeEventListener('touchend', listener)
}
}, [ref, handler])
}
Expand Down

0 comments on commit 5ffe9be

Please sign in to comment.