mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Removed the code that raises 'unloaded' event for list-view rows for performance reasons.
This commit is contained in:
@ -34,7 +34,6 @@ export class ListView extends common.ListView {
|
||||
private _android: android.widget.ListView;
|
||||
public _realizedItems = {};
|
||||
private _androidViewId: number;
|
||||
public _attachStateChangeListener: android.view.View.OnAttachStateChangeListener;
|
||||
|
||||
public _createUI() {
|
||||
this._android = new android.widget.ListView(this._context);
|
||||
@ -89,28 +88,6 @@ export class ListView extends common.ListView {
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
this._attachStateChangeListener = new android.view.View.OnAttachStateChangeListener({
|
||||
get owner() {
|
||||
return that.get();
|
||||
},
|
||||
|
||||
onViewAttachedToWindow: function (view: android.view.View) {
|
||||
//
|
||||
},
|
||||
onViewDetachedFromWindow: function (androidView: android.view.View) {
|
||||
var owner = that.get();
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
var view: viewModule.View = this.owner._realizedItems[androidView.hashCode()];
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
view.onUnloaded();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get android(): android.widget.ListView {
|
||||
@ -234,10 +211,6 @@ class ListViewAdapter extends android.widget.BaseAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
if (!this._listView._realizedItems[convertView.hashCode()]) {
|
||||
convertView.addOnAttachStateChangeListener(this._listView._attachStateChangeListener);
|
||||
}
|
||||
|
||||
this._listView._realizedItems[convertView.hashCode()] = args.view;
|
||||
// cache the realized index (used to raise the ItemLoading event upon scroll stop)
|
||||
args.view[REALIZED_INDEX] = index;
|
||||
|
@ -21,14 +21,6 @@ class ListViewCell extends UITableViewCell {
|
||||
static new(): ListViewCell {
|
||||
return <ListViewCell>super.new();
|
||||
}
|
||||
|
||||
public removeFromSuperview(): void {
|
||||
super.removeFromSuperview();
|
||||
var view: view.View = (<any>this).view;
|
||||
if (view) {
|
||||
view.onUnloaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function notifyForItemAtIndex(listView: definition.ListView, cell: any, eventName: string, indexPath: NSIndexPath) {
|
||||
|
Reference in New Issue
Block a user