Skip to content

Commit 9e059e2

Browse files
Merge pull request #7359 from unoplatform/dev/djo/listview-android-fix-6
fix(listview): [Android] Fix crash when animating item
2 parents 9b88a52 + 7d05e4c commit 9e059e2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Uno.UI/UI/Xaml/Controls/ListViewBase/BufferViewCache.Android.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public override View GetViewForPositionAndType(RecyclerView.Recycler recycler, i
128128

129129
// Else get from intermediate cache if possible
130130
var view = GetViewFromIntermediateCache(recycler, position);
131+
131132
if (view != null)
132133
{
133134
Layout.TryAttachView(view);
@@ -471,6 +472,10 @@ void PrefetchExtra()
471472
if (!viewHolder.IsRecyclable)
472473
{
473474
// This typically means that the item is being animated. In this case we shouldn't stash it away for future use.
475+
476+
// Return the view to the recycler, otherwise it may subsequently cause an error
477+
recycler.RecycleView(view);
478+
474479
return null;
475480
}
476481

0 commit comments

Comments
 (0)