react-click-outside icon indicating copy to clipboard operation
react-click-outside copied to clipboard

Introduce useClickOutside hook

Open honzabrecka opened this issue 6 years ago • 4 comments

Related to #46

honzabrecka avatar May 28 '19 16:05 honzabrecka

lgtm

hlolli avatar Jun 18 '19 01:06 hlolli

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 avatar Jun 18 '19 01:06 hlolli

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 | 

hlolli avatar Jun 18 '19 01:06 hlolli

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

studnik18 avatar Jul 26 '19 15:07 studnik18