PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

DropDown crashes #117

Closed david-quadpro closed 7 years ago

david-quadpro commented 7 years ago

I am using NS 2.5.1, Angular 2.4.3 and nativescript-drop-down 3.1.0 on Telerik Platform. I have pasted the example code into my application after adding the package and installing completely new build (not just a livesync.)

When I go to the view that contains the I get the following stack trace.

`An uncaught Exception occurred on "main" thread. com.tns.NativeScriptException: Calling js method onClick failed

[object Object] File: "file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/rxjs/Subscriber.js, line: 227, column: 12

StackTrace: Frame: function:'SafeSubscriber.__tryOrUnsub', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/rxjs/Subscriber.js', line: 227, column: 13 Frame: function:'SafeSubscriber.next', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/rxjs/Subscriber.js', line: 172, column: 22 Frame: function:'Subscriber._next', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/rxjs/Subscriber.js', line: 125, column: 26 Frame: function:'Subscriber.next', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/rxjs/Subscriber.js', line: 89, column: 18 Frame: function:'Subject.next', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/rxjs/Subject.js', line: 55, column: 25 Frame: function:'EventEmitter.emit', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/@angular/core/bundles/core.umd.js', line: 4090, column: 80 Frame: function:'NgZone.checkStable', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/@angular/core/bundles/core.umd.js', line: 4356, column: 44 Frame: function:'NgZone.onLeave', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/@angular/core/bundles/core.umd.js', line: 4432, column: 18 Frame: function:'onInvoke', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/@angular/core/bundles/core.umd.js', line: 4394, column: 31 Frame: function:'ZoneDelegate.invoke', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 189, column: 34 Frame: function:'Zone.run', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js', line: 83, column: 43 Frame: function:'NgZone.run', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/@angular/core/bundles/core.umd.js', line: 4260, column: 66 Frame: function:'zonedCallback', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/nativescript-angular/renderer.js', line: 212, column: 24 Frame: function:'Observable.notify', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 149, column: 23 Frame: function:'Observable._emit', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 168, column: 18 Frame: function:'onClick', file:'file:///data/data/com.quadpro.qplusrequest/files/app/tns_modules/tns-core-modules/ui/button/button.js', line: 35, column: 32

at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1197)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1061)
at com.tns.Runtime.callJSMethod(Runtime.java:1047)
at com.tns.Runtime.callJSMethod(Runtime.java:1028)
at com.tns.Runtime.callJSMethod(Runtime.java:1018)
at com.tns.gen.android.view.View_OnClickListener.onClick(android.view.View$OnClickListener.java)
at android.view.View.performClick(View.java:5623)
at android.view.View$PerformClick.run(View.java:22433)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6311)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)`
PeterStaev commented 7 years ago

Hey @david-quadpro , you cant use DropDown 3.1 with TNS 2.5+. Newer versions support only TNS3+. So you have to either upgrade your project, or use DropDown version 1.5

david-quadpro commented 7 years ago

Hi @PeterStaev,

Thanks I will try with 1.5.5 and hopefully that will resolve it.

To confirm, do I need to use registerElement("DropDown", () => require("nativescript-drop-down/drop-down").DropDown);

rather than

import { DropDownModule } from “nativescript-drop-down/angular”;

PeterStaev commented 7 years ago

That is correct. You can take a look at https://github.com/PeterStaev/NativeScript-Drop-Down/tree/modules25 where the old version of the plugin reside together with how to integrate it in Angular.

david-quadpro commented 7 years ago

Thanks. I have it working :)