This repository was archived by the owner on Mar 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,12 @@ function previewDocument(path:string, scheme:string) {
28
28
* Preview a file using UIDocumentInteractionController
29
29
* @param {string] } path Path of the file to be open.
30
30
* @param {string } scheme URI scheme that needs to support, optional
31
+ * @param {string } name The name of the target file, optional
31
32
* @return {Promise }
32
33
*/
33
- function openDocument ( path :string , scheme :string ) {
34
+ function openDocument ( path :string , scheme :string , name : string ) {
34
35
if ( Platform . OS === 'ios' )
35
- return RNFetchBlob . openDocument ( 'file://' + path , scheme )
36
+ return RNFetchBlob . openDocument ( 'file://' + path , scheme , name )
36
37
else
37
38
return Promise . reject ( 'RNFetchBlob.previewDocument only supports IOS.' )
38
39
}
Original file line number Diff line number Diff line change @@ -536,13 +536,14 @@ - (NSDictionary *)constantsToExport
536
536
537
537
# pragma mark - open file with UIDocumentInteractionController and delegate
538
538
539
- RCT_EXPORT_METHOD (openDocument:(NSString *)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
539
+ RCT_EXPORT_METHOD (openDocument:(NSString *)uri scheme:(NSString *)scheme name:( NSString *)name resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
540
540
{
541
541
NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
542
542
NSURL * url = [[NSURL alloc ] initWithString: utf8uri];
543
543
// NSURL * url = [[NSURL alloc] initWithString:uri];
544
544
documentController = [UIDocumentInteractionController interactionControllerWithURL: url];
545
545
documentController.delegate = self;
546
+ documentController.name = name;
546
547
547
548
if (scheme == nil || [[UIApplication sharedApplication ] canOpenURL: [NSURL URLWithString: scheme]]) {
548
549
dispatch_sync (dispatch_get_main_queue (), ^{
You can’t perform that action at this time.
0 commit comments