@@ -315,7 +315,6 @@ export class BottomNavigation extends TabNavigationBase {
315
315
316
316
public initNativeView ( ) : void {
317
317
super . initNativeView ( ) ;
318
-
319
318
if ( this . _contentViewId < 0 ) {
320
319
this . _contentViewId = android . view . View . generateViewId ( ) ;
321
320
}
@@ -408,12 +407,7 @@ export class BottomNavigation extends TabNavigationBase {
408
407
}
409
408
410
409
this . _attachedToWindow = true ;
411
- // add a small delay or the getRootFragmentManager wont be the right one
412
- // when "opening" the bottomnavigation page.
413
- // this should be removed once we dont need to use the root fragmentmanager
414
- setTimeout ( ( ) => {
415
- this . changeTab ( this . selectedIndex ) ;
416
- } , 0 ) ;
410
+ this . changeTab ( this . selectedIndex ) ;
417
411
}
418
412
419
413
_onDetachedFromWindow ( ) : void {
@@ -469,7 +463,7 @@ export class BottomNavigation extends TabNavigationBase {
469
463
}
470
464
private attachFragment ( fragment : androidx . fragment . app . Fragment , id ?: number , name ?: string ) : void {
471
465
//@ts -ignore
472
- const fragmentManager = this . _getRootFragmentManager ( ) ;
466
+ const fragmentManager = this . _getFragmentManager ( ) ;
473
467
if ( fragment ) {
474
468
if ( fragment . isAdded ( ) || fragment . isRemoving ( ) ) {
475
469
// ignore
@@ -526,8 +520,7 @@ export class BottomNavigation extends TabNavigationBase {
526
520
const name = makeFragmentName ( container . getId ( ) , position ) ;
527
521
528
522
//@ts -ignore
529
- const fragmentManager = this . _getRootFragmentManager ( ) ;
530
- console . log ( ) ;
523
+ const fragmentManager = this . _getFragmentManager ( ) ;
531
524
let fragment : androidx . fragment . app . Fragment = fragmentManager . findFragmentByTag ( name ) ;
532
525
if ( fragment != null ) {
533
526
this . attachFragment ( fragment ) ;
@@ -589,7 +582,7 @@ export class BottomNavigation extends TabNavigationBase {
589
582
private hideFragment ( fragment : androidx . fragment . app . Fragment , fragmentManager ?: any ) {
590
583
if ( ! fragmentManager ) {
591
584
//@ts -ignore
592
- fragmentManager = this . _getRootFragmentManager ( ) ;
585
+ fragmentManager = this . _getFragmentManager ( ) ;
593
586
}
594
587
if ( fragment ) {
595
588
if ( ! fragment . isAdded ( ) || fragment . isRemoving ( ) ) {
@@ -618,7 +611,7 @@ export class BottomNavigation extends TabNavigationBase {
618
611
private showFragment ( fragment : androidx . fragment . app . Fragment , fragmentManager ?: any ) {
619
612
if ( ! fragmentManager ) {
620
613
//@ts -ignore
621
- fragmentManager = this . _getRootFragmentManager ( ) ;
614
+ fragmentManager = this . _getFragmentManager ( ) ;
622
615
}
623
616
if ( fragment ) {
624
617
if ( ! fragment . isAdded ( ) || fragment . isRemoving ( ) ) {
@@ -647,7 +640,7 @@ export class BottomNavigation extends TabNavigationBase {
647
640
private removeFragment ( fragment : androidx . fragment . app . Fragment , fragmentManager ?: any ) {
648
641
if ( ! fragmentManager ) {
649
642
//@ts -ignore
650
- fragmentManager = this . _getRootFragmentManager ( ) ;
643
+ fragmentManager = this . _getFragmentManager ( ) ;
651
644
}
652
645
if ( fragment ) {
653
646
if ( ! fragment . isAdded ( ) || fragment . isRemoving ( ) ) {
0 commit comments