|
@@ -8,9 +8,9 @@ const neverEndingPromise = new Promise(() => {});
|
8
|
8
|
type Options = {
|
9
|
9
|
width?: number,
|
10
|
10
|
height?: number,
|
11
|
|
- format: "png" | "jpg" | "webm",
|
|
11
|
+ format: "png" | "jpg" | "webm" | "raw",
|
12
|
12
|
quality: number,
|
13
|
|
- result: "tmpfile" | "base64" | "data-uri",
|
|
13
|
+ result: "tmpfile" | "base64" | "data-uri" | "zip-base64",
|
14
|
14
|
snapshotContentContainer: boolean
|
15
|
15
|
};
|
16
|
16
|
|
|
@@ -21,10 +21,12 @@ if (!RNViewShot) {
|
21
|
21
|
}
|
22
|
22
|
|
23
|
23
|
const acceptedFormats = ["png", "jpg"].concat(
|
24
|
|
- Platform.OS === "android" ? ["webm"] : []
|
|
24
|
+ Platform.OS === "android" ? ["webm", "raw"] : []
|
25
|
25
|
);
|
26
|
26
|
|
27
|
|
-const acceptedResults = ["tmpfile", "base64", "data-uri"];
|
|
27
|
+const acceptedResults = ["tmpfile", "base64", "data-uri"].concat(
|
|
28
|
+ Platform.OS === "android" ? ["zip-base64"] : []
|
|
29
|
+);
|
28
|
30
|
|
29
|
31
|
const defaultOptions = {
|
30
|
32
|
format: "png",
|
|
@@ -70,13 +72,13 @@ function validateOptions(
|
70
|
72
|
if (acceptedFormats.indexOf(options.format) === -1) {
|
71
|
73
|
options.format = defaultOptions.format;
|
72
|
74
|
errors.push(
|
73
|
|
- "option format is not in valid formats: " + acceptedFormats.join(" | ")
|
|
75
|
+ "option format '" + options.format + "' is not in valid formats: " + acceptedFormats.join(" | ")
|
74
|
76
|
);
|
75
|
77
|
}
|
76
|
78
|
if (acceptedResults.indexOf(options.result) === -1) {
|
77
|
79
|
options.result = defaultOptions.result;
|
78
|
80
|
errors.push(
|
79
|
|
- "option result is not in valid formats: " + acceptedResults.join(" | ")
|
|
81
|
+ "option result '" + options.result + "' is not in valid formats: " + acceptedResults.join(" | ")
|
80
|
82
|
);
|
81
|
83
|
}
|
82
|
84
|
return { options, errors };
|