@ionic/react 9.0.15-dev.11796226497.1324df76 → 9.0.15-dev.11796247574.1ecbe59d
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 +3 -49
- package/dist/index.js.map +1 -1
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/navigation/IonTabs.d.ts +0 -9
- package/dist/types/routing/LocationHistory.d.ts +0 -5
- package/dist/types/routing/RouteManagerContext.d.ts +0 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import React, { useContext, useRef, useEffect, createElement, useState, useMemo, Fragment as Fragment$1, useCallback } from 'react';
|
|
3
3
|
import { getPlatforms as getPlatforms$1, isPlatform as isPlatform$1, componentOnReady, createAnimation, actionSheetController, alertController, toastController, modalController, popoverController, loadingController, initialize } from '@ionic/core/components';
|
|
4
|
-
export { IonicSafeString, IonicSlides, LogLevel, createAnimation, createGesture, getIonPageElement, getTimeGivenProgression, iosTransitionAnimation, mdTransitionAnimation, openURL } from '@ionic/core/components';
|
|
4
|
+
export { IonicSafeString, IonicSlides, LogLevel, componentOnReady, createAnimation, createGesture, getIonPageElement, getMode, getTimeGivenProgression, iosTransitionAnimation, mdTransitionAnimation, menuController, openURL, setNonce } from '@ionic/core/components';
|
|
5
5
|
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
6
6
|
import { defineCustomElement as defineCustomElement$2, IonAccordion as IonAccordion$1 } from '@ionic/core/components/ion-accordion.js';
|
|
7
7
|
import { defineCustomElement as defineCustomElement$3, IonAccordionGroup as IonAccordionGroup$1 } from '@ionic/core/components/ion-accordion-group.js';
|
|
@@ -2321,7 +2321,6 @@ class IonTabs extends React.Component {
|
|
|
2321
2321
|
routerOutletRef = React.createRef();
|
|
2322
2322
|
selectTabHandler;
|
|
2323
2323
|
tabBarRef = React.createRef();
|
|
2324
|
-
tabsElRef = React.createRef();
|
|
2325
2324
|
ionTabContextState = {
|
|
2326
2325
|
activeTab: undefined,
|
|
2327
2326
|
selectTab: () => false,
|
|
@@ -2338,12 +2337,7 @@ class IonTabs extends React.Component {
|
|
|
2338
2337
|
super(props);
|
|
2339
2338
|
}
|
|
2340
2339
|
componentDidMount() {
|
|
2341
|
-
|
|
2342
|
-
* Without a router outlet, the tab bar does not switch tabs,
|
|
2343
|
-
* so its `selectTab` and active tab must not replace the ones
|
|
2344
|
-
* set for `ion-tabs` in `render`.
|
|
2345
|
-
*/
|
|
2346
|
-
if (this.ionTabContextState.hasRouterOutlet && this.tabBarRef.current) {
|
|
2340
|
+
if (this.tabBarRef.current) {
|
|
2347
2341
|
// Grab initial value
|
|
2348
2342
|
this.ionTabContextState.activeTab = this.tabBarRef.current.state.activeTab;
|
|
2349
2343
|
// Override method
|
|
@@ -2353,31 +2347,6 @@ class IonTabs extends React.Component {
|
|
|
2353
2347
|
this.ionTabContextState.selectTab = this.tabBarRef.current.selectTab;
|
|
2354
2348
|
}
|
|
2355
2349
|
}
|
|
2356
|
-
/**
|
|
2357
|
-
* Selects a tab on `ion-tabs` when it is used without a router outlet.
|
|
2358
|
-
* Returns `false` when no `ion-tab` has the given `tab`.
|
|
2359
|
-
*/
|
|
2360
|
-
selectTabWithoutRouter = (tab) => {
|
|
2361
|
-
const tabsEl = this.tabsElRef.current;
|
|
2362
|
-
if (!tabsEl) {
|
|
2363
|
-
return false;
|
|
2364
|
-
}
|
|
2365
|
-
const hasTab = Array.from(tabsEl.querySelectorAll('ion-tab')).some((tabEl) => tabEl.tab === tab);
|
|
2366
|
-
if (!hasTab) {
|
|
2367
|
-
return false;
|
|
2368
|
-
}
|
|
2369
|
-
tabsEl.select(tab);
|
|
2370
|
-
return true;
|
|
2371
|
-
};
|
|
2372
|
-
onTabsDidChangeWithoutRouter = (event) => {
|
|
2373
|
-
/**
|
|
2374
|
-
* A tab change without a router does not re-render anything, so the
|
|
2375
|
-
* context needs a new value and a re-render to update its consumers.
|
|
2376
|
-
*/
|
|
2377
|
-
this.ionTabContextState = { ...this.ionTabContextState, activeTab: event.detail.tab };
|
|
2378
|
-
this.forceUpdate();
|
|
2379
|
-
this.props.onIonTabsDidChange?.(event);
|
|
2380
|
-
};
|
|
2381
2350
|
renderTabsInner(children, outlet) {
|
|
2382
2351
|
return (jsx(IonTabsInner, { ...this.props, children: React.Children.map(children, (child) => {
|
|
2383
2352
|
if (React.isValidElement(child)) {
|
|
@@ -2453,14 +2422,7 @@ class IonTabs extends React.Component {
|
|
|
2453
2422
|
throw new Error('IonTabs cannot contain an IonRouterOutlet and an IonTab at the same time');
|
|
2454
2423
|
}
|
|
2455
2424
|
if (hasTab) {
|
|
2456
|
-
|
|
2457
|
-
* Core `ion-tabs` switches tabs and emits the tab change events
|
|
2458
|
-
* itself, so the tab bar gets no change handlers. Otherwise they
|
|
2459
|
-
* would run a second time from the tab bar's click handler.
|
|
2460
|
-
*/
|
|
2461
|
-
this.ionTabContextState.tabBarProps = { ref: this.tabBarRef };
|
|
2462
|
-
this.ionTabContextState.selectTab = this.selectTabWithoutRouter;
|
|
2463
|
-
return (jsx(IonTabsContext.Provider, { value: this.ionTabContextState, children: jsx(IonTabsInner, { ...this.props, ref: this.tabsElRef, onIonTabsDidChange: this.onTabsDidChangeWithoutRouter, children: children }) }));
|
|
2425
|
+
return jsx(IonTabsInner, { ...this.props });
|
|
2464
2426
|
}
|
|
2465
2427
|
/**
|
|
2466
2428
|
* TODO(ROU-11051)
|
|
@@ -3195,7 +3157,6 @@ const RouteManagerContext = /*@__PURE__*/ React.createContext({
|
|
|
3195
3157
|
findViewItemByRouteInfo: () => undefined,
|
|
3196
3158
|
getChildrenToRender: () => undefined,
|
|
3197
3159
|
getViewItemsForOutlet: () => [],
|
|
3198
|
-
getLocationHistoryPathnames: () => [],
|
|
3199
3160
|
goBack: () => undefined,
|
|
3200
3161
|
unMountViewItem: () => undefined,
|
|
3201
3162
|
});
|
|
@@ -3396,13 +3357,6 @@ class LocationHistory {
|
|
|
3396
3357
|
canGoBack() {
|
|
3397
3358
|
return this.locationHistory.length > 1;
|
|
3398
3359
|
}
|
|
3399
|
-
/**
|
|
3400
|
-
* Returns the pathname of every entry in global history, oldest first.
|
|
3401
|
-
* The current entry is last.
|
|
3402
|
-
*/
|
|
3403
|
-
getPathnames() {
|
|
3404
|
-
return this.locationHistory.map((ri) => ri.pathname);
|
|
3405
|
-
}
|
|
3406
3360
|
findTabForPathname(pathname) {
|
|
3407
3361
|
for (const tab of Object.keys(this.tabHistory)) {
|
|
3408
3362
|
const routeInfos = this.tabHistory[tab];
|