ProgressNS / nativescript-ui-feedback

This repository is used for customer feedback regarding Telerik UI for NativeScript. The issues system here is used by customers who want to submit their feature requests or vote for existing ones.
Other
115 stars 21 forks source link

JS ERROR ReferenceError: Can't find variable: TKListViewDelegate #1278

Closed tahir-jamil closed 4 years ago

tahir-jamil commented 4 years ago

I am using nativescript angular shared repo and its default sample is not working i have create a new project using this docs

package.json

{
  "name": "project-name",
  "nativescript": {
    "id": "org.nativescript.projectname",
    "tns-ios": {
      "version": "6.1.1"
    }
  },
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng `test",`
    "lint": "ng lint",
    "e2e": "ng e2e",
    "android": "tns run android --bundle",
    "ios": "tns run ios --bundle"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "8.0.0",
    "@angular/common": "8.0.0",
    "@angular/compiler": "8.0.0",
    "@angular/core": "8.0.0",
    "@angular/forms": "8.0.0",
    "@angular/http": "8.0.0-beta.10",
    "@angular/platform-browser": "8.0.0",
    "@angular/platform-browser-dynamic": "8.0.0",
    "@angular/router": "8.0.0",
    "core-js": "^2.5.4",
    "nativescript-angular": "8.0.2",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-listview": "^7.1.0",
    "reflect-metadata": "~0.1.8",
    "rxjs": "^6.2.0",
    "tns-core-modules": "6.1.2",
    "zone.js": "0.9.1"
  },
  "devDependencies": {
    "@angular/cli": "^7.0.0",
    "@angular/compiler-cli": "8.0.0",
    "@angular-devkit/build-angular": "0.800.3",
    "@nativescript/schematics": "~0.3.0",
    "@types/jasmine": "2.8.11",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "nativescript-dev-webpack": "1.0.1",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "3.4.5"
  }
}
tsonevn commented 4 years ago

HI @tahir-jamil , Can you provide more info about the problem and how to reproduce it? It will also help if you can send us a sample project, where the issue can be reproduced.

tahir-jamil commented 4 years ago

this is the link of github you can recreate the issue https://github.com/tahir-jamil/radlistview-6-notShowingItems hi this is the problem creating on Android

Successfully synced application org.nativescript.sassprojectlistviewtesting on device PL2GAMU841917325.
JS: HMR: Hot Module Replacement Enabled. Waiting for signal.
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to start activity ComponentInfo{org.nativescript.sassprojectlistviewtesting/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Unexpected module 'NativeScriptUIListViewModule' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation.
System.err: 
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.sassprojectlistviewtesting/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Unexpected module 'NativeScriptUIListViewModule' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation.
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2928)
System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3063)
System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
System.err:     at android.os.Looper.loop(Looper.java:198)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:6729)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err: Caused by: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Unexpected module 'NativeScriptUIListViewModule' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation.
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:1096)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1083)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1063)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1055)
System.err:     at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:19)
System.err:     at android.app.Activity.performCreate(Activity.java:7136)
System.err:     at android.app.Activity.performCreate(Activity.java:7127)
System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
System.err:     ... 11 more

This is the issue showing on IOS

