Skip to content

Commit 014d520

Browse files
committed
fix(bottom-navigation): prevent error on “home”
1 parent 1983d7b commit 014d520

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bottom-navigation/index.android.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ export class BottomNavigation extends TabNavigationBase {
452452
for (let i = 0; i < fragments.length; i++) {
453453
this.removeFragment(fragments[i]);
454454
}
455+
this._currentFragment = null;
455456
this.fragments = [];
456457
}
457458
private attachFragment(fragment: androidx.fragment.app.Fragment, id?: number, name?: string): void {
@@ -492,7 +493,7 @@ export class BottomNavigation extends TabNavigationBase {
492493
public changeTab(index: number) {
493494
// index is -1 when there are no items
494495
// bot nav is not attached if you change the tab too early
495-
if (index === -1 || !this._attachedToWindow) {
496+
if (index === -1 || (this._currentFragment && index === this.selectedIndex) || !this._attachedToWindow) {
496497
return;
497498
}
498499

0 commit comments

Comments
 (0)