Search code examples
nativescript-angular

Nativescript Angular - Cannot trigger itemSelected on the first item on a RadListView


Please help! I cannot click the first item in the radlistview on IOS (onItemSelected is not triggered), however it is working fine on android.

My code:

<GridLayout class="p-x-10">
  <RadListView
    class="users"
    loadOnDemandMode="Auto"
    pullToRefresh="true"
    selectionBehavior="Press"
    [items]="userPaginator.docs"
    (itemSelected)="onItemSelected($event)"
    (loadMoreDataRequested)="onLoadMoreItemsRequested($event)"
    (pullToRefreshInitiated)="onPullToRefreshInitiated($event)"
    >
    <ng-template tkListItemTemplate let-item="item">
      <StackLayout orientation="vertical" class="users__card">
        <Label class="users__card-name" [text]="item.name"></Label>
        <Label class="users__card-username" [text]="item.username"></Label>
        <Label class="users__card-userId" [text]="item.userId"></Label>
        <Label class="users__card-email" [text]="item.email"></Label>
        <Label class="users__card-phone" [text]="item.phone"></Label>
      </StackLayout>
    </ng-template>

  </RadListView>
  <ActivityIndicator
    rowSpan="1"
    [busy]="isPageLoading"
    [visibility]="isPageLoading ? 'visible' : 'collapse'"
    horizontalAlignment="center"></ActivityIndicator>

</GridLayout>

Solution

  • Instead of OnItemSelected you can use tap event of StackLayout

    <StackLayout orientation="vertical" class="users__card" (tap)="onItemSelected($event)">