PeterStaev / NativeScript-Drop-Down

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

Could not load view for: DropDown.TypeError: view_1.CSSType is not a function #179

Closed francisrod01 closed 6 years ago

francisrod01 commented 6 years ago

I'm trying to use it with NS + Angular.

I follow the Angular example in the docs.

https://github.com/PeterStaev/NativeScript-Drop-Down#usage-in-angular

Please I need to know what kind of bug is it.

JS: TypeError: Could not load view for: DropDown.TypeError: view_1.CSSType is not a function
JS:     at Object.getViewClass (file:///data/data/org.nativescript.myproject/files/app/tns_modules/nativescript-angular/element-registry.js:88:15)
JS:     at ViewUtil.createView (file:///data/data/org.nativescript.myproject/files/app/tns_modules/nativescript-angular/view-util.js:201:44)
JS:     at NativeScriptRenderer.createElement (file:///data/data/org.nativescript.myproject/files/app/tns_modules/nativescript-angular/renderer.js:109:30)
JS:     at DebugRenderer2.createElement (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:15245:49)
JS:     at createElement (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:10618:27)
JS:     at createViewNodes (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:13783:61)
JS:     at callViewAction (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:14256:13)
JS:     at execComponentViewsAction (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:14165:13)
JS:     at createViewNodes (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:13850:5)
JS:     at callViewAction (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:14256:13)
JS:     at execComponentViewsAction (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:14165:13)
JS:     at createViewNodes (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:13850:5)
JS:     at createRootView (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:13711:5)
JS:     at callWithDebugContext (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:15136:42)
JS:     at Object.debugCreateRootView [as createRootView] (file:///data/data/org.nativescript.myproject/files/app/tns_modules/@angular/core/bundles/core.umd.js:14419:12)

I'm using this versions:

PeterStaev commented 6 years ago

Take a look at https://github.com/PeterStaev/NativeScript-Drop-Down/releases/tag/v4.0 first bullet πŸ˜‰

francisrod01 commented 6 years ago

I'm updated with version information. I'm already using the 4.0 version.

PeterStaev commented 6 years ago

The CSSType decorator was added with TNS 4.0. So make sure you are really using TNS 4.0. Please post the output of tns info when you run it inside your project.

francisrod01 commented 6 years ago

So, this is my nativescript dependency inside my project, again:

tns info
βœ” Getting NativeScript components versions information...
⚠ Update available for component nativescript. Your current version is 4.0.1 and the latest available version is 4.0.2.
⚠ Update available for component tns-core-modules. Your current version is 3.4.1 and the latest available version is 4.0.1.
βœ” Component tns-android has 4.0.1 version and is up to date.
βœ– Component tns-ios is not installed.
PeterStaev commented 6 years ago

And there is your problem - your tns-core-modules are still at 3.4.1. You need to update those as well.

francisrod01 commented 6 years ago

Thank you! It's solved it! :+1: :1st_place_medal:

Peraluna commented 6 years ago

Can we use the dropdown in nativescript Vue ? I tried the following πŸ‘Ž im main.js :

Vue.registerElement('DropDown', () => require('nativescript-drop-down').DropDown)

in vue component : <DropDown ref="ddSalut" backgroundColor="primary" @items="saluts" @selectedIndexChanged="onSalutChanged(event)" @opened="onSalutOpen" @closed="onSalutClosed"

and got error :

JS: '{NSVue (Vue: 2.5.13 | NSVue: 1.3.1)} -> CreateElement(DropDown)' JS: [Vue warn]: Error in nextTick: "TypeError: Could not load view for: dropdown. TypeError: view_1.CSSType is not a function"

rahulreddytillu commented 3 years ago

Thank you! It's solved it! πŸ‘ πŸ₯‡

I've updated tns-core-modules, but still getting TypeError Below is the error log System.err: An uncaught Exception occurred on "main" thread. System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Object(...) is not a function System.err: File: (file: node_modules\nativescript-drop-down\drop-down-common.js:23:11) System.err: System.err: StackTrace: System.err: ../node_modules/nativescript-drop-down/drop-down-common.js(file: node_modules\nativescript-drop-down\drop-down-common.js:23:11)
System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-drop-down\drop-down.android.js:1:0) System.err: at ../node_modules/nativescript-drop-down/drop-down.js(file:///data/data/org.nativescript.LoginPage/files/app/vendor.js:147150:30) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at ../node_modules/nativescript-drop-down/angular/fesm2015/nativescript-drop-down-angular.js(file: node_modules\nativescript-drop-down\angular\fesm2015\nativescript-drop-down-angular.js:1:0) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at ./app/app.module.ts(file: src\app\app.module.ts:1:0) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at (file:///data/data/org.nativescript.LoginPage/files/app/bundle.js:476:73) System.err: at ./main.ts(file:///data/data/org.nativescript.LoginPage/files/app/bundle.js:535:30) System.err: at webpack_require__(file: src\webpack\bootstrap:750:0) System.err: at checkDeferredModules(file: src\webpack\bootstrap:43:0) System.err: at webpackJsonpCallback(file: src\webpack\bootstrap:30:0) System.err: at (file:///data/data/org.nativescript.LoginPage/files/app/bundle.js:2:57) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Object(...) is not a function System.err: System.err: StackTrace: System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Object(...) is not a function System.err: File: (file: node_modules\nativescript-drop-down\drop-down-common.js:23:11) System.err: System.err: StackTrace: System.err: ../node_modules/nativescript-drop-down/drop-down-common.js(file: node_modules\nativescript-drop-down\drop-down-common.js:23:11)
System.err: at
webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-drop-down\drop-down.android.js:1:0) System.err: at ../node_modules/nativescript-drop-down/drop-down.js(file:///data/data/org.nativescript.LoginPage/files/app/vendor.js:147150:30) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at ../node_modules/nativescript-drop-down/angular/fesm2015/nativescript-drop-down-angular.js(file: node_modules\nativescript-drop-down\angular\fesm2015\nativescript-drop-down-angular.js:1:0) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at ./app/app.module.ts(file: src\app\app.module.ts:1:0) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at (file:///data/data/org.nativescript.LoginPage/files/app/bundle.js:476:73) System.err: at ./main.ts(file:///data/data/org.nativescript.LoginPage/files/app/bundle.js:535:30) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at checkDeferredModules(file: src\webpack\bootstrap:43:0) System.err: at webpackJsonpCallback(file: src\webpack\bootstrap:30:0) System.err: at (file:///data/data/org.nativescript.LoginPage/files/app/bundle.js:2:57) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Object(...) is not a function System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6999) System.err: at android.app.ActivityThread.access$1500(ActivityThread.java:257) System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1982) System.err: at android.os.Handler.dispatchMessage(Handler.java:106) System.err: at android.os.Looper.loop(Looper.java:236) System.err: at android.app.ActivityThread.main(ActivityThread.java:8060) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) System.err: Caused by: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Object(...) is not a function System.err: File: (file: node_modules\nativescript-drop-down\drop-down-common.js:23:11) System.err: System.err: StackTrace: System.err: ../node_modules/nativescript-drop-down/drop-down-common.js(file: node_modules\nativescript-drop-down\drop-down-common.js:23:11)
System.err: at __webpack_require
(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-drop-down\drop-down.android.js:1:0) System.err: at ../node_modules/nativescript-drop-down/drop-down.js(file:///data/data/org.nativescript.LoginPage/files/app/vendor.js:147150:30) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at ../node_modules/nativescript-drop-down/angular/fesm2015/nativescript-drop-down-angular.js(file: node_modules\nativescript-drop-down\angular\fesm2015\nativescript-drop-down-angular.js:1:0) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at ./app/app.module.ts(file: src\app\app.module.ts:1:0) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at fn(file: src\webpack\bootstrap:120:0) System.err: at (file:///data/data/org.nativescript.LoginPage/files/app/bundle.js:476:73) System.err: at ./main.ts(file:///data/data/org.nativescript.LoginPage/files/app/bundle.js:535:30) System.err: at webpack_require(file: src\webpack\bootstrap:750:0) System.err: at checkDeferredModules(file: src\webpack\bootstrap:43:0) System.err: at webpackJsonpCallback(file: src\webpack\bootstrap:30:0) System.err: at (file:///data/data/org.nativescript.LoginPage/files/app/bundle.js:2:57) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Object(...) is not a function System.err: at com.tns.Runtime.runModule(Native Method) System.err: at com.tns.Runtime.runModule(Runtime.java:674) System.err: at com.tns.Runtime.run(Runtime.java:666) System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21) System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1193) System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6994) System.err: ... 8 more

Help me fix the issue!