@@ -6,22 +6,23 @@ import {
6
6
NativeModules ,
7
7
DeviceEventEmitter ,
8
8
Platform ,
9
- NativeAppEventEmitter ,
9
+ NativeAppEventEmitter
10
10
} from 'react-native'
11
11
12
- const RNFetchBlob :RNFetchBlobNative = NativeModules . RNFetchBlob
12
+ const RNFetchBlob : RNFetchBlobNative = NativeModules . RNFetchBlob
13
13
14
14
/**
15
15
* Open a file using UIDocumentInteractionController
16
16
* @param {string] } path Path of the file to be open.
17
17
* @param {string } scheme URI scheme that needs to support, optional
18
18
* @return {Promise }
19
19
*/
20
- function previewDocument ( path :string , scheme :string ) {
21
- if ( Platform . OS === 'ios' )
20
+ function previewDocument ( path : string , scheme : string ) {
21
+ if ( Platform . OS === 'ios' ) {
22
22
return RNFetchBlob . previewDocument ( 'file://' + path , scheme )
23
- else
23
+ } else {
24
24
return Promise . reject ( 'RNFetchBlob.openDocument only supports IOS.' )
25
+ }
25
26
}
26
27
27
28
/**
@@ -31,11 +32,37 @@ function previewDocument(path:string, scheme:string) {
31
32
* @param {string } name The name of the target file, optional
32
33
* @return {Promise }
33
34
*/
34
- function openDocument ( path :string , scheme :string , name : string ) {
35
- if ( Platform . OS === 'ios' )
35
+ function openDocument ( path : string , scheme : string , name : string ) {
36
+ if ( Platform . OS === 'ios' ) {
36
37
return RNFetchBlob . openDocument ( 'file://' + path , scheme , name )
37
- else
38
- return Promise . reject ( 'RNFetchBlob.previewDocument only supports IOS.' )
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Preview a file using UIDocumentInteractionController
43
+ * @param {string] } path Path of the file to be open.
44
+ * @param {string } scheme URI scheme that needs to support, optional
45
+ * @param {string } name The name of the target file, optional
46
+ * @param
47
+ * @param
48
+ * @return {Promise }
49
+ */
50
+ function openDocumentWithFont (
51
+ path : string ,
52
+ fontFamily : string ,
53
+ fontSize : number ,
54
+ hexString : string ,
55
+ scheme : string
56
+ ) {
57
+ if ( Platform . OS === 'ios' ) {
58
+ return RNFetchBlob . openDocument (
59
+ 'file://' + path ,
60
+ fontFamily ,
61
+ fontSize ,
62
+ hexString ,
63
+ scheme
64
+ )
65
+ }
39
66
}
40
67
41
68
/**
@@ -44,8 +71,8 @@ function openDocument(path:string, scheme:string, name: string) {
44
71
* @param {string } url URL of the resource, only file URL is supported
45
72
* @return {Promise }
46
73
*/
47
- function excludeFromBackupKey ( url :string ) {
48
- return RNFetchBlob . excludeFromBackupKey ( 'file://' + path ) ;
74
+ function excludeFromBackupKey ( url : string ) {
75
+ return RNFetchBlob . excludeFromBackupKey ( 'file://' + path )
49
76
}
50
77
51
78
export default {
0 commit comments