1
1
import type { JSX as LocalJSX } from '@ionic/core/components' ;
2
- import React from 'react' ;
2
+ import React , { type PropsWithChildren } from 'react' ;
3
3
4
4
import type { IonContextInterface } from '../contexts/IonContext' ;
5
5
import { IonContext } from '../contexts/IonContext' ;
@@ -9,53 +9,49 @@ import { IonOverlayManager } from './IonOverlayManager';
9
9
import type { IonicReactProps } from './IonicReactProps' ;
10
10
import { IonAppInner } from './inner-proxies' ;
11
11
12
- type Props = LocalJSX . IonApp &
13
- IonicReactProps & {
14
- ref ?: React . Ref < HTMLIonAppElement > ;
15
- } ;
16
-
17
- export const IonApp = /*@__PURE__ */ ( ( ) =>
18
- class extends React . Component < Props > {
19
- addOverlayCallback ?: ( id : string , overlay : ReactComponentOrElement , containerElement : HTMLDivElement ) => void ;
20
- removeOverlayCallback ?: ( id : string ) => void ;
21
-
22
- constructor ( props : Props ) {
23
- super ( props ) ;
24
- }
25
-
26
- /*
27
- Wire up methods to call into IonOverlayManager
28
- */
29
- ionContext : IonContextInterface = {
30
- addOverlay : ( id : string , overlay : ReactComponentOrElement , containerElement : HTMLDivElement ) => {
31
- if ( this . addOverlayCallback ) {
32
- this . addOverlayCallback ( id , overlay , containerElement ) ;
33
- }
34
- } ,
35
- removeOverlay : ( id : string ) => {
36
- if ( this . removeOverlayCallback ) {
37
- this . removeOverlayCallback ( id ) ;
38
- }
39
- } ,
40
- } ;
41
-
42
- render ( ) {
43
- return (
44
- < IonContext . Provider value = { this . ionContext } >
45
- < IonAppInner { ...this . props } > { this . props . children } </ IonAppInner >
46
- < IonOverlayManager
47
- onAddOverlay = { ( callback ) => {
48
- this . addOverlayCallback = callback ;
49
- } }
50
- onRemoveOverlay = { ( callback ) => {
51
- this . removeOverlayCallback = callback ;
52
- } }
53
- />
54
- </ IonContext . Provider >
55
- ) ;
12
+ type Props = PropsWithChildren <
13
+ LocalJSX . IonApp &
14
+ IonicReactProps & {
15
+ ref ?: React . Ref < HTMLIonAppElement > ;
56
16
}
17
+ > ;
18
+
19
+ export class IonApp extends React . Component < Props > {
20
+ addOverlayCallback ?: ( id : string , overlay : ReactComponentOrElement , containerElement : HTMLDivElement ) => void ;
21
+ removeOverlayCallback ?: ( id : string ) => void ;
22
+
23
+ constructor ( props : Props ) {
24
+ super ( props ) ;
25
+ }
26
+
27
+ ionContext : IonContextInterface = {
28
+ addOverlay : ( id : string , overlay : ReactComponentOrElement , containerElement : HTMLDivElement ) => {
29
+ if ( this . addOverlayCallback ) {
30
+ this . addOverlayCallback ( id , overlay , containerElement ) ;
31
+ }
32
+ } ,
33
+ removeOverlay : ( id : string ) => {
34
+ if ( this . removeOverlayCallback ) {
35
+ this . removeOverlayCallback ( id ) ;
36
+ }
37
+ } ,
38
+ } ;
57
39
58
- static get displayName ( ) {
59
- return 'IonApp' ;
60
- }
61
- } ) ( ) ;
40
+ render ( ) {
41
+ return (
42
+ < IonContext . Provider value = { this . ionContext } >
43
+ < IonAppInner { ...this . props } > { this . props . children } </ IonAppInner >
44
+ < IonOverlayManager
45
+ onAddOverlay = { ( callback ) => {
46
+ this . addOverlayCallback = callback ;
47
+ } }
48
+ onRemoveOverlay = { ( callback ) => {
49
+ this . removeOverlayCallback = callback ;
50
+ } }
51
+ />
52
+ </ IonContext . Provider >
53
+ ) ;
54
+ }
55
+
56
+ static displayName = 'IonApp' ;
57
+ }
0 commit comments