react-native-mail icon indicating copy to clipboard operation
react-native-mail copied to clipboard

MFMailComposeViewController is not dismissing after tap cancel or send button

Open leo-ori opened this issue 3 years ago • 0 comments

Hi guys! I found an issue and actually is pretty easy to fix. I'm seeing that MFMailComposeViewControllerDelegate (in RNMail.m) is not dismissing the MFMailComposeViewController, instead of that look on the rootViewController this is causing that the MFMailComposeViewController remains on screen after tap cancel or send. I added the following line and it's working

[controller dismissViewControllerAnimated:YES completion:nil];

My question is why looking into rootViewController instead of just dismiss the controller?

UIViewController *ctrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
    while (ctrl.presentedViewController && ctrl != controller) {
        ctrl = ctrl.presentedViewController;
    }
    [ctrl dismissViewControllerAnimated:YES completion:nil];

leo-ori avatar Feb 22 '22 21:02 leo-ori