I'm having an issue (an exception) when I navigate to another page after using the nativescript-contacts plugin. The app is built using the tns-template-drawer-navigation-ts template. Everything works fine until I access the phone's contacts and return, and then try to switch to another page using the drawer navigation. The problem is that the Frame stack is empty after I return from the Contacts screen and the topmost().navigate function calls into Frame and, since the Frame stack is empty (array length = 0), "undefined" is returned. Below are relevant sections of the code from the Chrome Debugger. Is this a core, plugin bug or am I supposed to be pushing a frame on the stack before or after I call getContact.
I've updated to tns 5.3.1, updated tns and tried to solve the problem in my own code but the code is failing in core nativescript.
My Code:
export function onGetContact(args: EventData) {
Permissions.requestPermissions([android.Manifest.permission.GET_ACCOUNTS,
android.Manifest.permission.READ_CONTACTS,],
"Permission to access your contacts is requested")
.then(() => {
Contacts.getContact()
.then((args: GetContactResult) => {
/// Returns args:
/// args.reponse: "fetch"
/// args.data: Generic cross platform JSON object, null if no contacts were found.
logContact(args);
storeContact(args.data);
}, function (err) {
console.log("Error: " + err);
})
});
}
The contact is returned fine and the current page works. The issue occurs when I try to navigate away from the current page using a drawer tap which should take me to one of my other pages. So it seems the "Contact" display is clearing the frame array (frame stack).