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

Introduce useClickOutside hook #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

honzabrecka
Copy link

@honzabrecka honzabrecka commented May 28, 2019

Related to #46

@hlolli
Copy link

hlolli commented Jun 18, 2019

lgtm

@hlolli
Copy link

hlolli commented Jun 18, 2019

Tough, when I test your pr with typescript, then I see that this looks suspicious

enhanceWithClickOutside.useClickOutside = useClickOutside;

module.exports = enhanceWithClickOutside;

writing a key of a function doesn't seem to work. Shouldn't it be an object? Otherwise supporting es6 export/import operators would make more sense when looking to export more than 1 function from a file.

@hlolli
Copy link

hlolli commented Jun 18, 2019

Also this function seems to get complaints from typescript when I copy it over (can still probably be ignored since this isn't typescript)

Object is possibly 'null'.  TS2531

    16 |         () => {
    17 |             const onClick = (e: Event) => {
  > 18 |                 if ((!domNode || !domNode.contains(e.target)) && onClickOutside)
       |                                   ^
    19 |                     onClickOutside(e);
    20 |             };
    21 | 

@studnik18
Copy link

Hi folks,
What is the current status ? It would be extremely handy.

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

Successfully merging this pull request may close these issues.

None yet

3 participants