diff --git a/ios/RNFileViewerManager.m b/ios/RNFileViewerManager.m index 8149cac..bff6b37 100644 --- a/ios/RNFileViewerManager.m +++ b/ios/RNFileViewerManager.m @@ -118,9 +118,13 @@ - (void)previewControllerDidDismiss:(CustomQLViewController *)controller { controller.delegate = self; typeof(self) __weak weakSelf = self; - [[RNFileViewer topViewController] presentViewController:controller animated:YES completion:^{ - [weakSelf sendEventWithName:OPEN_EVENT body: @{@"id": invocationId}]; - }]; + if([QLPreviewController canPreviewItem:file]) { + [[RNFileViewer topViewController] presentViewController:controller animated:YES completion:^{ + [weakSelf sendEventWithName:OPEN_EVENT body: @{@"id": invocationId}]; + }]; + } else { + [weakSelf sendEventWithName:OPEN_EVENT body: @{@"id": invocationId, @"error": @"File not supported"}]; + } } @end