@fto-consult/expo-ui 6.20.23 → 6.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +27 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2,7 +2,9 @@ import { registerRootComponent } from "expo";
|
|
|
2
2
|
import {Platform,AppRegistry } from 'react-native';
|
|
3
3
|
import App from "./src/App";
|
|
4
4
|
import Provider from "$econtext/Provider";
|
|
5
|
-
|
|
5
|
+
import APP from "$capp/instance";
|
|
6
|
+
const REGISTER_EVENT = "REGISTER-APP-COMPONENT-ROOT";
|
|
7
|
+
import {useState,useEffect} from "react";
|
|
6
8
|
|
|
7
9
|
/****
|
|
8
10
|
* les options sont de la forme :
|
|
@@ -16,12 +18,29 @@ const isWeb = Platform.OS === "web";
|
|
|
16
18
|
* les écrans d'initialisation doivent garder la propriété Start à true ou doivent avoir le groupe INTALL, pour spécifier que ce sont es écrans qui apparaissent lorsque l'application n'est pas initialisée
|
|
17
19
|
* }
|
|
18
20
|
*/
|
|
19
|
-
|
|
20
|
-
const component = function(props){
|
|
21
|
-
return <Provider {...props} {...rest} swrConfig={isObj(swrConfig) && swrConfig || {}} children={<App init={init} render={render} onMount={onMount} onUnmount={onUnmount} onRender={onRender}/>}/>
|
|
22
|
-
};
|
|
23
|
-
return AppRegistry.registerComponent('main',() => component);
|
|
24
|
-
}
|
|
21
|
+
|
|
25
22
|
|
|
26
23
|
///fix bug lié au fait que l'application stuck on splashscreen en environnement mobile
|
|
27
|
-
//!isWeb && registerRootComponent(x=>null);
|
|
24
|
+
//!isWeb && registerRootComponent(x=>null);
|
|
25
|
+
|
|
26
|
+
const MainAppEntry = function(mProps){
|
|
27
|
+
const [props,setProps] = useState({});
|
|
28
|
+
const onRegisterProps = (props)=>{
|
|
29
|
+
console.log(props," is registered");
|
|
30
|
+
setProps({...props});
|
|
31
|
+
}
|
|
32
|
+
useEffect(()=>{
|
|
33
|
+
APP.one(REGISTER_EVENT,onRegisterProps);
|
|
34
|
+
return ()=>{
|
|
35
|
+
APP.off(REGISTER_EVENT,onRegisterProps);
|
|
36
|
+
}
|
|
37
|
+
},[])
|
|
38
|
+
const {onMount,onUnmount,onRender,render,swrConfig,init,...rest} = {...mProps,...props};
|
|
39
|
+
return <Provider {...props} {...rest} swrConfig={isObj(swrConfig) && swrConfig || {}} children={<App init={init} render={render} onMount={onMount} onUnmount={onUnmount} onRender={onRender}/>}/>
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default function registerApp (opts){
|
|
43
|
+
return APP.trigger(REGISTER_EVENT,opts);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
registerRootComponent(MainAppEntry);
|