I have an issue with UIDocumentInteractionController which is used to open a PDF document.
The problem at this point is when user interacts with the menu my clicking on the Open in {app_name} action, the menu itself fails to close after user interaction leaving the menu open when user comes back to the app.
Dismissing the menu at this point requires user to tap twice on the X in order for menu to be dismissed.
I also tried to close the menu dynamically when app returns to active state by running dismissMenuAnimated on UIDocumentInteractionController instance but it does not work in this case, it does however dismiss the dialog if no interaction was made on it and the method is called.
One note, this issue is only present on never iOS version 13+. On older OS the menu is closed after interaction as expected.
We tried using this code other than all react-native stuff we tried:
@property (nonatomic, strong) UIDocumentInteractionController *documentInteractionController;@property (atomic) CGRect rect;RCT_EXPORT_METHOD(openDocumentInteractionControllerWithFileURL:(NSURL *)fileURL){ if (!fileURL) { // Return NO because there was no valid fileURL. return; } UIViewController *rootCtrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; // Open "Open in"-menu self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL]; self.documentInteractionController.delegate = self; BOOL sucess; // Sucess is true if it was possible to open the controller and there are apps available sucess = [self.documentInteractionController presentOpenInMenuFromRect:self.rect inView:rootCtrl.view animated:YES]; if(!sucess){ // Inform app that the activity has finished // Return NO because the service was canceled and did not finish because of an error. // http://developer.apple.com/library/ios/#documentation/uikit/reference/UIActivity_Class/Reference/Reference.html }}RCT_EXPORT_METHOD(dismissDocumentInteractionController){ // Hide menu [self.documentInteractionController dismissMenuAnimated:YES];}
But without success.