@ionic/react 8.2.8-dev.11724359497.19f21e81 → 8.2.8-dev.11724361569.1dd52246
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 +75 -15
- package/dist/index.js.map +1 -1
- package/dist/types/components/inner-proxies.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ import { defineCustomElement as defineCustomElement$y } from '@ionic/core/compon
|
|
|
40
40
|
import { defineCustomElement as defineCustomElement$z } from '@ionic/core/components/ion-menu.js';
|
|
41
41
|
import { defineCustomElement as defineCustomElement$A } from '@ionic/core/components/ion-menu-button.js';
|
|
42
42
|
import { defineCustomElement as defineCustomElement$B } from '@ionic/core/components/ion-menu-toggle.js';
|
|
43
|
-
import { defineCustomElement as defineCustomElement$
|
|
43
|
+
import { defineCustomElement as defineCustomElement$1i } from '@ionic/core/components/ion-nav.js';
|
|
44
44
|
import { defineCustomElement as defineCustomElement$C } from '@ionic/core/components/ion-nav-link.js';
|
|
45
45
|
import { defineCustomElement as defineCustomElement$D } from '@ionic/core/components/ion-note.js';
|
|
46
46
|
import { defineCustomElement as defineCustomElement$E } from '@ionic/core/components/ion-picker.js';
|
|
@@ -85,11 +85,12 @@ import { defineCustomElement as defineCustomElement$17 } from '@ionic/core/compo
|
|
|
85
85
|
import { defineCustomElement as defineCustomElement$18 } from '@ionic/core/components/ion-action-sheet.js';
|
|
86
86
|
import { defineCustomElement as defineCustomElement$19 } from '@ionic/core/components/ion-modal.js';
|
|
87
87
|
import { defineCustomElement as defineCustomElement$1a } from '@ionic/core/components/ion-popover.js';
|
|
88
|
-
import { defineCustomElement as defineCustomElement$
|
|
89
|
-
import { defineCustomElement as defineCustomElement$
|
|
88
|
+
import { defineCustomElement as defineCustomElement$1h } from '@ionic/core/components/ion-app.js';
|
|
89
|
+
import { defineCustomElement as defineCustomElement$1g } from '@ionic/core/components/ion-back-button.js';
|
|
90
90
|
import { defineCustomElement as defineCustomElement$1c } from '@ionic/core/components/ion-router-outlet.js';
|
|
91
91
|
import { defineCustomElement as defineCustomElement$1b } from '@ionic/core/components/ion-tab-bar.js';
|
|
92
92
|
import { defineCustomElement as defineCustomElement$1e } from '@ionic/core/components/ion-tab-button.js';
|
|
93
|
+
import { defineCustomElement as defineCustomElement$1f } from '@ionic/core/components/ion-tabs.js';
|
|
93
94
|
import { defineCustomElement as defineCustomElement$1d } from 'ionicons/components/ion-icon.js';
|
|
94
95
|
|
|
95
96
|
const IonLifeCycleContext = /*@__PURE__*/ React.createContext({
|
|
@@ -1074,9 +1075,10 @@ const IonOverlayManager = ({ onAddOverlay, onRemoveOverlay }) => {
|
|
|
1074
1075
|
|
|
1075
1076
|
const IonTabButtonInner = /*@__PURE__*/ createReactComponent('ion-tab-button', undefined, undefined, defineCustomElement$1e);
|
|
1076
1077
|
const IonTabBarInner = /*@__PURE__*/ createReactComponent('ion-tab-bar', undefined, undefined, defineCustomElement$1b);
|
|
1077
|
-
const
|
|
1078
|
+
const IonTabsInner = /*@__PURE__*/ createReactComponent('ion-tabs', undefined, undefined, defineCustomElement$1f);
|
|
1079
|
+
const IonBackButtonInner = /*@__PURE__*/ createReactComponent('ion-back-button', undefined, undefined, defineCustomElement$1g);
|
|
1078
1080
|
const IonRouterOutletInner = /*@__PURE__*/ createReactComponent('ion-router-outlet', undefined, undefined, defineCustomElement$1c);
|
|
1079
|
-
const IonAppInner = /*@__PURE__*/ createReactComponent('ion-app', undefined, undefined, defineCustomElement$
|
|
1081
|
+
const IonAppInner = /*@__PURE__*/ createReactComponent('ion-app', undefined, undefined, defineCustomElement$1h);
|
|
1080
1082
|
// ionicons
|
|
1081
1083
|
const IonIconInner = /*@__PURE__*/ createReactComponent('ion-icon', undefined, undefined, defineCustomElement$1d);
|
|
1082
1084
|
|
|
@@ -1239,7 +1241,7 @@ const ReactDelegate = (addView, removeView) => {
|
|
|
1239
1241
|
};
|
|
1240
1242
|
};
|
|
1241
1243
|
|
|
1242
|
-
const IonNavInner = createReactComponent('ion-nav', undefined, undefined, defineCustomElement$
|
|
1244
|
+
const IonNavInner = createReactComponent('ion-nav', undefined, undefined, defineCustomElement$1i);
|
|
1243
1245
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1244
1246
|
const IonNavInternal = (_a) => {
|
|
1245
1247
|
var { children, forwardedRef } = _a, restOfProps = __rest(_a, ["children", "forwardedRef"]);
|
|
@@ -1494,9 +1496,15 @@ class IonTabBarUnwrapped extends React.PureComponent {
|
|
|
1494
1496
|
};
|
|
1495
1497
|
}
|
|
1496
1498
|
onTabButtonClick(e, onClickFn) {
|
|
1499
|
+
var _a;
|
|
1497
1500
|
const tappedTab = this.state.tabs[e.detail.tab];
|
|
1498
1501
|
const originalHref = tappedTab.originalHref;
|
|
1499
|
-
|
|
1502
|
+
/**
|
|
1503
|
+
* If the router outlet is not defined, then the tabs is being used
|
|
1504
|
+
* as a basic tab navigation without the router. In this case, we
|
|
1505
|
+
* don't want to update the href else the URL will change.
|
|
1506
|
+
*/
|
|
1507
|
+
const currentHref = ((_a = this.props.routerOutletRef) === null || _a === void 0 ? void 0 : _a.current) ? e.detail.href : '';
|
|
1500
1508
|
const { activeTab: prevActiveTab } = this.state;
|
|
1501
1509
|
if (onClickFn) {
|
|
1502
1510
|
/**
|
|
@@ -1610,23 +1618,36 @@ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
|
|
|
1610
1618
|
render() {
|
|
1611
1619
|
let outlet;
|
|
1612
1620
|
let tabBar;
|
|
1621
|
+
// Check if IonTabs has any IonTab children
|
|
1622
|
+
let hasTab = false;
|
|
1613
1623
|
const _a = this.props, { className, onIonTabsDidChange, onIonTabsWillChange } = _a, props = __rest(_a, ["className", "onIonTabsDidChange", "onIonTabsWillChange"]);
|
|
1614
1624
|
const children = typeof this.props.children === 'function'
|
|
1615
1625
|
? this.props.children(this.ionTabContextState)
|
|
1616
1626
|
: this.props.children;
|
|
1627
|
+
const outletProps = {
|
|
1628
|
+
ref: this.routerOutletRef,
|
|
1629
|
+
};
|
|
1617
1630
|
React.Children.forEach(children, (child) => {
|
|
1618
1631
|
// eslint-disable-next-line no-prototype-builtins
|
|
1619
1632
|
if (child == null || typeof child !== 'object' || !child.hasOwnProperty('type')) {
|
|
1620
1633
|
return;
|
|
1621
1634
|
}
|
|
1622
1635
|
if (child.type === IonRouterOutlet || child.type.isRouterOutlet) {
|
|
1623
|
-
outlet = React.cloneElement(child);
|
|
1636
|
+
outlet = React.cloneElement(child, outletProps);
|
|
1624
1637
|
}
|
|
1625
1638
|
else if (child.type === Fragment && child.props.children[0].type === IonRouterOutlet) {
|
|
1626
|
-
outlet = child.props.children[0];
|
|
1639
|
+
outlet = React.cloneElement(child.props.children[0], outletProps);
|
|
1640
|
+
}
|
|
1641
|
+
else if (child.type === IonTab) {
|
|
1642
|
+
/**
|
|
1643
|
+
* This indicates that IonTabs will be using a basic tab-based navigation
|
|
1644
|
+
* without the history stack or URL updates associated with the router.
|
|
1645
|
+
*/
|
|
1646
|
+
hasTab = true;
|
|
1627
1647
|
}
|
|
1628
1648
|
let childProps = {
|
|
1629
1649
|
ref: this.tabBarRef,
|
|
1650
|
+
routerOutletRef: this.routerOutletRef,
|
|
1630
1651
|
};
|
|
1631
1652
|
/**
|
|
1632
1653
|
* Only pass these props
|
|
@@ -1649,17 +1670,56 @@ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
|
|
|
1649
1670
|
tabBar = React.cloneElement(child.props.children[1], childProps);
|
|
1650
1671
|
}
|
|
1651
1672
|
});
|
|
1652
|
-
if (!outlet) {
|
|
1653
|
-
throw new Error('IonTabs must contain an IonRouterOutlet');
|
|
1673
|
+
if (!outlet && !hasTab) {
|
|
1674
|
+
throw new Error('IonTabs must contain an IonRouterOutlet or an IonTab');
|
|
1675
|
+
}
|
|
1676
|
+
if (outlet && hasTab) {
|
|
1677
|
+
throw new Error('IonTabs cannot contain an IonRouterOutlet and an IonTab at the same time');
|
|
1654
1678
|
}
|
|
1655
1679
|
if (!tabBar) {
|
|
1656
1680
|
throw new Error('IonTabs needs a IonTabBar');
|
|
1657
1681
|
}
|
|
1682
|
+
if (hasTab) {
|
|
1683
|
+
return React.createElement(IonTabsInner, Object.assign({}, this.props));
|
|
1684
|
+
}
|
|
1685
|
+
/**
|
|
1686
|
+
* TODO(ROU-11051)
|
|
1687
|
+
*
|
|
1688
|
+
* There is no error handling for the case where there
|
|
1689
|
+
* is no associated Route for the given IonTabButton.
|
|
1690
|
+
*
|
|
1691
|
+
* More investigation is needed to determine how to
|
|
1692
|
+
* handle this to prevent any overwriting of the
|
|
1693
|
+
* IonTabButton's onClick handler and how the routing
|
|
1694
|
+
* is handled.
|
|
1695
|
+
*/
|
|
1658
1696
|
return (React.createElement(IonTabsContext.Provider, { value: this.ionTabContextState }, this.context.hasIonicRouter() ? (React.createElement(PageManager, Object.assign({ className: className ? `${className}` : '', routeInfo: this.context.routeInfo }, props),
|
|
1659
|
-
React.createElement(
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1697
|
+
React.createElement(IonTabsInner, Object.assign({}, this.props), React.Children.map(children, (child) => {
|
|
1698
|
+
if (React.isValidElement(child)) {
|
|
1699
|
+
const isTabBar = child.type === IonTabBar ||
|
|
1700
|
+
child.type.isTabBar ||
|
|
1701
|
+
(child.type === Fragment &&
|
|
1702
|
+
(child.props.children[1].type === IonTabBar || child.props.children[1].type.isTabBar));
|
|
1703
|
+
const isRouterOutlet = child.type === IonRouterOutlet ||
|
|
1704
|
+
child.type.isRouterOutlet ||
|
|
1705
|
+
(child.type === Fragment && child.props.children[0].type === IonRouterOutlet);
|
|
1706
|
+
if (isTabBar) {
|
|
1707
|
+
/**
|
|
1708
|
+
* The modified tabBar needs to be returned to include
|
|
1709
|
+
* the context and the overridden methods.
|
|
1710
|
+
*/
|
|
1711
|
+
return tabBar;
|
|
1712
|
+
}
|
|
1713
|
+
if (isRouterOutlet) {
|
|
1714
|
+
/**
|
|
1715
|
+
* The modified outlet needs to be returned to include
|
|
1716
|
+
* the ref.
|
|
1717
|
+
*/
|
|
1718
|
+
return outlet;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
return child;
|
|
1722
|
+
})))) : (React.createElement("div", Object.assign({ className: className ? `${className}` : 'ion-tabs' }, props, { style: hostStyles }),
|
|
1663
1723
|
tabBar.props.slot === 'top' ? tabBar : null,
|
|
1664
1724
|
React.createElement("div", { style: tabsInner, className: "tabs-inner" }, outlet),
|
|
1665
1725
|
tabBar.props.slot === 'bottom' ? tabBar : null))));
|