NativeScript views
ListView and Repeater
Both take items as a comma-separated string or an array, and show each item as text.
ListView
Each row is a button. The itemTap output emits the row index. On a device a ListView scrolls its rows, so give it a height.
<ListView items="Apples, Bananas, Cherries" class="h-40 rounded border"></ListView>Repeater
<Repeater> stacks the items vertically and has no tap behaviour.
One
Two
Three
<Repeater items="One, Two, Three"></Repeater>These fallbacks render items as plain text. Custom item templates are not implemented.
HTML-first equivalent
Loop over your data with @for and write the row markup yourself, which also gives you the item templates the polyfill lacks:
- Apples
- Bananas
- Cherries
<ul class="flex flex-col divide-y rounded border">
@for (fruit of ['Apples', 'Bananas', 'Cherries']; track fruit) {
<li class="p-3">{{ fruit }}</li>
}
</ul>