From cf63da608a340d16338c724dcba21ab80609ecbc Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Thu, 4 May 2017 10:39:39 +0300 Subject: [PATCH] =?UTF-8?q?If=20page.parent=20is=20already=20the=20same=20?= =?UTF-8?q?frame=20-=20don=E2=80=99t=20add=20page=20to=20frame.=20This=20h?= =?UTF-8?q?appens=20if=20activity=20is=20recreated.=20(#4096)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tns-core-modules/ui/frame/frame.android.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index db42771a0..4fddad67a 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -53,7 +53,11 @@ function onFragmentShown(fragment: android.app.Fragment) { const isBack = currentNavigationContext ? currentNavigationContext.isBackNavigation : false; - frame._addView(page); + // When cachePagesOnNavigate is true and activity is recreated + // we add pages to frame in fragment.onCreateView so no need to add them again. + if (page.parent !== frame) { + frame._addView(page); + } // onFragmentShown is called before NativeActivity.start where we call frame.onLoaded // We need to call frame.onLoaded() here so that the call to frame._addView(page) will emit the page.loaded event