mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
fix(android): nested frames on app suspend/resume (#6339)
This commit is contained in:
@ -755,6 +755,17 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${fragment}.onDestroyView()`, traceCategories.NativeLifecycle);
|
||||
}
|
||||
|
||||
// fixes 'java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first'.
|
||||
// on app resume in nested frame scenarios with support library version greater than 26.0.0
|
||||
const view = fragment.getView();
|
||||
if (view != null) {
|
||||
const viewParent = view.getParent();
|
||||
if (viewParent instanceof android.view.ViewGroup) {
|
||||
viewParent.removeView(view);
|
||||
}
|
||||
}
|
||||
|
||||
superFunc.call(fragment);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user