/
githubmirror
/
ionic
Обзор
Документация
Войти
/
githubmirror
/
ionic
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/react/src/components/IonApp.tsx
57 строк
2 KB
Shane
feat(react): fixing support for react 19, adding test app for react 19 (#30217)
03 мар 2025, 19:50
Не верифицирован
03 мар 2025, 19:50
f4941f2
Код
Авторство
О чём код?
import type { JSX as LocalJSX } from '@ionic/core/components'; import React, { type PropsWithChildren } from 'react'; import type { IonContextInterface } from '../contexts/IonContext'; import { IonContext } from '../contexts/IonContext'; import type { ReactComponentOrElement } from '../models'; import { IonOverlayManager } from './IonOverlayManager'; import type { IonicReactProps } from './IonicReactProps'; import { IonAppInner } from './inner-proxies'; type Props = PropsWithChildren< LocalJSX.IonApp & IonicReactProps & { ref?: React.Ref<HTMLIonAppElement>; } >; export class IonApp extends React.Component<Props> { addOverlayCallback?: (id: string, overlay: ReactComponentOrElement, containerElement: HTMLDivElement) => void; removeOverlayCallback?: (id: string) => void; constructor(props: Props) { super(props); } ionContext: IonContextInterface = { addOverlay: (id: string, overlay: ReactComponentOrElement, containerElement: HTMLDivElement) => { if (this.addOverlayCallback) { this.addOverlayCallback(id, overlay, containerElement); } }, removeOverlay: (id: string) => { if (this.removeOverlayCallback) { this.removeOverlayCallback(id); } }, }; render() { return ( <IonContext.Provider value={this.ionContext}> <IonAppInner {...this.props}>{this.props.children}</IonAppInner> <IonOverlayManager onAddOverlay={(callback) => { this.addOverlayCallback = callback; }} onRemoveOverlay={(callback) => { this.removeOverlayCallback = callback; }} /> </IonContext.Provider> ); } static displayName = 'IonApp'; }