Skip to content

Commit b29f04f

Browse files
PeterStaevmanoldonev
authored andcommitted
feat(listview): add required interface for generalized listview comonent (NativeScript#5524)
1 parent 7cd8e7e commit b29f04f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tns-core-modules/ui/list-view/list-view-common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ListView as ListViewDefinition, ItemsSource, ItemEventData } from ".";
1+
import { ListView as ListViewDefinition, ItemsSource, ItemEventData, TemplatedItemsView } from ".";
22
import { CoercibleProperty, CssProperty, Style, View, Template, KeyedTemplate, Length, Property, Color, Observable, EventData, CSSType } from "../core/view";
33
import { parse, parseMultipleTemplates } from "../builder";
44
import { Label } from "../label";
@@ -19,7 +19,7 @@ export module knownMultiTemplates {
1919
const autoEffectiveRowHeight = -1;
2020

2121
@CSSType("ListView")
22-
export abstract class ListViewBase extends View implements ListViewDefinition {
22+
export abstract class ListViewBase extends View implements ListViewDefinition, TemplatedItemsView {
2323
public static itemLoadingEvent = "itemLoading";
2424
public static itemTapEvent = "itemTap";
2525
public static loadMoreItemsEvent = "loadMoreItems";

tns-core-modules/ui/list-view/list-view.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ export interface ItemsSource {
154154
getItem(index: number): any;
155155
}
156156

157+
export interface TemplatedItemsView {
158+
items: any[] | ItemsSource;
159+
itemTemplate: string | Template;
160+
itemTemplates?: string | Array<KeyedTemplate>;
161+
refresh(): void;
162+
on(event: "itemLoading", callback: (args: ItemEventData) => void, thisArg?: any);
163+
off(event: "itemLoading", callback: (args: EventData) => void, thisArg?: any);
164+
}
165+
157166
/**
158167
* Represents the property backing the items property of each ListView instance.
159168
*/

0 commit comments

Comments
 (0)