mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +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()) {
|
if (traceEnabled()) {
|
||||||
traceWrite(`${fragment}.onDestroyView()`, traceCategories.NativeLifecycle);
|
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);
|
superFunc.call(fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user