xamarin/Xamarin.Forms

[iOS] ViewCell ForceUpdateSize causing flickering on first click

Open

#5,431 opened on Mar 2, 2019

 (2 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
e/4 :clock4:help wantedinactivep/iOS 🍎t/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

Triggering ViewCell.ForceUpdateSize() causes the cell to grow and then immediately shrink back down to its original size on the first click. The second click expands the cell to the correct size as expected.

In the production application that I first noticed this issue, the cell has more content and the "grow then shrink" process takes at least 4 calls to ViewCell.ForceUpdateSize() before it stays expanded so this issue is worse in certain cases. While messing with the layout of the production app, at one point the cell never stayed expanded no matter how many times ViewCell.ForceUpdateSize() was called.

When setting ListViewCachingStrategy to RetainElement, the problem goes away.

Steps to Reproduce

  1. Run the attached project
  2. Click the Display & Force Update Size button one time
  3. See the cell expand and then immediately shrink back down
  4. Click again and see the cell stay expanded

Expected Behavior

Cell stays expanded after the first click.

Actual Behavior

Cell expands and then contracts immediately.

Basic Information

  • Version with issue (only ones I tested):
    • Xamarin.Forms 3.4.0.1008975
    • Xamarin.Forms 3.4.0.1029999
    • Xamarin.Forms 3.5.0.169047
    • Xamarin.Forms 3.6.0.169048-pre2
    • Xamarin.Forms 4.0.0.169.046-pre5
  • Last known good version:
    • Unknown
  • IDE:
    • Visual Studio 2017 (in Windows)
  • Platform Target Frameworks:
    • iOS: 12.1
  • Affected Devices:
    • Tested on iPhone 4, iOS 9 simulator and iPhone 5s, iOS 12.1 simulator

Reproduction Link

App1.zip

Workaround

Set ListViewCachingStrategy to RetainElement or try this SO Answer

Contributor guide