NativeScript Angular RadListView渲染极其缓慢

NativeScript Angular RadListView渲染极其缓慢,nativescript,nativescript-angular,nativescript-telerik-ui,radlistview,Nativescript,Nativescript Angular,Nativescript Telerik Ui,Radlistview,问题: 我有一个angular nativescript应用程序,需要在网格中显示一些项目。我正在使用RadListView来呈现列表,在过去几个月升级了angular、{N}和其他库依赖项之后,我注意到项目的RadListView呈现速度慢得令人无法忍受。我有多个“标签”,所以你可以看到不同类型的项目,每当你切换“标签”,它需要完全重新呈现新的时间列表。在进行一些升级之前(我希望这会提高应用程序的性能),切换标签不会有明显的延迟,即使是呈现100多个项目。现在需要几秒钟才能加载24个(我切换到

问题:

我有一个angular nativescript应用程序,需要在网格中显示一些项目。我正在使用RadListView来呈现列表,在过去几个月升级了angular、{N}和其他库依赖项之后,我注意到项目的RadListView呈现速度慢得令人无法忍受。我有多个“标签”,所以你可以看到不同类型的项目,每当你切换“标签”,它需要完全重新呈现新的时间列表。在进行一些升级之前(我希望这会提高应用程序的性能),切换标签不会有明显的延迟,即使是呈现100多个项目。现在需要几秒钟才能加载24个(我切换到滚动动态渲染以加快速度,但这还不够好)

平台信息:

  • ios(tns ios 5.2.0、5.3.1)[7]
  • nativescript ui列表视图:6.1.0
  • nativescript ui核心:2.0.1
  • nativescript ui侧抽屉:6.0.0
  • CLI:5.3.1
  • 跨平台模块:5.3.1
  • 运行时:tns ios 5.3.1
该问题似乎与RadListView中的某些嵌套结构有关。我的原始代码(由于在旧版本的{N}、Angular和nativescript ui上执行得很好,所以运行的代码没有变化:

<RadListView id="itemList" top="0" left="0" [items]="displayedInventory" separatorColor="white" [loadOnDemandMode]="loadOnDemandMode"
    (loadMoreDataRequested)="onLoadMoreItemsRequested($event)" class="gridview-wrap-tabs" dock="top" [ngClass]="{'gridview-wrap-tabs': (posLocation && posLocation.tabs)}">
    <ListViewStaggeredLayout tkListViewLayout scrollDirection="Vertical" spanCount="4" itemHeight="180" horizontalAlignment="left"
        class="inventory-list-view-inner" separatorColor="black">
    </ListViewStaggeredLayout>
    <ng-template tkListItemTemplate let-item="item">
        <StackLayout class="inventory-stack-wrap">
            <GridLayout rows="auto, *, auto" columns="auto, auto" orientation="horizontal" class="outerBox" stretchLastChild="true" (tap)="addToCart(item, true)"
                [ngClass]="{ 'portraitBox': orientation==='portrait' , 'selected-inventory-item': item.isSelected, 'empty-inventory-item': item.price < 0}">
                <Label row="0" col="0" *ngIf="item.type==='category'" height="40px" class="price-label-category" [ngClass]="{ 'portrait-category-label': orientation==='portrait' }"
                    text="Category"></Label>
                <Label row="1" col="0" verticalAlignment="top" [text]="item.name" *ngIf="item.type==='category'" class="name-label" textWrap="true"
                    [ngClass]="{ 'portrait-name-label': orientation==='portrait' }"></Label>

                <Label row="0" col="0" verticalAlignment="top" [text]="item.name" *ngIf="item.name && item.name.length <=2 0 && item.type !=='category'"
                    class="name-label" textWrap="true" [ngClass]="{ 'portrait-name-label': orientation==='portrait' }"></Label>
                <Label row="0" col="0" verticalAlignment="top" [text]="item.name.slice(0,20) + '...'" *ngIf="item.name
                    && item.name.length> 20 && item.type !== 'category'" class="name-label" textWrap="true" [ngClass]="{'portrait-name-label': orientation
                    === 'portrait'}"></Label>

                <GridLayout col="0" colSpan="2" row="1" rowSpan="2" width="100%" *ngIf="item.imageSource">
                    <Image class="inventory-image" [ngClass]="{'portrait-inventory-image': orientation==='portrait'}" [src]="item.imageSource"></Image>
                </GridLayout>
                <GridLayout width="100%" *ngIf="item.type !=='category'" row="2" col="0" colSpan="2" columns="auto, *, 10" rows="auto">
                    <Label col="1" row="0" horizontalAlignment="right" height="40px" class="price-label" [ngClass]="{ 'portrait-price-label': orientation==='portrait' }"
                        text="${{item.price | number: '1.2-2'}}"></Label>
                </GridLayout>
            </GridLayout>
        </StackLayout>
    </ng-template>
</RadListView>

作为验证RadListView渲染是否是导致其速度减慢的原因的概念证明,我仅使用一个标签进行了尝试,该标签中嵌入了项的名称,渲染几乎是即时的-因此RadListView渲染子项(如StackLayout、GridLayout)的方式似乎存在问题。我还尝试替换G使用DockLayout的ridLayout并删除所有的angular*ngif和*ngClass(并删除图像标签),以查看这是否会提高性能,但似乎没有任何效果。仅加载24个项目仍然非常缓慢。(加载的项目确实显著减少,但一开始我无法显示少于24个)


有什么想法吗?我宁愿不必降级我的angular和nativescript依赖关系

通过从使用
ListViewStaggedLayout到ListViewGridLayout。这个问题在早期版本的{N}和angular中并不存在,因此它看起来像是某个更新导致了它的延迟。

你能分享一个游乐场示例吗?它可能很容易调试所有应用的样式和类,帮助查看它是否与布局有关。更多详细信息来自{N}团队成员:.TLDR:如果希望提高性能,请不要使用ListViewStaggeredLayout