diff --git a/patches/react-native-file-viewer+2.1.5.patch b/patches/react-native-file-viewer+2.1.5.patch new file mode 100644 index 000000000..92ebfa27b --- /dev/null +++ b/patches/react-native-file-viewer+2.1.5.patch @@ -0,0 +1,36 @@ +diff --git a/node_modules/react-native-file-viewer/ios/RNFileViewerManager.m b/node_modules/react-native-file-viewer/ios/RNFileViewerManager.m +index 8149cac..6ea97af 100644 +--- a/node_modules/react-native-file-viewer/ios/RNFileViewerManager.m ++++ b/node_modules/react-native-file-viewer/ios/RNFileViewerManager.m +@@ -102,6 +102,12 @@ - (void)previewControllerDidDismiss:(CustomQLViewController *)controller { + [self sendEventWithName:DISMISS_EVENT body: @{@"id": controller.invocation}]; + } + ++- (void)dismissView:(id)sender { ++ UIViewController* controller = [RNFileViewer topViewController]; ++ [self sendEventWithName:DISMISS_EVENT body: @{@"id": ((CustomQLViewController*)controller).invocation}]; ++ [[RNFileViewer topViewController] dismissViewControllerAnimated:YES completion:nil]; ++} ++ + RCT_EXPORT_MODULE() + + - (NSArray *)supportedEvents { +@@ -117,8 +123,17 @@ - (void)previewControllerDidDismiss:(CustomQLViewController *)controller { + QLPreviewController *controller = [[CustomQLViewController alloc] initWithFile:file identifier:invocationId]; + controller.delegate = self; + ++ if (@available(iOS 13.0, *)) { ++ [controller setModalInPresentation: true]; ++ } ++ ++ UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller]; ++ controller.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissView:)]; ++ controller.navigationController.navigationBar.translucent = NO; ++ controller.edgesForExtendedLayout = UIRectEdgeNone; ++ + typeof(self) __weak weakSelf = self; +- [[RNFileViewer topViewController] presentViewController:controller animated:YES completion:^{ ++ [[RNFileViewer topViewController] presentViewController:navigationController animated:YES completion:^{ + [weakSelf sendEventWithName:OPEN_EVENT body: @{@"id": invocationId}]; + }]; + }