@ionic/react 8.2.8-dev.11724252750.181edeb4 → 8.2.8-dev.11724280606.1a8c11d4
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 +70 -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,10 @@ 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
|
-
const currentHref = e.detail.href;
|
|
1502
|
+
const currentHref = ((_a = this.props.routerOutletRef) === null || _a === void 0 ? void 0 : _a.current) ? e.detail.href : '';
|
|
1500
1503
|
const { activeTab: prevActiveTab } = this.state;
|
|
1501
1504
|
if (onClickFn) {
|
|
1502
1505
|
/**
|
|
@@ -1610,23 +1613,36 @@ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
|
|
|
1610
1613
|
render() {
|
|
1611
1614
|
let outlet;
|
|
1612
1615
|
let tabBar;
|
|
1616
|
+
// Check if IonTabs has any IonTab children
|
|
1617
|
+
let hasTab = false;
|
|
1613
1618
|
const _a = this.props, { className, onIonTabsDidChange, onIonTabsWillChange } = _a, props = __rest(_a, ["className", "onIonTabsDidChange", "onIonTabsWillChange"]);
|
|
1614
1619
|
const children = typeof this.props.children === 'function'
|
|
1615
1620
|
? this.props.children(this.ionTabContextState)
|
|
1616
1621
|
: this.props.children;
|
|
1622
|
+
const outletProps = {
|
|
1623
|
+
ref: this.routerOutletRef,
|
|
1624
|
+
};
|
|
1617
1625
|
React.Children.forEach(children, (child) => {
|
|
1618
1626
|
// eslint-disable-next-line no-prototype-builtins
|
|
1619
1627
|
if (child == null || typeof child !== 'object' || !child.hasOwnProperty('type')) {
|
|
1620
1628
|
return;
|
|
1621
1629
|
}
|
|
1622
1630
|
if (child.type === IonRouterOutlet || child.type.isRouterOutlet) {
|
|
1623
|
-
outlet = React.cloneElement(child);
|
|
1631
|
+
outlet = React.cloneElement(child, outletProps);
|
|
1624
1632
|
}
|
|
1625
1633
|
else if (child.type === Fragment && child.props.children[0].type === IonRouterOutlet) {
|
|
1626
|
-
outlet = child.props.children[0];
|
|
1634
|
+
outlet = React.cloneElement(child.props.children[0], outletProps);
|
|
1635
|
+
}
|
|
1636
|
+
else if (child.type === IonTab) {
|
|
1637
|
+
/**
|
|
1638
|
+
* This indicates that IonTabs will be using a basic tab-based navigation
|
|
1639
|
+
* without the history stack or URL updates associated with the router.
|
|
1640
|
+
*/
|
|
1641
|
+
hasTab = true;
|
|
1627
1642
|
}
|
|
1628
1643
|
let childProps = {
|
|
1629
1644
|
ref: this.tabBarRef,
|
|
1645
|
+
routerOutletRef: this.routerOutletRef,
|
|
1630
1646
|
};
|
|
1631
1647
|
/**
|
|
1632
1648
|
* Only pass these props
|
|
@@ -1649,17 +1665,56 @@ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
|
|
|
1649
1665
|
tabBar = React.cloneElement(child.props.children[1], childProps);
|
|
1650
1666
|
}
|
|
1651
1667
|
});
|
|
1652
|
-
if (!outlet) {
|
|
1653
|
-
throw new Error('IonTabs must contain an IonRouterOutlet');
|
|
1668
|
+
if (!outlet && !hasTab) {
|
|
1669
|
+
throw new Error('IonTabs must contain an IonRouterOutlet or an IonTab');
|
|
1670
|
+
}
|
|
1671
|
+
if (outlet && hasTab) {
|
|
1672
|
+
throw new Error('IonTabs cannot contain an IonRouterOutlet and an IonTab at the same time');
|
|
1654
1673
|
}
|
|
1655
1674
|
if (!tabBar) {
|
|
1656
1675
|
throw new Error('IonTabs needs a IonTabBar');
|
|
1657
1676
|
}
|
|
1677
|
+
if (hasTab) {
|
|
1678
|
+
return React.createElement(IonTabsInner, Object.assign({}, this.props));
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* TODO(ROU-11051)
|
|
1682
|
+
*
|
|
1683
|
+
* There is no error handling for the case where there
|
|
1684
|
+
* is no associated Route for the given IonTabButton.
|
|
1685
|
+
*
|
|
1686
|
+
* More investigation is needed to determine how to
|
|
1687
|
+
* handle this to prevent any overwriting of the
|
|
1688
|
+
* IonTabButton's onClick handler and how the routing
|
|
1689
|
+
* is handled.
|
|
1690
|
+
*/
|
|
1658
1691
|
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
|
-
|
|
1692
|
+
React.createElement(IonTabsInner, Object.assign({}, this.props), React.Children.map(children, (child) => {
|
|
1693
|
+
if (React.isValidElement(child)) {
|
|
1694
|
+
const isTabBar = child.type === IonTabBar ||
|
|
1695
|
+
child.type.isTabBar ||
|
|
1696
|
+
(child.type === Fragment &&
|
|
1697
|
+
(child.props.children[1].type === IonTabBar || child.props.children[1].type.isTabBar));
|
|
1698
|
+
const isRouterOutlet = child.type === IonRouterOutlet ||
|
|
1699
|
+
child.type.isRouterOutlet ||
|
|
1700
|
+
(child.type === Fragment && child.props.children[0].type === IonRouterOutlet);
|
|
1701
|
+
if (isTabBar) {
|
|
1702
|
+
/**
|
|
1703
|
+
* The modified tabBar needs to be returned to include
|
|
1704
|
+
* the context and the overridden methods.
|
|
1705
|
+
*/
|
|
1706
|
+
return tabBar;
|
|
1707
|
+
}
|
|
1708
|
+
if (isRouterOutlet) {
|
|
1709
|
+
/**
|
|
1710
|
+
* The modified outlet needs to be returned to include
|
|
1711
|
+
* the ref.
|
|
1712
|
+
*/
|
|
1713
|
+
return outlet;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
return child;
|
|
1717
|
+
})))) : (React.createElement("div", Object.assign({ className: className ? `${className}` : 'ion-tabs' }, props, { style: hostStyles }),
|
|
1663
1718
|
tabBar.props.slot === 'top' ? tabBar : null,
|
|
1664
1719
|
React.createElement("div", { style: tabsInner, className: "tabs-inner" }, outlet),
|
|
1665
1720
|
tabBar.props.slot === 'bottom' ? tabBar : null))));
|