@ionic/react 8.7.12 → 8.7.13-dev.11765426479.16a61ecf
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 +14 -4
- package/dist/index.js.map +1 -1
- package/dist/types/components/IonRoute.d.ts +1 -2
- package/dist/types/components/IonRouterOutlet.d.ts +1 -0
- package/dist/types/routing/OutletPageManager.d.ts +1 -0
- package/dist/types/routing/RouteManagerContext.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1331,10 +1331,10 @@ class OutletPageManager extends React.Component {
|
|
|
1331
1331
|
this.ionLifeCycleContext.ionViewDidLeave();
|
|
1332
1332
|
}
|
|
1333
1333
|
render() {
|
|
1334
|
-
const { StackManager, children, routeInfo, ...props } = this.props;
|
|
1334
|
+
const { StackManager, children, routeInfo, id, ...props } = this.props;
|
|
1335
1335
|
return (jsx(IonLifeCycleContext.Consumer, { children: (context) => {
|
|
1336
1336
|
this.ionLifeCycleContext = context;
|
|
1337
|
-
return (jsx(StackManager, { routeInfo: routeInfo, children: jsx(IonRouterOutletInner, { setRef: (val) => (this.ionRouterOutlet = val), ...props, children: children }) }));
|
|
1337
|
+
return (jsx(StackManager, { routeInfo: routeInfo, id: id, children: jsx(IonRouterOutletInner, { setRef: (val) => (this.ionRouterOutlet = val), id: id, ...props, children: children }) }));
|
|
1338
1338
|
} }));
|
|
1339
1339
|
}
|
|
1340
1340
|
static get contextType() {
|
|
@@ -1345,11 +1345,13 @@ class OutletPageManager extends React.Component {
|
|
|
1345
1345
|
class IonRouterOutletContainer extends React.Component {
|
|
1346
1346
|
constructor(props) {
|
|
1347
1347
|
super(props);
|
|
1348
|
+
this.outletId = props.id ?? `routerOutlet-${generateId('routerOutlet')}`;
|
|
1348
1349
|
}
|
|
1349
1350
|
render() {
|
|
1350
1351
|
const StackManager = this.context.getStackManager();
|
|
1351
1352
|
const { children, forwardedRef, ...props } = this.props;
|
|
1352
|
-
|
|
1353
|
+
const outletId = props.id ?? this.outletId;
|
|
1354
|
+
return this.context.hasIonicRouter() ? (props.ionPage ? (jsx(OutletPageManager, { StackManager: StackManager, routeInfo: this.context.routeInfo, ...props, children: children })) : (jsx(StackManager, { routeInfo: this.context.routeInfo, id: outletId, children: jsx(IonRouterOutletInner, { ...props, id: outletId, forwardedRef: forwardedRef, children: children }) }))) : (jsx(IonRouterOutletInner, { ref: forwardedRef, ...this.props, children: this.props.children }));
|
|
1353
1355
|
}
|
|
1354
1356
|
static get contextType() {
|
|
1355
1357
|
return NavContext;
|
|
@@ -2228,6 +2230,7 @@ const RouteManagerContext = /*@__PURE__*/ React.createContext({
|
|
|
2228
2230
|
findLeavingViewItemByRouteInfo: () => undefined,
|
|
2229
2231
|
findViewItemByRouteInfo: () => undefined,
|
|
2230
2232
|
getChildrenToRender: () => undefined,
|
|
2233
|
+
getViewItemsForOutlet: () => [],
|
|
2231
2234
|
goBack: () => undefined,
|
|
2232
2235
|
unMountViewItem: () => undefined,
|
|
2233
2236
|
});
|
|
@@ -2346,7 +2349,14 @@ class LocationHistory {
|
|
|
2346
2349
|
_replace(routeInfo) {
|
|
2347
2350
|
const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
|
|
2348
2351
|
routeInfos && routeInfos.pop();
|
|
2349
|
-
|
|
2352
|
+
// Get the current route that's being replaced
|
|
2353
|
+
const currentRoute = this.locationHistory[this.locationHistory.length - 1];
|
|
2354
|
+
// Only pop from global history if we're replacing in the same outlet context.
|
|
2355
|
+
// Don't pop if we're entering a nested outlet (current route has no tab, new route has a tab)
|
|
2356
|
+
const isEnteringNestedOutlet = currentRoute && !currentRoute.tab && !!routeInfo.tab;
|
|
2357
|
+
if (!isEnteringNestedOutlet) {
|
|
2358
|
+
this.locationHistory.pop();
|
|
2359
|
+
}
|
|
2350
2360
|
this._add(routeInfo);
|
|
2351
2361
|
}
|
|
2352
2362
|
_clear() {
|