Skip to content

DataTemplateSelector - wrong Data Template recycled #37

@EltonGarcia

Description

@EltonGarcia

Platform:

  • OS: [iOS]
  • Device: [iPhone7+/iPhoneSimulator]
  • Sdk vervion: [iOS 10.2/iOS 12.1]
  • Xamarin.Forms: [3.4.0.1029999/3.6.0.220655]

Bug description
When using a DataTemplateSelector iOS is recycling the wrong DataTemplate cell.
A recycle strategy that takes the DataTemplate in account when recycle should be implemented to fix it, similar to the one used on Xamarin.Forms:
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/listview/performance#recycleelement-with-a-datatemplateselector

To Reproduce
Steps to reproduce the behavior:
I've modified the SillyCompany sample app to reproduce the issue.
I've created a flag to indicate whether a dude is a favorite one or not. If he is a favorite one the background color of the card will be yellow. The following dudes were flagged as a favorite: Knights of Ni, Triumph, Steve Carell, IT Guy.

  1. Check the following branch: bug-template-recycle
  2. Scroll fast and multiple times the carousel.
  3. The carousel will be messed showing "Favorite dudes" with a white background and not "Favorite dudes" in a yellow background.

Video
The following video presents the bug pretty clear:
https://github.com/EltonGarcia/Xamarin-Forms-Practices/blob/bug-template-recycle/BugVideo/recyclebug.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions