question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ListView - ngClass slows down scrolling performance

See original GitHub issue

From @haschu on January 16, 2017 19:3

Did you verify this is a real problem by searching [Stack Overflow]

Yes

Tell us about the problem

Which platform(s) does your issue occur on?

iOS

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.4.2
  • Cross-platform modules: 2.4.4
  • Runtime(s): tns-ios 2.4.0
  • Plugin(s): nativescript-telerik-ui-pro

Please tell us how to recreate the issue in as much detail as possible.

Consider the following code with round about 100 items:

<ListView [items]="bars" class="list-group">
    <template let-bar="item">  
        <GridLayout columns="*, auto" rows="auto, *, *" class="list-group-item">
            <Label [text]="bar.foo" row="0" col="0"></Label>
            <Progress [value]="bar.progress" row="3" maxValue="100" color="#3498db" backgroundColor="#ecf0f1"></Progress>
        </GridLayout>
    </template>
</ListView>

Everything works pretty well, also the scrolling is very smooth. Now add [ngClass]="bar.something" to GridLayout:

<ListView [items]="bars" class="list-group">
    <template let-bar="item">  
        <GridLayout columns="*, auto" rows="auto, *, *" class="list-group-item" [ngClass]="bar.class">
            <Label [text]="bar.foo" row="0" col="0"></Label>
            <Progress [value]="bar.progress" row="3" maxValue="100" color="#3498db" backgroundColor="#ecf0f1"></Progress>
        </GridLayout>
    </template>
</ListView>

Now the scrolling isn’t smooth anymore, it’s kind of jerky and doesn’t feels very well. Does anybody know how to improve on that?

Maybe I am doing something wrong? It would be great if someone could point me to the right direction 😃

Copied from original issue: NativeScript/NativeScript#3498

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
Oatelauscommented, Nov 21, 2018

Is this a concrete can't-fix/wont-fix?

As @haschu said, this is a common scenario within the angular world and generally is the way most people coming from a purely Angular background would do this.

As well as this, it’s not mentioned anywhere in the documentation as far as I can see:

https://docs.nativescript.org/angular/ui/ng-ui-widgets/listview

Whilst this page utilizes a ng-template it’s not documented anywhere as to why, and that page doesn’t mention anything about performance when using structural directives within the listview.

1reaction
haschucommented, Jan 18, 2017

@NickIliev Thanks! Great blog post - I’ll give it a try. I think the issue can be closed for now. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

ListView very slow when scrolling - android - Stack Overflow
1 Answer 1 ... Please try to remove the icons from the listview and see if that improves performance. You may be using...
Read more >
Attempting To Improve Rendering Performance Of A Large ...
Ben Nadel looks at the poor rendering performance of a large list view in AngularJS 1.2.22; how he identified some of the bottlenecks...
Read more >
Bad performance on listview scrolling | Telerik Forums
The problem I'm facing is regards to the flow/feeling when sliding down a listview. I mean, the load time is great, the overall...
Read more >
Table - PrimeNG - PrimeFaces
Virtual Scrolling. VirtualScroller is a performance-approach to handle huge data efficiently. Setting virtualScroll property as true and providing a ...
Read more >
flutter scroll listview Code Example
“flutter scroll listview” Code Answer's ... listview scroll direction flutter ... does multithreading slow down the system · Israel Elections 2021 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found