[TIMOB-28555] Android: Moving a TableView row into an empty section or header/footer causes a crashes
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-10-20T03:13:12.000+0000 |
Affected Version/s | Release 9.3.0 |
Fix Version/s | Release 10.2.0 |
Components | Android |
Labels | TableView, android, editing, move, parity |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2021-10-14T01:20:47.000+0000 |
Updated | 2021-10-20T03:13:12.000+0000 |
Description
*Summary:*
Moving a
TableView
row via edit mode into an empty section or a header/footer title will cause a crash.
*Steps to reproduce:*
Build and run the below on Android.
Tap and hold "Row 1".
Drag it into "Section 1".
Notice the app crashes.
const window = Ti.UI.createWindow();
const tableView = Ti.UI.createTableView({
data: [
Ti.UI.createTableViewSection({ headerTitle: "Section 1" }),
Ti.UI.createTableViewSection({ headerTitle: "Section 2" }),
],
allowsSelectionDuringEditing: false,
allowsMultipleSelectionDuringEditing: false,
editing: true,
headerTitle: "Header Title",
footerTitle: "Footer Title",
});
tableView.sections[1].add(Ti.UI.createTableViewRow({ title: "Row 1", editable: false, moveable: true }));
tableView.addEventListener("move", (e) => {
const data = {
sectionTitle: e.section.headerTitle,
rowTitle: e.row.title,
index: e.index,
};
console.log(@@@ "move" event: ${JSON.stringify(data)}
);
});
window.add(tableView);
window.open();
*Result:*
App immediately crashes with the following exception when dragged into an empty section. You don't have to release your finger (ie: drop) for the crash to occur.
[ERROR] InputEventReceiver: Exception dispatching input event.
[ERROR] TiExceptionHandler: (main) [517745,517850] Index: -1, Size: 0
[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler: java.util.ArrayList.add(ArrayList.java:483)
[ERROR] TiExceptionHandler: ti.modules.titanium.ui.TableViewSectionProxy.add(TableViewSectionProxy.java:59)
[ERROR] TiExceptionHandler: ti.modules.titanium.ui.TableViewProxy.moveItem(TableViewProxy.java:264)
[ERROR] TiExceptionHandler: ti.modules.titanium.ui.widget.listview.ItemTouchHandler.onMove(ItemTouchHandler.java:281)
[ERROR] TiExceptionHandler: androidx.recyclerview.widget.ItemTouchHelper.moveIfNecessary(ItemTouchHelper.java:885)
[ERROR] TiExceptionHandler: androidx.recyclerview.widget.ItemTouchHelper$2.onTouchEvent(ItemTouchHelper.java:389)
[ERROR] TiExceptionHandler: androidx.recyclerview.widget.RecyclerView.dispatchToOnItemTouchListeners(RecyclerView.java:3259)
[ERROR] TiExceptionHandler: androidx.recyclerview.widget.RecyclerView.onTouchEvent(RecyclerView.java:3421)
[ERROR] TiExceptionHandler: android.view.View.dispatchTouchEvent(View.java:14309)
[ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3112)
[ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2785)
[ERROR] TiExceptionHandler: ti.modules.titanium.ui.widget.listview.TiNestedRecyclerView.dispatchTouchEvent(TiNestedRecyclerView.java:109)
[ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
PR (master): https://github.com/appcelerator/titanium_mobile/pull/13120