Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on OutsideClick with Styled component #33

Open
Florian-Guillot-Axa opened this issue Dec 4, 2018 · 1 comment
Open

Error on OutsideClick with Styled component #33

Florian-Guillot-Axa opened this issue Dec 4, 2018 · 1 comment

Comments

@Florian-Guillot-Axa
Copy link

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

@streamich
Copy link
Owner

Hi, have not looked into this yet, but maybe @sgb-io can help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants