RadListView on iOS will be crashed on some condition.
I found the cause is line below.
listview.ios.js :
563 var currentIndexPath = this.owner.ios.indexPathForCell(this);
564 if (touchEvent.tapCount === 1) {
565 if (this.owner.hasListeners(commonModule.RadListView.itemTapEvent)) {
Some times currentIndexPath will be null in case current cell has already removed in previous event handler.
Currently, I am using workaround like bellow.
565 if (currentIndexPath && this.owner.hasListeners(commonModule.RadListView.itemTapEvent)) {
5 Answers, 1 is accepted
Thank you for contacting us.
Could you provide some more info about the problem and the way you are removing the items from the RadListView? We will also appreciate if you could provide sample project, which could be debugged locally.
I look forward to hearing from you
Regards,
nikolay.tsonev
Telerik by Progress
This is overview for reproducing
1. Bind ObservableArray which have 1 record to RadListView (selectionBehavior="LongPress")
2. Hook itemSelected and add code for removing the record in this handler
3. Run and long press the item
4. Crash in listview.ios.js( this.owner.ios.indexPathForCell(this)==null )
It's depends on timing of releasing finger.
Thank you for your detailed description.
I followed the below-given steps, however, I am still unable to reproduce this behavior. For your convenience, I am attaching the sample project, which I use for testing.
Could you review the project and make the appropriate changes which are needed to reproduce this issue?
Thank you in advance for your cooperation.
Regards,
nikolay.tsonev
Telerik by Progress
Reproduced by some modification.
I found:
1. itemTap is also must be hooked
2. Animation is necessary
3. ObservableArray.splice() to remove item
4. Remove finger while in deleting animation
Seems uploading zip is not allowed.I attached diff.
diff -ru 0e4d6f5e-e43b-469c-8ecc-7c4ffefb0a26_Archive/app/main-page.ts hoge/app/main-page.ts
--- 0e4d6f5e-e43b-469c-8ecc-7c4ffefb0a26_Archive/app/main-page.ts2017-02-10 20:09:05.000000000 +0900
+++ hoge/app/main-page.ts2017-02-11 13:43:41.000000000 +0900
@@ -28,19 +28,14 @@
page.bindingContext = tmpobsrvable;
}
+export function lvitemtap(args:ListViewEventData){
+}
+
export function lvitemselected(args:ListViewEventData){
- var tempArray = new ObservableArray();
- tempArray=array;
- array=new ObservableArray();
- for(var i=0; i<tempArray.length; i++){
- if(i!=args.itemIndex){
- array.push(tempArray.getItem(i));
- }
- }
- tmpobsrvable.set("dataItems", array)
+array.splice(args.itemIndex,1)
//also tested with
//array.pop()
-}
\ No newline at end of file
+}
diff -ru 0e4d6f5e-e43b-469c-8ecc-7c4ffefb0a26_Archive/app/main-page.xml hoge/app/main-page.xml
--- 0e4d6f5e-e43b-469c-8ecc-7c4ffefb0a26_Archive/app/main-page.xml2017-02-10 18:48:32.000000000 +0900
+++ hoge/app/main-page.xml2017-02-11 13:35:59.000000000 +0900
@@ -10,9 +10,9 @@
http://docs.nativescript.org/ui/action-bar
-->
<GridLayout>
- <lv:RadListView id="lvID" items="{{ dataItems }}" selectionBehavior="LongPress" itemSelected="lvitemselected">
+ <lv:RadListView id="lvID" items="{{ dataItems }}" selectionBehavior="LongPress" itemSelected="lvitemselected" itemTap="lvitemtap">
<lv:RadListView.listViewLayout>
- <lv:ListViewLinearLayout scrollDirection="Vertical" />
+ <lv:ListViewGridLayout scrollDirection="Vertical" itemDeleteAnimation="fade" />
</lv:RadListView.listViewLayout>
<lv:RadListView.itemTemplate>
<StackLayout orientation="vertical">
Thank you for your further description.
I reviewed further the case and unfortunately, I have to confirm that this is a real issue for iOS while using LongPress selection with itemDeleteAnimation setup.
For your convenience, I have logged a new issue in UI for NativeScript feedback repo. For further info, you could keep track on the issue here.
About the other question, you should be able to attach zip files, while submitting your ticket.
Regards,
nikolay.tsonev
Telerik by Progress