Skip to content

Commit

Permalink
fix(droid): issues when navigating back
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Mar 22, 2021
1 parent e284d44 commit 0f8a4c9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Uno.UI/NativeFramePresenter.Android.cs
Expand Up @@ -144,10 +144,32 @@ private async Task UpdateStack(PageStackEntry entry, NavigationEventArgs e)
await oldPage.AnimateAsync(GetExitAnimation());
oldPage.ClearAnimation();
}

if (oldPage != null)
{
_pageStack.Children.Remove(oldPage);
}

if (!FeatureConfiguration.NativeFramePresenter.AndroidUnloadInactivePages)
{
for (var pageIndex = _pageStack.Children.Count-1; pageIndex >= 0; pageIndex--)
{
var page = _pageStack.Children[pageIndex];
if (page == newPage)
{
break;
}

_pageStack.Children.Remove(page);
}

//In case we cleared the whole stack. This should never happen
if (_pageStack.Children.Count == 0)
{
_pageStack.Children.Insert(0, newPage);
}
}

break;
}

Expand Down

0 comments on commit 0f8a4c9

Please sign in to comment.