Open DoloreMentale opened 2 years ago
Thanks for the issue! This issue has been labeled as needs reproduction
. This label is added to issues that need a code reproduction.
Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.
If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.
For a guide on how to create a good reproduction, see our Contributing Guide.
Reproduction can be found here: https://github.com/DoloreMentale/ion-tabs-bug-reproduction
Besides that, the problem seems to be quite usual. I discovered that the issue is with wrapper component for ion-tab-button. Although the component is rendered without any additional tags, something that gets buttons inside ion-tab-bar cannot do that.
Steps for recreation are the same:
Thanks. The problem here is that we expect the IonTabBar
to pass _getTabState
to child IonTabButton
elements: https://github.com/ionic-team/ionic-framework/blob/9b244dd3f01e2a79f4374b5de5304ba4f2035ddd/packages/vue/src/components/IonTabBar.ts#L61-L74
Since IonTabButton
is wrapped in a custom Vue component and not a direct child, this function is not passed down. As a result, the click handler throws an error because it is missing required data. As a temporary workaround, you can update your app to ensure that IonTabButton
is always a direct child of IonTabBar
.
@liamdebeasi thanks for your reply!
Thanks. The problem here is that we expect the
IonTabBar
to pass_getTabState
to childIonTabButton
elements:Since
IonTabButton
is wrapped in a custom Vue component and not a direct child, this function is not passed down. As a result, the click handler throws an error because it is missing required data. As a temporary workaround, you can update your app to ensure thatIonTabButton
is always a direct child ofIonTabBar
.
It would be really nice if this were stated in the docs. Spent a half an hour trying to figure out why I was getting this error.
Prerequisites
Ionic Framework Version
Current Behavior
All ion-tab-buttons in my case are rendered using v-for. tabState.activeTab and tabState.tabs are empty.
Found similar issue, seems it has been fixed in previos version, but problem still appears: https://github.com/ionic-team/ionic-framework/issues/22847
ion-tab-button click causes an error:
Expected Behavior
ion-tab-button click should push to another route
Steps to Reproduce
Just use v-for on ion-tab-button
ion-tabs:
ion-tab-button:
Code Reproduction URL
https://github.com/DoloreMentale/ion-tabs-bug-reproduction
Ionic Info
Ionic:
Ionic CLI : 6.19.0 (C:\nvm\v16.14.0\node_modules\@ionic\cli) Ionic Framework : @ionic/vue 6.2.6
Capacitor:
Capacitor CLI : 4.2.0 @capacitor/android : not installed @capacitor/core : 4.2.0 @capacitor/ios : not installed
Utility:
cordova-res : not installed globally native-run : 1.7.0
System:
NodeJS : v16.14.0 (C:\Program Files\nodejs\node.exe) npm : 8.7.0 OS : Windows 10
Additional Information
No response