mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +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,10 +380,8 @@ export class BottomNavigation extends TabNavigationBase {
|
|||||||
this._bottomNavigationBar.setVisibility(android.view.View.GONE);
|
this._bottomNavigationBar.setVisibility(android.view.View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._attachedToWindow) {
|
|
||||||
this.changeTab(this.selectedIndex);
|
this.changeTab(this.selectedIndex);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_onAttachedToWindow(): void {
|
_onAttachedToWindow(): void {
|
||||||
super._onAttachedToWindow();
|
super._onAttachedToWindow();
|
||||||
@ -467,8 +465,9 @@ export class BottomNavigation extends TabNavigationBase {
|
|||||||
// TODO: Should we extract adapter-like class?
|
// TODO: Should we extract adapter-like class?
|
||||||
// TODO: Rename this?
|
// TODO: Rename this?
|
||||||
public changeTab(index: number) {
|
public changeTab(index: number) {
|
||||||
// this is the case when there are no items
|
// index is -1 when there are no items
|
||||||
if (index === -1) {
|
// bot nav is not attached if you change the tab too early
|
||||||
|
if (index === -1 || !this._attachedToWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user