Skip to content

Introduce useClickOutside hook - #48

Open
honzabrecka wants to merge 2 commits into
kentor:masterfrom
honzabrecka:hooks
Open

Introduce useClickOutside hook#48
honzabrecka wants to merge 2 commits into
kentor:masterfrom
honzabrecka:hooks

Conversation

@honzabrecka

@honzabrecka honzabrecka commented May 28, 2019

Copy link
Copy Markdown

Related to #46

@hlolli

hlolli commented Jun 18, 2019

Copy link
Copy Markdown

lgtm

@hlolli

hlolli commented Jun 18, 2019

Copy link
Copy Markdown

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

hlolli commented Jun 18, 2019

Copy link
Copy Markdown

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
Copy Markdown

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.

3 participants