mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
fix(bottom-navigation-android): crash when changing tab and suspending app (#8030)
This commit is contained in:

committed by
Manol Donev

parent
85b92b0136
commit
a61de80a35
@ -380,9 +380,7 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
this._bottomNavigationBar.setVisibility(android.view.View.GONE);
|
||||
}
|
||||
|
||||
if (this._attachedToWindow) {
|
||||
this.changeTab(this.selectedIndex);
|
||||
}
|
||||
this.changeTab(this.selectedIndex);
|
||||
}
|
||||
|
||||
_onAttachedToWindow(): void {
|
||||
@ -467,8 +465,9 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
// TODO: Should we extract adapter-like class?
|
||||
// TODO: Rename this?
|
||||
public changeTab(index: number) {
|
||||
// this is the case when there are no items
|
||||
if (index === -1) {
|
||||
// index is -1 when there are no items
|
||||
// bot nav is not attached if you change the tab too early
|
||||
if (index === -1 || !this._attachedToWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user