@ionic/react 9.0.7-dev.11791305593.188c8151 → 9.0.7-dev.11791381676.118a7a15
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 +17 -1
- package/dist/index.js.map +1 -1
- package/dist/types/routing/NavManager.d.ts +6 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3416,8 +3416,24 @@ class NavManager extends React.PureComponent {
|
|
|
3416
3416
|
getStackManager() {
|
|
3417
3417
|
return this.props.stackManager;
|
|
3418
3418
|
}
|
|
3419
|
+
/**
|
|
3420
|
+
* Rebuilt only when routeInfo changes, since state never changes after the
|
|
3421
|
+
* constructor, so consumers in hidden pages don't re-render on every render.
|
|
3422
|
+
*/
|
|
3423
|
+
contextValues;
|
|
3424
|
+
getContextValues() {
|
|
3425
|
+
const { routeInfo } = this.props;
|
|
3426
|
+
if (this.contextValues?.navContext.routeInfo !== routeInfo) {
|
|
3427
|
+
this.contextValues = {
|
|
3428
|
+
navContext: { ...this.state, routeInfo },
|
|
3429
|
+
ionRouterContext: { ...this.ionRouterContextValue, routeInfo },
|
|
3430
|
+
};
|
|
3431
|
+
}
|
|
3432
|
+
return this.contextValues;
|
|
3433
|
+
}
|
|
3419
3434
|
render() {
|
|
3420
|
-
|
|
3435
|
+
const { navContext, ionRouterContext } = this.getContextValues();
|
|
3436
|
+
return (jsx(NavContext.Provider, { value: navContext, children: jsx(IonRouterContext.Provider, { value: ionRouterContext, children: this.props.children }) }));
|
|
3421
3437
|
}
|
|
3422
3438
|
}
|
|
3423
3439
|
|