Search code examples
iosnativescriptnativescript-angularios11.4

NativeScript RadListView component template


I am trying to use an Angular component as the template for RadListView.

<StackLayout>
  <RadListView [items]="stories"
               marginRight="-2"
               separatorColor="transparent"
               height="100%">
    <ng-template tkListItemTemplate
                 let-story="item">
      <NewsItem [story]="story"></NewsItem>
    </ng-template>
  </RadListView>
</StackLayout>

I get the following error.

file:///app/tns_modules/tns-core-modules/ui/core/view/view.js:57:124: JS ERROR Error: onMeasure() did not set the measured dimension by calling setMeasuredDimension() ProxyViewContainer(435)


Solution

  • Figured it out. The template itself must have a container.

    <StackLayout>
      <RadListView [items]="stories"
                   marginRight="-2"
                   separatorColor="transparent"
                   height="100%">
        <ng-template tkListItemTemplate
                     let-story="item">
          <StackLayout>
            <NewsItem [story]="story"></NewsItem>
          </StackLayout>
        </ng-template>
      </RadListView>
    </StackLayout>