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) {
2828 * Preview a file using UIDocumentInteractionController
2929 * @param {string] } path Path of the file to be open.
3030 * @param {string } scheme URI scheme that needs to support, optional
31+ * @param {string } name The name of the target file, optional
3132 * @return {Promise }
3233 */
33- function openDocument ( path :string , scheme :string ) {
34+ function openDocument ( path :string , scheme :string , name : string ) {
3435 if ( Platform . OS === 'ios' )
35- return RNFetchBlob . openDocument ( 'file://' + path , scheme )
36+ return RNFetchBlob . openDocument ( 'file://' + path , scheme , name )
3637 else
3738 return Promise . reject ( 'RNFetchBlob.previewDocument only supports IOS.' )
3839}
Original file line number Diff line number Diff line change @@ -536,13 +536,14 @@ - (NSDictionary *)constantsToExport
536536
537537# pragma mark - open file with UIDocumentInteractionController and delegate
538538
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)
540540{
541541 NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
542542 NSURL * url = [[NSURL alloc ] initWithString: utf8uri];
543543 // NSURL * url = [[NSURL alloc] initWithString:uri];
544544 documentController = [UIDocumentInteractionController interactionControllerWithURL: url];
545545 documentController.delegate = self;
546+ documentController.name = name;
546547
547548 if (scheme == nil || [[UIApplication sharedApplication ] canOpenURL: [NSURL URLWithString: scheme]]) {
548549 dispatch_sync (dispatch_get_main_queue (), ^{
You can’t perform that action at this time.
0 commit comments