Closed FBorgonjen closed 5 years ago
Interesting find. Try playing around with this line in node_modules/nativescript-email.. perhaps you can find a way to fix it:
Thanks for your quick response. I will fiddle with this piece of code and post my findings here
It's not the default behavior of an iOS app to call the mail composer from a modal view. A workaround is to dismiss the modal view after tapping on the mail button and in the closeCallback() you can now open the mail composer.
Fixed in version 1.5.4
This only works when the modal was opened using the topmost() frame as parent. If it was opened differently it will fail. For example we open a Modal based on an event in our AppComponent
const options: ModalDialogOptions = {
context: { config },
fullscreen: true,
viewContainerRef: this._vcRef, // ViewContainerRef injected into AppComponent
target: topmost() // this needs to be added otherwise it doesn't work
};
this._modalService.showModal(MyModalComponent, options);
When trying to open the email window from within a modal window we are getting an error and no email window. Our app is using a
TabView
as bootstrap component. From the tabview component a modal is opened showing a login page. From this page we have a button which calls theemail.compose
method. The error we get is:Warning: Attempt to present <MFMailComposeViewController: 0x103cfc400> on <UITabBarControllerImpl: 0x103caac00> whose view is not in the window hierarchy!
It looks like there is a clash betwee the window that opens the login-modal and the email-window.
If we call the exact same code from outside a modal window (inside one of the tabview pages) the code works as expected.
We are on: