Skip to content

Commit b3830fd

Browse files
committed
fix (bottom-navigation-bar): use startActivity instead of foregroundActivity for checking lifecycle
1 parent ae0c317 commit b3830fd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/bottom-navigation/index.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ export class BottomNavigation extends TabNavigationBase {
401401

402402
// _onAttachedToWindow called from OS again after it was detach
403403
// still happens with androidx.fragment:1.3.2
404-
const activity = Application.android.foregroundActivity;
404+
const activity = Application.android.startActivity;
405405
if ((this._manager && this._manager.isDestroyed()) || !activity.getLifecycle?.().getCurrentState().isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED)) {
406406
return;
407407
}

src/tabs/tabs.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ export class Tabs extends TabsBase {
512512

513513
// _onAttachedToWindow called from OS again after it was detach
514514
// still happens with androidx.fragment:1.3.2
515-
const activity = Application.android.foregroundActivity;
515+
const activity = Application.android.startActivity;
516516
if ((this._manager && this._manager.isDestroyed()) || !activity.getLifecycle?.().getCurrentState().isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED)) {
517517
return;
518518
}

0 commit comments

Comments
 (0)