react-native-mail
react-native-mail copied to clipboard
MFMailComposeViewController is not dismissing after tap cancel or send button
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];