diff --git a/packages/core/ui/bottom-navigation/index.android.ts b/packages/core/ui/bottom-navigation/index.android.ts index e9ca17cc8..759e0b3cc 100644 --- a/packages/core/ui/bottom-navigation/index.android.ts +++ b/packages/core/ui/bottom-navigation/index.android.ts @@ -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 = (fragment).getParentFragmentManager ? (fragment).getParentFragmentManager() : null; - if (pfm && !pfm.isDestroyed()) { + const pfm = (fragment).getParentFragmentManager ? (fragment).getParentFragmentManager() : fragmentManager; + if (pfm) { try { if (pfm.isStateSaved()) { pfm.beginTransaction().remove(fragment).commitNowAllowingStateLoss();