import React from 'react'; import { NavContext } from '../contexts/NavContext'; import PageManager from '../routing/PageManager'; import type { IonicReactProps } from './IonicReactProps'; import { createForwardRef } from './utils'; // eslint-disable-next-line @typescript-eslint/no-empty-interface interface IonPageProps extends IonicReactProps {} interface IonPageInternalProps extends IonPageProps { forwardedRef?: React.ForwardedRef; } class IonPageInternal extends React.Component { context!: React.ContextType; constructor(props: IonPageInternalProps) { super(props); } render() { const { className, children, forwardedRef, ...props } = this.props; return this.context.hasIonicRouter() ? ( {children} ) : (
{children}
); } static get displayName() { return 'IonPage'; } static get contextType() { return NavContext; } } export const IonPage = createForwardRef(IonPageInternal, 'IonPage');