ListView with Label.FormattedText in DataTemplate causes performance issues
#5,087 opened on Jan 29, 2019
Repository metrics
- Stars
- (5,644 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Description
I am currently working on an Instagram type app where there is a "feed" that contains posts of an image and some text. In that text, there could be user mentions or hashtags. I needed to show those in blue, so I used FormattedString and Spans, and using the FormattedText property on the label. However, when the list is loaded, scrolling performance is degraded.
However, the scrolling performance issues go away when I switch to using the Text property on the label, the scrolling performance issues went away, but I also lose my highlighting.
I would like to know if I am doing something wrong. I originally thought the issue was the images(which are typically the issue), but once I started playing with the text, I noticed that the text was the cause of the scrolling issues.
Steps to Reproduce
- Run sample app below
- Scroll up and down
- Notice scrolling performance issues.
- Stop app, go to MainPage.xaml, in the DataTemplate for the list view, comment out the label using FormattedText and uncomment out the label using Text.
- Run app again
- Notice that there aren't any scrolling performance issues.
Expected Behavior
Scrolling performance shouldn't be changed when using FormattedText vs. Text with a Label.
Actual Behavior
Performance is changed significantly.
Basic Information
- Version with issue: XF 3.4.0.1029999
- Last known good version: N/A
- IDE: VS for Mac
- Platform Target Frameworks:
- iOS: 12.1
- Nuget Packages:
- FreshMvvm
- Newtonsoft.Json
- PropertyChanged.Fody
- Xamarin.Essentials
- Xamarin.FFImageLoading.Forms
- Xamarin.FFImageLoading.Transformations
- Affected Devices:
- iPhone 6 - 11.2.1