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

fix(android): nested frames on app suspend/resume (#6339) · NativeScript/NativeScript@0bf6dc2 · GitHub

Commit 0bf6dc2

Browse files
authored
fix(android): nested frames on app suspend/resume (#6339)
1 parent 2e3c0a8 commit 0bf6dc2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,17 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
755755
if (traceEnabled()) {
756756
traceWrite(`${fragment}.onDestroyView()`, traceCategories.NativeLifecycle);
757757
}
758+
759+
// fixes 'java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first'.
760+
// on app resume in nested frame scenarios with support library version greater than 26.0.0
761+
const view = fragment.getView();
762+
if (view != null) {
763+
const viewParent = view.getParent();
764+
if (viewParent instanceof android.view.ViewGroup) {
765+
viewParent.removeView(view);
766+
}
767+
}
768+
758769
superFunc.call(fragment);
759770
}
760771

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL