Browse Source

make flow happy

Gaëtan Renaudeau 8 years ago
parent
commit
8b46f34611
2 changed files with 45 additions and 1 deletions
  1. 42
    0
      .flowconfig
  2. 3
    1
      index.js

+ 42
- 0
.flowconfig View File

1
 [ignore]
1
 [ignore]
2
 
2
 
3
+# We fork some components by platform.
4
+.*/*[.]android.js
5
+
6
+# Ignore templates with `@flow` in header
7
+.*/local-cli/generator.*
8
+
9
+# Ignore malformed json
10
+.*/node_modules/y18n/test/.*\.json
11
+
12
+# Ignore unexpected extra @providesModule
13
+.*/node_modules/commoner/test/source/widget/share.js
14
+
15
+# Ignore duplicate module providers
16
+# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root
17
+.*/Libraries/react-native/React.js
18
+.*/Libraries/react-native/ReactNative.js
19
+.*/node_modules/jest-runtime/build/__tests__/.*
20
+
3
 [include]
21
 [include]
4
 
22
 
5
 [libs]
23
 [libs]
24
+node_modules/react-native/Libraries/react-native/react-native-interface.js
25
+node_modules/react-native/flow
26
+flow/
6
 
27
 
7
 [options]
28
 [options]
29
+module.system=haste
30
+
31
+esproposal.class_static_fields=enable
32
+esproposal.class_instance_fields=enable
33
+
34
+experimental.strict_type_args=true
35
+
36
+munge_underscores=true
37
+
38
+module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
39
+module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
40
+
41
+suppress_type=$FlowIssue
42
+suppress_type=$FlowFixMe
43
+suppress_type=$FixMe
44
+
45
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
46
+suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
47
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
48
+
49
+unsafe.enable_getters_and_setters=true

+ 3
- 1
index.js View File

16
   }
16
   }
17
 ): Promise<string> {
17
 ): Promise<string> {
18
   if (typeof view !== "number") {
18
   if (typeof view !== "number") {
19
-    view = findNodeHandle(view);
19
+    const node = findNodeHandle(view);
20
+    if (!node) return Promise.reject(new Error("findNodeHandle failed to resolve view="+String(view)));
21
+    view = node;
20
   }
22
   }
21
   return RNViewShot.takeSnapshot(view, options);
23
   return RNViewShot.takeSnapshot(view, options);
22
 }
24
 }