nativescript-menu icon indicating copy to clipboard operation
nativescript-menu copied to clipboard

Cannot marshal JavaScript argument [object Object] at index 1 to Java type

Open justintoth opened this issue 5 years ago • 0 comments

This module works great on iOS, however on NativeScript Android it gives an error:

JS: ERROR {
JS:   "originalStack": "Error: Uncaught (in promise): Error: Cannot marshal JavaScript argument [object Object] at index 1 to Java type.\nError: Cannot marshal JavaScript argument [object Object] at index 1 to Java type.\n    at file:///data/data/com.tothsolutions.housters/files/app/vendor.js:156936:35\n    at new ZoneAwarePromise (file:///data/data/com.tothsolutions.housters/files/app/vendor.js:144483:29)\n    at Function.push.../node_modules/nativescript-menu/menu.js.Menu.popup (file:///data/data/com.tothsolutions.housters/files/app/vendor.js:156934:16)\n    at DashboardComponent.showHelp (file:///data/data/com.tothsolutions.housters/files/app/bundle.js:

Which platform(s) does your issue occur on?

  • Samsung Galaxy S10
  • Android 10
  • Genymotion Emulator

Please, provide the following version numbers that your issue occurs with:

  • CLI: (run tns --version to fetch it) 7.1.2

Please, tell us how to recreate the issue in as much detail as possible.

Click an action bar link that then calls this plugin to open a dialog. Notice the error in the console log. I'm not sure if it has anything to do with the fact that I'm using NativeScript + Angular, but if it were that then why does it work on iOS?

Is there any code involved?

<ActionBar title="Properties">
    <ActionItem #helpLink (tap)="showHelp()"
        ios.systemIcon="11" ios.position="right"
        android.systemIcon="ic_menu_help" android.position="actionBar"></ActionItem>
</ActionBar>

 @ViewChild('helpLink') helpLink: ElementRef;

public showHelp() {
        Menu.popup({
            title: 'Help Topics',
            view: this.helpLink.nativeElement,
            actions: [
               { title: 'Property Mortgages', url: 'http://help.housters.com/property-mortgages/' },
               { title: 'Property Projections', url: 'http://help.housters.com/property-projections/' },
            ]
          })
            .then(action => {
                this.deviceService.openUrl(action.url);
            });
    }

justintoth avatar Feb 13 '21 14:02 justintoth