mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Remove listview cell selection in iOS
This commit is contained in:
@ -161,6 +161,26 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
|
||||
}
|
||||
}
|
||||
|
||||
public test_cell_selection_ios() {
|
||||
if (platform.device.os === platform.platformNames.ios) {
|
||||
let listView = this.testView;
|
||||
|
||||
let colors = ["red", "green", "blue"];
|
||||
listView.items = colors;
|
||||
|
||||
TKUnit.waitUntilReady(() => { return this.getNativeViewCount(listView) === listView.items.length; }, ASYNC);
|
||||
|
||||
var index = 1;
|
||||
this.performNativeItemTap(listView, index);
|
||||
var uiTableView = <UITableView>listView.ios;
|
||||
var cellIndexPath = NSIndexPath.indexPathForItemInSection(index, 0);
|
||||
var cell = uiTableView.cellForRowAtIndexPath(cellIndexPath);
|
||||
uiTableView.selectRowAtIndexPathAnimatedScrollPosition(cellIndexPath, false, 0);
|
||||
|
||||
TKUnit.assertTrue(cell.selected, "cell is selected");
|
||||
}
|
||||
}
|
||||
|
||||
public test_set_items_to_array_creates_native_views() {
|
||||
var listView = this.testView;
|
||||
listView.on(listViewModule.ListView.itemLoadingEvent, this.loadViewWithItemNumber);
|
||||
@ -482,7 +502,7 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
|
||||
TKUnit.assertEqual(secondNativeElementText, "2", "second element text");
|
||||
TKUnit.assertEqual(thirdNativeElementText, "3", "third element text");
|
||||
}
|
||||
|
||||
|
||||
public test_ItemTemplateFactoryFunction() {
|
||||
var listView = this.testView;
|
||||
|
||||
|
@ -103,7 +103,12 @@ class UITableViewDelegateImpl extends NSObject implements UITableViewDelegate {
|
||||
if (owner) {
|
||||
notifyForItemAtIndex(owner, cell, cell.view, ITEMTAP, indexPath);
|
||||
}
|
||||
cell.highlighted = false;
|
||||
return indexPath;
|
||||
}
|
||||
|
||||
public tableViewDidSelectRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): NSIndexPath {
|
||||
tableView.deselectRowAtIndexPathAnimated(indexPath, true);
|
||||
|
||||
return indexPath;
|
||||
}
|
||||
|
||||
@ -157,8 +162,7 @@ class UITableViewRowHeightDelegateImpl extends NSObject implements UITableViewDe
|
||||
if (owner) {
|
||||
notifyForItemAtIndex(owner, cell, cell.view, ITEMTAP, indexPath);
|
||||
}
|
||||
cell.highlighted = false;
|
||||
return indexPath;
|
||||
return indexPath;
|
||||
}
|
||||
|
||||
public tableViewHeightForRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): number {
|
||||
|
Reference in New Issue
Block a user