mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
@ -3,18 +3,19 @@ import React, { Fragment } from 'react';
|
|||||||
|
|
||||||
import { NavContext } from '../../contexts/NavContext';
|
import { NavContext } from '../../contexts/NavContext';
|
||||||
import PageManager from '../../routing/PageManager';
|
import PageManager from '../../routing/PageManager';
|
||||||
|
import { HTMLElementSSR } from '../../utils/HTMLElementSSR';
|
||||||
import { IonRouterOutlet } from '../IonRouterOutlet';
|
import { IonRouterOutlet } from '../IonRouterOutlet';
|
||||||
|
|
||||||
import { IonTabBar } from './IonTabBar';
|
import { IonTabBar } from './IonTabBar';
|
||||||
import { IonTabsContext, IonTabsContextState } from './IonTabsContext';
|
import { IonTabsContext, IonTabsContextState } from './IonTabsContext';
|
||||||
|
|
||||||
class IonTabsElement extends HTMLElement {
|
class IonTabsElement extends HTMLElementSSR {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window && window.customElements) {
|
if (typeof (window as any) !== 'undefined' && window.customElements) {
|
||||||
const element = customElements.get('ion-tabs');
|
const element = customElements.get('ion-tabs');
|
||||||
if (!element) {
|
if (!element) {
|
||||||
customElements.define('ion-tabs', IonTabsElement);
|
customElements.define('ion-tabs', IonTabsElement);
|
||||||
|
4
packages/react/src/utils/HTMLElementSSR.ts
Normal file
4
packages/react/src/utils/HTMLElementSSR.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export const HTMLElementSSR = (
|
||||||
|
typeof HTMLElement !== 'undefined'
|
||||||
|
? HTMLElement
|
||||||
|
: class {}) as typeof HTMLElement;
|
Reference in New Issue
Block a user