FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix-next(android): exit fragment animation · NativeScript/NativeScript@158621e · GitHub

Commit 158621e

Browse files
committed
fix-next(android): exit fragment animation
1 parent c8c0be7 commit 158621e

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎tns-core-modules/ui/frame/frame.android.ts‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -778,11 +778,17 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
778778

779779
// fixes 'java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first'.
780780
// on app resume in nested frame scenarios with support library version greater than 26.0.0
781-
const view = fragment.getView();
782-
if (view != null) {
783-
const viewParent = view.getParent();
784-
if (viewParent instanceof android.view.ViewGroup) {
785-
viewParent.removeView(view);
781+
// NOTE: ensure this is executed only for nested fragments as removing the view for top level fragments
782+
// would break exit animations e.g. for navigation with Flip transition the old(exiting) fragment disappears
783+
// immediately and one can see the flipping new fragment all the way from reverse side to front;
784+
// animating nested fragments is half-impossible at the moment either way -- see http://delyan.me/android-s-matryoshka-problem/
785+
if (fragment.getParentFragment()) {
786+
const view = fragment.getView();
787+
if (view != null) {
788+
const viewParent = view.getParent();
789+
if (viewParent instanceof android.view.ViewGroup) {
790+
viewParent.removeView(view);
791+
}
786792
}
787793
}
788794

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL