Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 37d1e73

Browse files
author
amoreno
committed
refs #51397 Added parameters to UIDocumentInteractionController
refs #51397 Added parameters to UIDocumentInteractionController refs #51397 Added parameters to UIDocumentInteractionController refs #51397 Added parameters to UIDocumentInteractionController
1 parent 4c133d6 commit 37d1e73

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

ios.js

+38-11
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@ import {
66
NativeModules,
77
DeviceEventEmitter,
88
Platform,
9-
NativeAppEventEmitter,
9+
NativeAppEventEmitter
1010
} from 'react-native'
1111

12-
const RNFetchBlob:RNFetchBlobNative = NativeModules.RNFetchBlob
12+
const RNFetchBlob: RNFetchBlobNative = NativeModules.RNFetchBlob
1313

1414
/**
1515
* Open a file using UIDocumentInteractionController
1616
* @param {string]} path Path of the file to be open.
1717
* @param {string} scheme URI scheme that needs to support, optional
1818
* @return {Promise}
1919
*/
20-
function previewDocument(path:string, scheme:string) {
21-
if(Platform.OS === 'ios')
20+
function previewDocument(path: string, scheme: string) {
21+
if (Platform.OS === 'ios') {
2222
return RNFetchBlob.previewDocument('file://' + path, scheme)
23-
else
23+
} else {
2424
return Promise.reject('RNFetchBlob.openDocument only supports IOS.')
25+
}
2526
}
2627

2728
/**
@@ -31,11 +32,37 @@ function previewDocument(path:string, scheme:string) {
3132
* @param {string} name The name of the target file, optional
3233
* @return {Promise}
3334
*/
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') {
3637
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+
}
3966
}
4067

4168
/**
@@ -44,8 +71,8 @@ function openDocument(path:string, scheme:string, name: string) {
4471
* @param {string} url URL of the resource, only file URL is supported
4572
* @return {Promise}
4673
*/
47-
function excludeFromBackupKey(url:string) {
48-
return RNFetchBlob.excludeFromBackupKey('file://' + path);
74+
function excludeFromBackupKey(url: string) {
75+
return RNFetchBlob.excludeFromBackupKey('file://' + path)
4976
}
5077

5178
export default {

0 commit comments

Comments
 (0)