Skip to content

bug: ion-tab-bar slot not working with Angular binding #19484

Closed

Description

@soramister

Bug Report

Ionic version:

[x] 4.5.0

Current behavior:

When assigning a variable to position the tab bar to top or bottom, the tab bar does not position correctly

Expected behavior:

For example, setting the slot position to top from a variable in a component, the tab bar should be on the top.

Steps to reproduce:

<ion-tab-bar [slot]="tabSlotPosition"> in the template and tabSlotPosition set to 'top' in the component.

Related code:

Other information:

If I set the value hard coded in the code, it works normally. For example:

Ionic info:

Ionic:

Ionic CLI : 5.4.1 (/Users/jeremie/.nvm/versions/node/v11.1.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.5.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1

Cordova:

Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 14 other plugins)

Utility:

cordova-res : 0.3.0 (update available: 0.6.0)
native-run : 0.2.6 (update available: 0.2.8)

System:

Android SDK Tools : 26.1.1 (/Users/jeremie/Library/Android/sdk)
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v11.1.0 (/Users/jeremie/.nvm/versions/node/v11.1.0/bin/node)
npm : 6.10.3
OS : macOS Mojave
Xcode : Xcode 11.0 Build version 11A420a

Activity

  1. changed the title [-]bug: [/-] [+]Tab bar slot position does not work with a variable[/+] on Sep 28, 2019
  2. changed the title [-]Tab bar slot position does not work with a variable[/-] [+]bug: Tab bar slot position does not work with a variable[/+] on Sep 28, 2019
  3. changed the title [-]bug: Tab bar slot position does not work with a variable[/-] [+]bug: ion-tab-bar slot not working with Angular binding[/+] on Oct 2, 2019
  4. added
    package: angular
    type: bug
    on Oct 2, 2019
  5. Muji86 commented on Apr 28, 2020

    @Muji86

    Was there a solution to this?

  6. jsandler18 commented on May 18, 2020

    @jsandler18

    +1 I am also experiencing this issue.

  7. phiamo commented on Jun 26, 2020

    @phiamo

    same issue here

  8. razfriman commented on Jul 11, 2020

    @razfriman

    Same

  9. arramanenka commented on Sep 10, 2020

    @arramanenka

    Same

  10. Ross-Rawlins commented on Nov 16, 2020

    @Ross-Rawlins

    Same

  11. gr99t commented on Feb 16, 2021

    @gr99t

    Still an issue in 5.5.4

    As a workaround I am binding a CSS class to the ion-tab-bar:

    <ion-tab-bar [class.top-bar]="isTop" [slot]="isTop ? 'top' : 'bottom'">

    CSS:

    .top-bar {
       position: absolute;
       left: 0;
       right: 0;
    }
  12. Blamax commented on Feb 21, 2021

    @Blamax

    Still an issue in 5.5.4

    As a workaround I am binding a CSS class to the ion-tab-bar:

    <ion-tab-bar [class.top-bar]="isTop" [slot]="isTop ? 'top' : 'bottom'">
    

    CSS:

    .top-bar {
       position: absolute;
       left: 0;
       right: 0;
    }

    unfortunately, this messes with other bars due to absolute positioning.

  13. juanAFernandez commented on Jul 29, 2021

    @juanAFernandez

    Same problem. A simple nasty workaround, duplicate the code (one with bottom and the other one with top and add a *ngIf.

  14. Saqib92 commented on Aug 16, 2021

    @Saqib92

    Still facing this issue.

  15. Abrarss commented on Nov 24, 2021

    @Abrarss

    still facing the same issue

  16. gongAll commented on Dec 27, 2021

    @gongAll

    a lot of people are commenting this issue.

    PLEASE bump it instead of commenting it so that it goes up on the priority list.

    Cheers.

  17. EarlTilluck commented on Mar 13, 2022

    @EarlTilluck

    The reason binding doesn't work:
    Basically the <ion-tabs> element is a flexbox with flex-direction: column,
    Inside this, there are two elements: the <ion-tab-bar> and a div with the class tabs-inner
    If slot="top" is set, then the tab-bar will be placed first inside the ion-tabs with the tabs-inner div below it, and vica versa for slot="bottom".
    When you change the value of slot, nothing happens, the elements remain in the same order in the document.

    My workaround:

    when you want the tab-bar at the top, change the css order value
    to -1

    css:

    .top-menu {
      // this tells the flex container to place this item first
      order: -1;
    }
    

    html

    <ion-tab-bar slot="bottom" [ngClass]=" condition? 'top-menu' : '' ">
    

    This method keeps the original design format and should not lead to conflicts elsewhere.

  18. gog1withme commented on Jul 3, 2022

    @gog1withme

    It may not be relevant to others, but still posting it here. This may help someone.

    I generated my ionic solution using aws-amplify and after spending few hours I found that "~@aws-amplify/ui-angular/theme.css" is causing the issue with slot 'bottom' ().

    After removing the theme ui-angular/theme.css import everthig works fine.

    Note: If some of your app components are using the style from "~@aws-amplify/ui-angular/theme.css" then you may need to apply some custom CSS on them.

  19. added
    type: bug
    and removed
    type: bug
    on Apr 21, 2023
  20. sean-perkins commented on Jun 1, 2023

    @sean-perkins
    Contributor

    Hello everyone 👋

    Here is a dev-build to experiment with, if anyone would like to test:

    npm install @ionic/[email protected]
    
  21. added a commit that references this issue on Jun 7, 2023
    d20bea5
  22. liamdebeasi commented on Jun 7, 2023

    @liamdebeasi
    Contributor

    Thanks for the report. This has been resolved via #27582, and a fix will be available in an upcoming minor release of Ionic Framework.

  23. ionitron-bot commented on Jul 7, 2023

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  24. locked and limited conversation to collaborators on Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: angulartype: bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions