Commit 44461dd
authored
fix(tab-bar): fire tab change events on tab click (#31262)
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?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
- 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
- [x] No1 parent 4f2ab73 commit 44461dd
2 files changed
Lines changed: 25 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
229 | 232 | | |
230 | | - | |
231 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
232 | 239 | | |
| 240 | + | |
233 | 241 | | |
234 | 242 | | |
235 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
86 | 97 | | |
87 | 98 | | |
0 commit comments