xamarin/Xamarin.Forms

[iOS] ViewCell ForceUpdateSize causing flickering on first click

开放

#5,431 创建于 2019年3月2日

 (2 条评论) (0 个反应) (0 位负责人)C# (1,926 个派生)batch import
e/4 :clock4:help wantedinactivep/iOS 🍎t/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南