Skip to content

Commit 85dedef

Browse files
author
Riccardo Cipolleschi
committed
feat: Add Flow specs
1 parent f515ccc commit 85dedef

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

codegenSpecs/NativeBlobUtils.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// @flow
2+
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
3+
import { TurboModuleRegistry } from 'react-native';
4+
5+
export interface Spec extends TurboModule {
6+
+getConstants: () => {|
7+
'CacheDir': string,
8+
'DocumentDir': string,
9+
'DownloadDir': string,
10+
'LibraryDir': string,
11+
'MainBundleDir': string,
12+
'MovieDir': string,
13+
'MusicDir': string,
14+
'PictureDir': string,
15+
'ApplicationSupportDir': string,
16+
|};
17+
18+
+fetchBlobForm: (options: Object, taskId: string, method: string, url: string, headers: Object, form: Array<any>, callback: (value: Array<any>) => void) => void;
19+
+fetchBlob: (options: Object, taskId: string, method: string, url: string, headers: Object, body: string, callback: (value: Array<any>) => void) => void;
20+
+createFile: (path: string, data: string, encoding: string) => Promise<void>;
21+
+createFileASCII: (path: string, data: Array<any>) => Promise<void>;
22+
+pathForAppGroup:(groupName: string) => Promise<string>;
23+
+syncPathAppGroup:(groupName: string) => string;
24+
+exists:(path: string, callback:(value: Array<boolean>) => void) => void;
25+
+writeFile:(path: string, encoding: string, data: string, transformFile: boolean, append: boolean) => Promise<number>;
26+
+writeFileArray:(path: string, data: Array<any>, append: boolean) => Promise<number>;
27+
+writeStream:(path: string, withEncoding: string, appendData: boolean, callback: (value: Array<any>) => void) => void;
28+
+writeArrayChunk:(streamId: string, withArray: Array<any>, callback: (value: Array<any>) => void) => void;
29+
+writeChunk:(streamId: string, withData: string, callback: (value: Array<any>) => void) => void;
30+
+closeStream:(streamId: string, callback: (value: Array<any>) => void) => void;
31+
+unlink:(path: string, callback: (value: Array<any>) => void) => void;
32+
+removeSession:(paths:Array<any>, callback: (value: Array<any>) => void) => void;
33+
+ls: (path: string) => Promise<Array<any>>;
34+
+stat:(target: string, callback:(value: Array<any>) => void) => void;
35+
+lstat:(path: string, callback: (value: Array<any>) => void) => void;
36+
+cp:(src: string, dest: string, callback:(value: Array<any>) => void) => void;
37+
+mv:(path: string, dest: string, callback:(value: Array<any>) => void) => void;
38+
+mkdir:(path: string) => Promise<boolean>;
39+
+readFile:(path: string, encoding: string, transformFile: boolean) => Promise<Array<any>>;
40+
+hash:(path: string, algorithm: string) => Promise<string>;
41+
+readStream:(path: string, encoding: string, bufferSize: number, tick: number, streamId: string) => void;
42+
+getEnvironmentDirs:(callback: (value: Array<any>) => void) => void;
43+
+cancelRequest:(taskId: string, callback:(value: Array<any>) => void) => void;
44+
+enableProgressReport:(taskId: string, interval: number, count: number) => void;
45+
+enableUploadProgressReport:(taskId: string, interval: number, count: number) => void;
46+
+slice:(src: string, dest: string, start: number, end: number) => Promise<string>;
47+
+presentOptionsMenu:(uri: string, scheme: string) => Promise<Array<any>>;
48+
+presentOpenInMenu:(uri: string, scheme: string) => Promise<Array<any>>;
49+
+presentPreview:(uri: string, scheme: string) => Promise<Array<any>>;
50+
+excludeFromBackupKey:(url: string) => Promise<Array<any>>;
51+
+df:(callback: (value: Array<any>) => void) => void;
52+
+emitExpiredEvent:(callback: (value: string) => void) => void; // The callback is not really used here
53+
}
54+
55+
export default (TurboModuleRegistry.get<Spec>(
56+
'ReactNativeBlobUtil'
57+
): ?Spec);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,10 @@
4646
"peerDependencies": {
4747
"react": "*",
4848
"react-native": "*"
49+
},
50+
"codegenConfig": {
51+
"name": "ReactNativeBlobUtil",
52+
"type": "modules",
53+
"jsSrcsDir": "codegenSpecs"
4954
}
5055
}

0 commit comments

Comments
 (0)