forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist-view.d.ts
More file actions
129 lines (111 loc) · 4.63 KB
/
list-view.d.ts
File metadata and controls
129 lines (111 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/**
* Contains the ListView class, which represents a standard list view widget.
*/
declare module "ui/list-view" {
import observable = require("data/observable");
import dependencyObservable = require("ui/core/dependency-observable");
import view = require("ui/core/view");
import color = require("color");
/**
* Known template names.
*/
export module knownTemplates {
/**
* The ListView item template.
*/
export var itemTemplate: string;
}
/**
* Represents a view that shows items in a vertically scrolling list.
*/
export class ListView extends view.View {
/**
* String value used when hooking to itemLoading event.
*/
public static itemLoadingEvent: string;
/**
* String value used when hooking to itemTap event.
*/
public static itemTapEvent: string;
/**
* String value used when hooking to loadMoreItems event.
*/
public static loadMoreItemsEvent: string;
/**
* Represents the observable property backing the items property of each ListView instance.
*/
public static itemsProperty: dependencyObservable.Property;
/**
* Represents the item template property of each ListView instance.
*/
public static itemTemplateProperty: dependencyObservable.Property;
/**
* Represents the observable property backing the isScrolling property of each ListView instance.
*/
public static isScrollingProperty: dependencyObservable.Property;
/**
* Gets the native [android widget](http://developer.android.com/reference/android/widget/ListView.html) that represents the user interface for this component. Valid only when running on Android OS.
*/
android: android.widget.ListView;
/**
* Gets the native [iOS view](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableView_Class/) that represents the user interface for this component. Valid only when running on iOS.
*/
ios: UITableView;
/**
* Gets a value indicating whether the ListView is currently scrolling.
*/
isScrolling: boolean;
/**
* Gets or set the items collection of the ListView.
* The items property can be set to an array or an object defining length and getItem(index) method.
*/
items: any;
/**
* Gets or set the item template of the ListView.
*/
itemTemplate: string;
/**
* Gets or set the items separator line color of the ListView.
*/
separatorColor: color.Color;
/**
* Forces the ListView to reload all its items.
*/
refresh();
/**
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
* @param callback - Callback function which will be executed when event is raised.
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
*/
on(eventNames: string, callback: (data: observable.EventData) => void, thisArg?: any);
/**
* Raised when a View for the data at the specified index should be created.
* The result should be returned trough the view property of the event data.
* Note, that the view property of the event data can be pre-initialized with
* an old instance of a view, so that it can be reused.
*/
on(event: "itemLoading", callback: (args: ItemEventData) => void, thisArg?: any);
/**
* Raised when an item inside the ListView is tapped.
*/
on(event: "itemTap", callback: (args: ItemEventData) => void, thisArg?: any);
/**
* Raised when the ListView is scrolled so that its last item is visible.
*/
on(event: "loadMoreItems", callback: (args: observable.EventData) => void, thisArg?: any);
}
/**
* Event data containing information for the index and the view associated to a list view item.
*/
export interface ItemEventData extends observable.EventData {
/**
* The index of the item, for which the event is raised.
*/
index: number;
/**
* The view that is associated to the item, for which the event is raised.
*/
view: view.View;
}
}