Skip to content

fix(tab-bar): fire tab change events on tab click#31262

Merged
ShaneK merged 3 commits into
ionic-team:mainfrom
droc101:30145
Jul 13, 2026
Merged

fix(tab-bar): fire tab change events on tab click#31262
ShaneK merged 3 commits into
ionic-team:mainfrom
droc101:30145

Conversation

@droc101

@droc101 droc101 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Issue number: resolves #30145


What is the current behavior?

ionic-react's IonTabBar tries to reference this.props.onIonTabsWillChange and this.props.onIonTabsDidChange, which do not exist, causing the onIonTabsWillChange and onIonTabsDidChange events to never fire.

What is the new behavior?

  • Update usage of this.props.onIonTabsWillChange to this.props.tabsContext.tabBarProps.onIonTabsWillChange
  • Update usage of this.props.onIonTabsDidChange to this.props.tabsContext.tabBarProps.onIonTabsDidChange
  • Add check to make sure this.props.tabsContext is truthy before using it
  • onIonTabsWillChange and onIonTabsDidChange fire as expected

Does this introduce a breaking change?

  • Yes
  • No

…DidChange in onTabButtonClick

change incorrect references `this.props.onIonTabs[Did/Will]Change` to `this.props.tabsContext.tabBarProps.onIonTabs[Did/Will]Change` inside React IonTabBar onTabButtonClick

closes ionic-team#30145
@droc101 droc101 requested a review from a team as a code owner July 10, 2026 19:06
@droc101 droc101 requested a review from brandyscarney July 10, 2026 19:06
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

@droc101 is attempting to deploy a commit to the Ionic Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the package: react @ionic/react package label Jul 10, 2026

@ShaneK ShaneK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking good, just a change request and test request

Comment thread packages/react/src/components/navigation/IonTabBar.tsx
Comment thread packages/react/src/components/navigation/IonTabBar.tsx
@ShaneK ShaneK changed the title fix(IonTabBar): correctly reference onIonTabsWillChange and onIonTabsDidChange in onTabButtonClick fix(tab-bar): fire tab change events on tab click Jul 10, 2026
@droc101 droc101 requested a review from ShaneK July 13, 2026 18:29
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Jul 13, 2026 7:53pm

Request Review

@ShaneK ShaneK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me! Awesome work 🎉

@ShaneK ShaneK added this pull request to the merge queue Jul 13, 2026
Merged via the queue into ionic-team:main with commit 44461dd Jul 13, 2026
49 of 50 checks passed
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.

bug: ionTabsDidChange event not triggering in Ionic 8 (React)

2 participants