diff --git a/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts b/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts index 6f133e4f9..ca25e1e9b 100644 --- a/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts +++ b/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts @@ -744,7 +744,12 @@ export class BottomNavigation extends TabNavigationBase { } public updateAndroidItemAt(index: number, spec: org.nativescript.widgets.TabItemSpec) { - this._bottomNavigationBar.updateItemAt(index, spec); + // this can throw when switching light/dark theme mode on device, just ignore + try { + this._bottomNavigationBar.updateItemAt(index, spec); + } catch (err) { + // ignore + } } public getTabBarBackgroundColor(): android.graphics.drawable.Drawable { @@ -825,13 +830,18 @@ export class BottomNavigation extends TabNavigationBase { } private setIconColor(tabStripItem: TabStripItem, color?: Color) { - const tabBarItem = this._bottomNavigationBar.getViewForItemAt(tabStripItem._index); + // this can throw when switching light/dark theme mode on device, just ignore + try { + const tabBarItem = this._bottomNavigationBar.getViewForItemAt(tabStripItem._index); - const drawableInfo = this.getIconInfo(tabStripItem, color); - const imgView = tabBarItem.getChildAt(0); - imgView.setImageDrawable(drawableInfo.drawable); - if (color) { - imgView.setColorFilter(color.android); + const drawableInfo = this.getIconInfo(tabStripItem, color); + const imgView = tabBarItem.getChildAt(0); + imgView.setImageDrawable(drawableInfo.drawable); + if (color) { + imgView.setColorFilter(color.android); + } + } catch (err) { + // ignore } }