Error on OutsideClick with Styled component #33
Copy link
Copy link
Open
Description
Hello,
I give a try for this : , but it show this error : Uncaught TypeError: root.contains is not a function at index.js:35 at Array.some
This is because root is equal to the element a this point, and el does not have a contains function.
Error with Wrapper = styled('div')({})
<OutsideClick onClick={() => setOpen(false)}>
<Wrapper>Works with
<OutsideClick onClick={() => setOpen(false)}>
<div>
<Wrapper>It seems that the ref is not handle correctly. I'll switch to https://github.com/streamich/react-use/blob/master/docs/useOutsideClick.md for now, but I prefer this way instead of the react-use one
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
streamich commentedon Dec 4, 2018
Hi, have not looked into this yet, but maybe @sgb-io can help