Skip to content

Commit

Permalink
fix(FrameworkTemplatePool): Detach native view from parent when recyc…
Browse files Browse the repository at this point in the history
…ling
  • Loading branch information
ebariche committed Jan 9, 2024
1 parent 2c29bdf commit b0c96b3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Uno.UI/UI/Xaml/FrameworkTemplatePool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Font = Android.Graphics.Typeface;
using Android.Graphics;
using DependencyObject = System.Object;
using Uno.UI.Controls;
#elif __IOS__
using View = UIKit.UIView;
using ViewGroup = UIKit.UIView;
Expand Down Expand Up @@ -324,6 +325,13 @@ private void Recycle()
{
for (var x = 0; x < count; x++)
{
#if __ANDROID__
if (((View)array[x]).Parent is BindableView bindableView)
{
bindableView.RemoveView((View)array[x]);
}
#endif

array[x].SetParent(null);
}
}
Expand Down

0 comments on commit b0c96b3

Please sign in to comment.