@ionic/react 8.7.13-dev.11765486444.14025098 → 8.7.13-dev.11765550444.1d97de23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1537,18 +1537,6 @@ class IonTabButton extends React.Component {
1537
1537
  }
1538
1538
 
1539
1539
  // TODO(FW-2959): types
1540
- /**
1541
- * Checks if pathname matches the tab's href using path segment matching.
1542
- * Avoids false matches like /home2 matching /home by requiring exact match
1543
- * or a path segment boundary (/).
1544
- */
1545
- const matchesTab = (pathname, href) => {
1546
- if (href === undefined) {
1547
- return false;
1548
- }
1549
- const normalizedHref = href.endsWith('/') && href !== '/' ? href.slice(0, -1) : href;
1550
- return pathname === normalizedHref || pathname.startsWith(normalizedHref + '/');
1551
- };
1552
1540
  class IonTabBarUnwrapped extends React.PureComponent {
1553
1541
  constructor(props) {
1554
1542
  super(props);
@@ -1581,7 +1569,7 @@ class IonTabBarUnwrapped extends React.PureComponent {
1581
1569
  const tabKeys = Object.keys(tabs);
1582
1570
  const activeTab = tabKeys.find((key) => {
1583
1571
  const href = tabs[key].originalHref;
1584
- return matchesTab(this.props.routeInfo.pathname, href);
1572
+ return this.props.routeInfo.pathname.startsWith(href);
1585
1573
  });
1586
1574
  if (activeTab) {
1587
1575
  this.setState({
@@ -1614,7 +1602,7 @@ class IonTabBarUnwrapped extends React.PureComponent {
1614
1602
  const tabKeys = Object.keys(state.tabs);
1615
1603
  const activeTab = tabKeys.find((key) => {
1616
1604
  const href = state.tabs[key].originalHref;
1617
- return matchesTab(props.routeInfo.pathname, href);
1605
+ return props.routeInfo.pathname.startsWith(href);
1618
1606
  });
1619
1607
  // Check to see if the tab button href has changed, and if so, update it in the tabs state
1620
1608
  React.Children.forEach(props.children, (child) => {