@@ -315,7 +315,6 @@ export class BottomNavigation extends TabNavigationBase {
315315
316316 public initNativeView ( ) : void {
317317 super . initNativeView ( ) ;
318-
319318 if ( this . _contentViewId < 0 ) {
320319 this . _contentViewId = android . view . View . generateViewId ( ) ;
321320 }
@@ -408,12 +407,7 @@ export class BottomNavigation extends TabNavigationBase {
408407 }
409408
410409 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 ) ;
417411 }
418412
419413 _onDetachedFromWindow ( ) : void {
@@ -469,7 +463,7 @@ export class BottomNavigation extends TabNavigationBase {
469463 }
470464 private attachFragment ( fragment : androidx . fragment . app . Fragment , id ?: number , name ?: string ) : void {
471465 //@ts -ignore
472- const fragmentManager = this . _getRootFragmentManager ( ) ;
466+ const fragmentManager = this . _getFragmentManager ( ) ;
473467 if ( fragment ) {
474468 if ( fragment . isAdded ( ) || fragment . isRemoving ( ) ) {
475469 // ignore
@@ -526,8 +520,7 @@ export class BottomNavigation extends TabNavigationBase {
526520 const name = makeFragmentName ( container . getId ( ) , position ) ;
527521
528522 //@ts -ignore
529- const fragmentManager = this . _getRootFragmentManager ( ) ;
530- console . log ( ) ;
523+ const fragmentManager = this . _getFragmentManager ( ) ;
531524 let fragment : androidx . fragment . app . Fragment = fragmentManager . findFragmentByTag ( name ) ;
532525 if ( fragment != null ) {
533526 this . attachFragment ( fragment ) ;
@@ -589,7 +582,7 @@ export class BottomNavigation extends TabNavigationBase {
589582 private hideFragment ( fragment : androidx . fragment . app . Fragment , fragmentManager ?: any ) {
590583 if ( ! fragmentManager ) {
591584 //@ts -ignore
592- fragmentManager = this . _getRootFragmentManager ( ) ;
585+ fragmentManager = this . _getFragmentManager ( ) ;
593586 }
594587 if ( fragment ) {
595588 if ( ! fragment . isAdded ( ) || fragment . isRemoving ( ) ) {
@@ -618,7 +611,7 @@ export class BottomNavigation extends TabNavigationBase {
618611 private showFragment ( fragment : androidx . fragment . app . Fragment , fragmentManager ?: any ) {
619612 if ( ! fragmentManager ) {
620613 //@ts -ignore
621- fragmentManager = this . _getRootFragmentManager ( ) ;
614+ fragmentManager = this . _getFragmentManager ( ) ;
622615 }
623616 if ( fragment ) {
624617 if ( ! fragment . isAdded ( ) || fragment . isRemoving ( ) ) {
@@ -647,7 +640,7 @@ export class BottomNavigation extends TabNavigationBase {
647640 private removeFragment ( fragment : androidx . fragment . app . Fragment , fragmentManager ?: any ) {
648641 if ( ! fragmentManager ) {
649642 //@ts -ignore
650- fragmentManager = this . _getRootFragmentManager ( ) ;
643+ fragmentManager = this . _getFragmentManager ( ) ;
651644 }
652645 if ( fragment ) {
653646 if ( ! fragment . isAdded ( ) || fragment . isRemoving ( ) ) {
0 commit comments