xamarin/Xamarin.Forms

[iOS] ListView cell layout broken after inserting new cells

开放

#4,278 创建于 2018年11月1日

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

仓库指标

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

描述

Description

After inserting new cells to beginning of source list, cells are displayed incorrectly. Some cells have white background (first screenshot) instead of content, some cells merged in one with gray background (second screenshot) without space between them.

Additionally, tap on this incorrect cells causes NRE with following stacktrace:

  at Xamarin.Forms.Platform.iOS.ContextActionsCell.get_ScrollDelegate () [0x00000] in <22793afa32544bc9bd4626e57194b3f0>:0 
  at Xamarin.Forms.Platform.iOS.ContextActionsCell.PrepareForDeselect () [0x00000] in <22793afa32544bc9bd4626e57194b3f0>:0 
  at Xamarin.Forms.Platform.iOS.ListViewRenderer+ListViewDataSource.OnItemSelected (System.Object sender, Xamarin.Forms.SelectedItemChangedEventArgs eventArg) [0x00068] in <22793afa32544bc9bd4626e57194b3f0>:0 
  at (wrapper delegate-invoke) System.EventHandler`1[Xamarin.Forms.SelectedItemChangedEventArgs].invoke_void_object_TEventArgs(object,Xamarin.Forms.SelectedItemChangedEventArgs)
  at Xamarin.Forms.ListView.OnSelectedItemChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\ListView.cs:580 
  at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:625 
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00181] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:425 
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:362 
  at Xamarin.Forms.ListView.NotifyRowTapped (System.Int32 groupIndex, System.Int32 inGroupIndex, Xamarin.Forms.Cell cell) [0x0004c] in D:\a\1\s\Xamarin.Forms.Core\ListView.cs:420 
  at Xamarin.Forms.Platform.iOS.ListViewRenderer+ListViewDataSource.RowSelected (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath) [0x0006f] in <22793afa32544bc9bd4626e57194b3f0>:0 
  at Xamarin.Forms.Platform.iOS.ContextActionsCell+SelectGestureRecognizer.Tapped (UIKit.UIGestureRecognizer recognizer) [0x00044] in <22793afa32544bc9bd4626e57194b3f0>:0 
  at UIKit.UITapGestureRecognizer+Callback.Activated (UIKit.UITapGestureRecognizer sender) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIGestureRecognizer.cs:205 
--- End of stack trace from previous location where exception was thrown ---
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:63 
  at Xf.Sandbox.iOS.Application.Main (System.String[] args) [0x00001] in /Users/gamer/Projects/Xf.Sandbox/Xf.Sandbox.iOS/Main.cs:17 

Steps to Reproduce

  1. Run sample
  2. Tap "attach" toolbar item
  3. Scroll list to top
  4. After scroll reaches top 10 elements, new items are inserted to list. Some cells are displayed incorrectly
  5. Tap on one of incorrectly displayed cells to cause NRE

Expected Behavior

Correctly displayed text and no exception on tap

Actual Behavior

Some cells displayed only partly, tap on them causes NRE

Basic Information

  • Version with issue: 3.3.0.912540

  • Last known good version: N/A

  • IDE: VS 15.8.5

  • Platform Target Frameworks:

    • iOS: 11.4, 12.0
  • Affected Devices: iPhone/iPad

Screenshots

simulator screen shot - iphone x - 2018-11-01 at 12 24 00 simulator screen shot - iphone x - 2018-11-01 at 12 36 40

Reproduction Link

Xf.Sandbox.zip

贡献者指南