From d1c7eacaace3daeef4d4453b8652224c6465b902 Mon Sep 17 00:00:00 2001 From: Rossen Hristov Date: Tue, 7 Jun 2016 11:50:35 +0300 Subject: [PATCH] Fixed: Exit transition on API Level 23 with cachePagesOnNavigate=true When we are on API Level 23 and we have cachePagesOnNavigate=true, the exit transition of the current (disappearing) page ends immediately after its start, which in turn removes the page UI from the fragment and leaves a white spot in place of the current page while the enter transition of the new page is being played. Related to #2225 --- tns-core-modules/ui/transition/transition.android.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tns-core-modules/ui/transition/transition.android.ts b/tns-core-modules/ui/transition/transition.android.ts index f0c51a867..11db4a5d2 100644 --- a/tns-core-modules/ui/transition/transition.android.ts +++ b/tns-core-modules/ui/transition/transition.android.ts @@ -1,5 +1,5 @@ import { Transition as definitionTransition } from "ui/transition"; -import { NavigationTransition, BackstackEntry } from "ui/frame"; +import { NavigationTransition, BackstackEntry, topmost } from "ui/frame"; import { Page} from "ui/page"; import { getClass } from "utils/types"; import { device } from "platform"; @@ -122,6 +122,15 @@ export function _setAndroidFragmentTransitions(navigationTransition: NavigationT } let useLollipopTransition = name && (name.indexOf("slide") === 0 || name === "fade" || name === "explode") && _sdkVersion() >= 21; + + // There is a problem when we have cachePagesOnNavigate on API Level 23 only. + // The exit transition of the current fragment ends immediately, the page UI is removed from the visual tree + // and a white spot is left in its place making the transition ugly. + // So we will use the "old" pre-Lollipop transitions in this particular case. + if (topmost().android.cachePagesOnNavigate && _sdkVersion() === 23){ + useLollipopTransition = false; + } + if (useLollipopTransition) { // setEnterTransition: Enter // setExitTransition: Exit