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

[RadListView] Cannot read property 'setBackgroundColor' of undefined #1274

Closed nericode closed 4 years ago

nericode commented 4 years ago

In RadListView

Cannot read property 'setBackgroundColor' of undefined && not update position index when delete element of list.

Please take a minute to read our [NativeScript Code of Conduct](System.err: An uncaught Exception occurred on "main" thread.


An uncaught Exception occurred on "main" thread.
Calling js method onBindViewHolder failed
TypeError: Cannot read property 'setBackgroundColor' of undefined

StackTrace: push.../node_modules/nativescript-ui-listview/ui-listview.js.RadListView._toggleSelectionColor(file:///data/data/org.nativescript.appgenericsales/files/app/vendor.js:89045:29) at ListViewAdapter.onBindViewHolder(file:///data/data/org.nativescript.appgenericsales/files/app/vendor.js:87886:19) at com.tns.Runtime.callJSMethodNative(Native Method) at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209) at com.tns.Runtime.callJSMethodImpl(Runtime.java:1096) at com.tns.Runtime.callJSMethod(Runtime.java:1083) at com.tns.Runtime.callJSMethod(Runtime.java:1063) at com.tns.Runtime.callJSMethod(Runtime.java:1055) at com.tns.gen.com.telerik.widget.list.ListViewAdapter_vendor_87794_32_ListViewAdapter.onBindViewHolder(ListViewAdapter_vendor_87794_32_ListViewAdapter.java:49) at com.telerik.widget.list.ListViewWrapperAdapter.onBindViewHolder(ListViewWrapperAdapter.java:266) at com.telerik.widget.list.ListViewWrapperAdapter.onBindViewHolder(ListViewWrapperAdapter.java:20) at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6944) at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6986) at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5903) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6170) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6009) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6005) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2302) at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:563) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665) at androidx.recyclerview.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:172) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4040) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3757) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4310) at com.telerik.widget.list.RadListView.onLayout(RadListView.java:600) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at org.nativescript.widgets.CommonLayoutParams.layoutChild(CommonLayoutParams.java:222) at org.nativescript.widgets.GridLayout.onLayout(GridLayout.java:354) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at org.nativescript.widgets.CommonLayoutParams.layoutChild(CommonLayoutParams.java:222) at org.nativescript.widgets.GridLayout.onLayout(GridLayout.java:354) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at org.nativescript.widgets.CommonLayoutParams.layoutChild(CommonLayoutParams.java:222) at org.nativescript.widgets.ContentLayout.onLayout(ContentLayout.java:73) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:761) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2496) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2212) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)


### Which platform(s) does your issue occur on?
Android

This issue is in an emulator with next characteristics :
* API 27
* Size on Disk: 3.9 GB
* CPU x86
* Nexus S

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

{ "nativescript": { "id": "org.nativescript.appgenericsales", "tns-android": { "version": "6.1.1" }, "tns-ios": { "version": "6.1.0" } }, "dependencies": { "@angular/animations": "~8.2.0", "@angular/common": "~8.2.0", "@angular/compiler": "~8.2.0", "@angular/core": "~8.2.0", "@angular/forms": "~8.2.0", "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", "json-object-mapper": "^1.6.0", "nativescript-angular": "~8.2.0", "nativescript-image": "^2.2.5", "nativescript-localstorage": "^1.1.5", "nativescript-material-cardview": "^2.5.0", "nativescript-material-ripple": "^2.5.0", "nativescript-theme-core": "^2.0.20", "nativescript-ui-listview": "^7.1.0", "nativescript-ui-sidedrawer": "^7.0.2", "reflect-metadata": "~0.1.12", "rxjs": "^6.4.0", "tns-core-modules": "~6.1.0", "zone.js": "~0.9.1" }, "devDependencies": { "@angular/compiler-cli": "~8.2.0", "@ngtools/webpack": "~8.2.0", "nativescript-dev-webpack": "~1.2.0", "node-sass": "4.12.0", "typescript": "~3.5.3" }, "gitHead": "e9af7b54b243e55ef28e4610c4ef8c83837d86c0", "readme": "NativeScript Application" }


### Project for test

[Archivo.zip](https://github.com/NativeScript/nativescript-ui-feedback/files/3741895/Archivo.zip)

### Enverionment
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 11.0.0 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.1.2 version and is up to date.
tsonevn commented 4 years ago

HI @NeriCodec, Thank you for the provided sample project. I was able to recreate the issue for Android. I will log it as a bug and we will investigate it further. To workaround the issue, you can nest ns-item-product custom component in one of the available Layouts in products.component.html. For example:

 <ng-template tkListItemTemplate let-item="item">
                <StackLayout>
                    <ns-item-product [product]="item"></ns-item-product>
                </StackLayout>
            </ng-template>
nericode commented 4 years ago

@tsonevn Hello, thanks for answer, now work my app 👍

zbranzov commented 4 years ago

The fix is released in nativescript-ui-listview@8.0.0