[iOS] ViewCell ForceUpdateSize causing flickering on first click
#5,431 opened on 2019/03/02
Repository metrics
- Stars
- (5,644 個のスター)
- PR merge metrics
- (30d に merged 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
- Run the attached project
- Click the Display & Force Update Size button one time
- See the cell expand and then immediately shrink back down
- 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
Workaround
Set ListViewCachingStrategy to RetainElement or try this SO Answer