Skip to content

Commit 1930ee9

Browse files
committed
Update flow
1 parent e3e1337 commit 1930ee9

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const React = require('react');
55
const ReactDOM = require('react-dom');
66

77
function enhanceWithClickOutside(Component: React.ComponentType<*>) {
8-
const componentName = Component.displayName || Component.name;
8+
const componentName =
9+
Component.displayName || Component.name || 'WrappedComponent';
910

1011
class EnhancedComponent extends React.Component<*> {
1112
__domNode: *;
@@ -27,12 +28,13 @@ function enhanceWithClickOutside(Component: React.ComponentType<*>) {
2728

2829
handleClickOutside(e) {
2930
const domNode = this.__domNode;
31+
const wrappedInstance: any = this.__wrappedInstance;
3032
if (
3133
(!domNode || !domNode.contains(e.target)) &&
32-
this.__wrappedInstance &&
33-
typeof this.__wrappedInstance.handleClickOutside === 'function'
34+
wrappedInstance &&
35+
typeof wrappedInstance.handleClickOutside === 'function'
3436
) {
35-
this.__wrappedInstance.handleClickOutside(e);
37+
wrappedInstance.handleClickOutside(e);
3638
}
3739
}
3840

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"enzyme-adapter-react-16": "1.0.0",
4242
"eslint": "4.8.0",
4343
"eslint-config-kentor": "5.1.0",
44-
"flow-bin": "0.65.0",
44+
"flow-bin": "^0.98.1",
4545
"jest": "21.2.1",
4646
"react": "16.0.0",
4747
"react-dom": "16.0.0",

yarn.lock

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,9 +2370,10 @@ flat-cache@^1.2.1:
23702370
graceful-fs "^4.1.2"
23712371
write "^0.2.1"
23722372

2373-
flow-bin@0.65.0:
2374-
version "0.65.0"
2375-
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.65.0.tgz#64ffeca27211c786e2d68508c65686ba1b8a2169"
2373+
flow-bin@^0.98.1:
2374+
version "0.98.1"
2375+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.98.1.tgz#a8d781621c91703df69928acc83c9777e2fcbb49"
2376+
integrity sha512-y1YzQgbFUX4EG6h2EO8PhyJeS0VxNgER8XsTwU8IXw4KozfneSmGVgw8y3TwAOza7rVhTlHEoli1xNuNW1rhPw==
23762377

23772378
for-in@^1.0.1:
23782379
version "1.0.2"

0 commit comments

Comments
 (0)