Successfully synced application org.nativescript.sassprojectlistviewtesting on device CCDCAFC5-5BEE-45F8-A1B2-59EE03138B5A.
(RunningBoardServices) [com.apple.runningboard:connection] Identity resolved as application<org.nativescript.sassprojectlistviewtesting>
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1   0x108c6671a NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x108cb214c -[TNSRuntime executeModule:referredBy:]
3   0x1085af753 main
4   0x7fff516ecd29 start
5   0x1
JavaScript stack trace:
file:///node_modules/nativescript-ui-listview/ui-listview.js:544:0
at ../node_modules/nativescript-ui-listview/ui-listview.js(file:///node_modules/nativescript-ui-listview/ui-listview.js:546:1)
at __webpack_require__(file:///src/webpack/bootstrap:750:0)
at fn(file:///src/webpack/bootstrap:120:0)
at ../node_modules/nativescript-ui-listview/angular/listview-directives.js(file:///node_modules/nativescript-ui-listview/angular/listview-directives.js:5:18)
at __webpack_require__(file:///src/webpack/bootstrap:750:0)
at fn(file:///src/webpack/bootstrap:120:0)
at ./app/app.module.ts(file:///app/bundle.js:134:109)
at __webpack_require__(file:///src/webpack/bootstrap:750:0)
at fn(file:///src/webpack/bootstrap:120:0)
at file:///app/bundle.js:260:92
at ./main.ns.ts(file:///app/bundle.js:319:34)
at __webpack_require__(file:///src/webpack/bootstrap:750:0)
at checkDeferredModules(file:///src/webpack/bootstrap:43:0)
at webpackJsonpCallback(file:///src/webpack/bootstrap:30:0)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at promiseReactionJob([native code])
JavaScript error:
file:///node_modules/nativescript-ui-listview/ui-listview.js:544:0: JS ERROR ReferenceError: Can't find variable: TKListViewDelegate
(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: ReferenceError: Can't find variable: TKListViewDelegate
at
file:///node_modules/nativescript-ui-listview/ui-listview.js:544:0
at ../node_modules/nativescript-ui-listview/ui-listview.js(file:///node_modules/nativescript-ui-listview/ui-listview.js:546:1)
at __webpack_require__(file:///src/webpack/bootstrap:750:0)
at fn(file:///src/webpack/bootstrap:120:0)
at ../node_modules/nativescript-ui-listview/angular/listview-directives.js(file:///node_modules/nativescript-ui-listview/angular/listview-directives.js:5:18)
at __webpack_require__(file:///src/webpack/bootstrap:750:0)
at fn(file:///src/webpack/bootstrap:120:0)
at ./app/app.module.ts(file:///app/bundle.js:134:109)
at __webpack_require__(file:///src/webpack/bootstrap:750:0)
at fn(file:///src/webpack/bootstrap:120:0)
at file:///app/bundle.js:260:92
at ./main.ns.ts(file:///app/bundle.js:319:34)
at __webpack_require__(file:///src/webpack/bootstrap:750:0)
at checkDeferredModules(file:///src/webpack/bootstrap:43:0)
at webpackJsonpCallback(file:///src/webpack/bootstrap:30:0)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at m<…>
NativeScript caught signal 6.
Native Stack:
1   0x108cb0cb1 sig_handler(int)
2   0x7fff518c5b5d _sigtramp
3   0x7fff00020008
4   0x7fff517b9a3c abort
5   0x7fff4f6d27f8 __cxa_bad_cast
6   0x7fff4f6d29c7 demangling_unexpected_handler()
7   0x7fff50864d7c _objc_terminate()
8   0x7fff4f6dfe97 std::__terminate(void (*)())
9   0x7fff4f6df8fe __cxa_get_exception_ptr
10  0x7fff4f6df8c5 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
11  0x7fff50864c44 _objc_exception_destructor(void*)
12  0x108c66bbf NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
13  0x108cb214c -[TNSRuntime executeModule:referredBy:]
14  0x1085af753 main
15  0x7fff516ecd29 start
16  0x1
JS Stack:
tahir-jamil commented 4 years ago

if you wish i can add you in the github repo as a collaborator so you can update this to thanks in advanced @tsonevn

tsonevn commented 4 years ago

Hi @tahir-jamil, Excuse me for the delay in reply. I've checked the project and found that NativeScriptUIListViewModule is set in the declarations' scope instead of the imports, which was causing the error. On that matter, move theNativeScriptUIListViewModule in the imports' scope in app.module.tns.ts and replace the RadListView's layout from StackLayout to GridLayout. For example:

<GridLayout  class="p-20">
        <RadListView [items]="['a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b','a','b']">
            <ng-template tkListItemTemplate let-item="item">
                <StackLayout orientation="vertical">
                    <Label class="nameLabel" text="item.name"></Label>
                </StackLayout>
            </ng-template>
        </RadListView>
</GridLayout>

Hope this helps.

tahir-jamil commented 4 years ago

thanks and sorry for the declaration issue stupid thing i guess lol