- Notifications
You must be signed in to change notification settings - Fork 13.4k
Closed
Labels
package: react@ionic/react package@ionic/react packagetype: buga confirmed bug reporta confirmed bug report
Description
Bug Report
Ionic version:
[ ] 4.x
[x] 5.x React
Current behavior:
Conditionally rendering IonTabBar throws error.
Expected behavior:
As commented in the error caller, the error is unnecessary and should be removed.
Location: /IonTabs.tsx:100 if (!tabBar) { // TODO, this is not required throw new Error('IonTabs needs a IonTabBar'); }
Steps to reproduce:
- Create a project with IonTabs and React,
- Comment out the IonTabBar.
Related code:
Example conditional renderer:
const showTabNav = false; ... <IonTabs> <IonRouterOutlet> ... </IonRouterOutlet> {showTabNav && ( <IonTabBar slot="bottom"> <IonTabButton tab="tab1" href="/tab1"> <IonIcon icon={mapOutline} /> <IonLabel>Explore</IonLabel> </IonTabButton> <IonTabButton tab="tab2" href="/tab2"> <IonIcon icon={homeOutline} /> <IonLabel>Deals</IonLabel> </IonTabButton> <IonTabButton tab="tab3" href="/tab3"> <IonIcon icon={walletOutline} /> <IonLabel>Wallet</IonLabel> </IonTabButton> </IonTabBar> )} </IonTabs>
Other information:
N/A
Ionic info:
N/A
daviavmello, ptmkenny, maccman and electic
Metadata
Metadata
Assignees
Labels
package: react@ionic/react package@ionic/react packagetype: buga confirmed bug reporta confirmed bug report