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

fix(android): nested frames on app suspend/resume · NativeScript/NativeScript@f2f9d81 · GitHub

Commit f2f9d81

Browse files
committed
fix(android): nested frames on app suspend/resume
1 parent e685d2e commit f2f9d81

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
@@ -775,6 +775,17 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
775775
if (traceEnabled()) {
776776
traceWrite(`${fragment}.onDestroyView()`, traceCategories.NativeLifecycle);
777777
}
778+
779+
// fixes 'java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first'.
780+
// 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);
786+
}
787+
}
788+
778789
superFunc.call(fragment);
779790
}
780791

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL