fix(android): nested frames on app suspend/resume (#6339)

This commit is contained in:
Manol Donev
2018-10-04 14:31:57 +03:00
committed by GitHub
parent 2e3c0a812a
commit 0bf6dc2e93

View File

@ -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);
}