/
githubmirror
/
ionic
Обзор
Документация
Войти
/
githubmirror
/
ionic
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/react/src/components/IonPage.tsx
51 строка
1 KB
Liam DeBeasi
chore(react): migrate to eslint, add prettier (#26633)
19 янв 2023, 00:49
Не верифицирован
19 янв 2023, 00:49
b02190d
Код
Авторство
О чём код?
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<HTMLDivElement>; } class IonPageInternal extends React.Component<IonPageInternalProps> { context!: React.ContextType<typeof NavContext>; constructor(props: IonPageInternalProps) { super(props); } render() { const { className, children, forwardedRef, ...props } = this.props; return this.context.hasIonicRouter() ? ( <PageManager className={className ? `${className}` : ''} routeInfo={this.context.routeInfo} forwardedRef={forwardedRef} {...props} > {children} </PageManager> ) : ( <div className={className ? `ion-page ${className}` : 'ion-page'} ref={forwardedRef} {...props}> {children} </div> ); } static get displayName() { return 'IonPage'; } static get contextType() { return NavContext; } } export const IonPage = createForwardRef(IonPageInternal, 'IonPage');