fix(bottom-navigation): fragment handling (#9244)

This commit is contained in:
Igor Randjelovic
2021-02-25 02:35:16 +01:00
committed by GitHub
parent e7951b320f
commit c8ef6f2ab3

View File

@@ -540,7 +540,9 @@ export class BottomNavigation extends TabNavigationBase {
if (fragment != null) {
fragment.setMenuVisibility(true);
fragment.setUserVisibleHint(true);
// commenting out as it fixes rare crash when going
// back from deeply nested/modally shown fragments
// fragment.setUserVisibleHint(true);
}
this._currentFragment = fragment;
@@ -581,8 +583,8 @@ export class BottomNavigation extends TabNavigationBase {
fragmentExitTransition.setResetOnTransitionEnd(true);
}
if (fragment && fragment.isAdded() && !fragment.isRemoving()) {
const pfm = (<any>fragment).getParentFragmentManager ? (<any>fragment).getParentFragmentManager() : null;
if (pfm && !pfm.isDestroyed()) {
const pfm = (<any>fragment).getParentFragmentManager ? (<any>fragment).getParentFragmentManager() : fragmentManager;
if (pfm) {
try {
if (pfm.isStateSaved()) {
pfm.beginTransaction().remove(fragment).commitNowAllowingStateLoss();