Skip to content

refactor(react): update tab-bar requirement on tabs #29868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

thetaPC
Copy link
Contributor

@thetaPC thetaPC commented Sep 12, 2024

Issue number: N/A


What is the current behavior?

As mentioned in this PR, React IonTabs requires IonTabBar do be a child, else it doesn't render and throws an error.

Angular, JS, and Vue doesn't have this requirement.

What is the new behavior?

I didn't see any reason why React does not mimic the other frameworks. In order to keep consistency, I've updated the React tabs. This would allow ion-tabs and ion-tab-bar can be used as standalone elements as mentioned in the docs.

  • React follows the same structure as the other frameworks: IonTabs doesn't require IonTabBar to be a child to render.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Dev build: 8.3.1-dev.11726159792.1a6f49de

How to test:

  1. Create a Ionic React app through the Ionic CLI with tabs as the starter
  2. Run the app
  3. Comment out the IonTabBar
  4. Notice that the IonTabs does not render
  5. Notice that there's an error in the console: "IonTabs needs a IonTabBar"
  6. Install the dev build: npm install @ionic/[email protected]
  7. Make sure the IonTabBar is still commented out
  8. Verify that IonTabs renders
  9. Verify that there isn't an error in the console

Copy link

vercel bot commented Sep 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2024 4:06pm

@github-actions github-actions bot added the package: react @ionic/react package label Sep 12, 2024
@thetaPC thetaPC marked this pull request as ready for review September 12, 2024 16:57
@thetaPC thetaPC requested a review from a team as a code owner September 12, 2024 16:57
@thetaPC thetaPC changed the title refactor(react): update tabbar requirement on tabs refactor(react): update tab-bar requirement on tabs Sep 12, 2024
Copy link
Contributor

@tanner-reits tanner-reits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Repro steps worked

@thetaPC thetaPC added this pull request to the merge queue Sep 12, 2024
Merged via the queue into main with commit ab7a0ab Sep 12, 2024
61 checks passed
@thetaPC thetaPC deleted the tabs-remove-requirement branch September 12, 2024 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: react @ionic/react package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants