Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Android] Leave BindingContext intact when recycling TemplatedItemViewHolder #7426

Merged
merged 1 commit into from
Sep 11, 2019

Conversation

hartez
Copy link
Contributor

@hartez hartez commented Sep 6, 2019

Description of Change

TemplatedItemViewHolder is setting the BindingContext of its View to null when recycling. This causes the template to update and invalidate, which hurts performance and leads to a race condition with measurement where the layout is measured as if it had empty string content and then laid out incorrectly. (For fast Label renderers; for the legacy Label renderers, the layout eventually displays correctly, but the control flashes blank briefly first).

This change eliminates the unnecessary re-binding to null and avoids the race condition.

Issues Resolved

API Changes

None

Platforms Affected

  • Android

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

Manual test 6889 in Control Gallery

PR Checklist

  • Has automated tests
  • Rebased on top of the target branch at time of PR
  • Changes adhere to coding standard

@hartez
Copy link
Contributor Author

hartez commented Sep 9, 2019

Failed tests are the known CarouselView test failures - unrelated to this PR.

@rmarinho rmarinho merged commit bfd915d into 4.3.0 Sep 11, 2019
@samhouts samhouts added this to the 4.3.0 milestone Sep 18, 2019
felipebaltazar pushed a commit to felipebaltazar/Xamarin.Forms that referenced this pull request Oct 16, 2019
felipebaltazar pushed a commit to felipebaltazar/Xamarin.Forms that referenced this pull request Oct 16, 2019
@hartez hartez deleted the fix-gh6889 branch October 23, 2019 14:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants