@fto-consult/expo-ui 1.3.13 → 1.4.1
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/babel.config.alias.js +1 -1
- package/package.json +2 -2
- package/src/App.js +20 -6
package/babel.config.alias.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@expo/html-elements": "^0.2.0",
|
|
62
62
|
"@expo/metro-config": "^0.4.0",
|
|
63
63
|
"@expo/webpack-config": "^0.17.2",
|
|
64
|
-
"@fto-consult/common": "^1.6.
|
|
64
|
+
"@fto-consult/common": "^1.6.6",
|
|
65
65
|
"@gorhom/portal": "^1.0.14",
|
|
66
66
|
"@react-native-async-storage/async-storage": "~1.17.3",
|
|
67
67
|
"@react-native-community/datetimepicker": "6.2.0",
|
package/src/App.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '$session';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import {defaultObj} from "$utils";
|
|
3
4
|
import {updateTheme,defaultTheme} from "$theme";
|
|
4
5
|
import {Provider as PaperProvider } from 'react-native-paper';
|
|
5
6
|
import Index from './index';
|
|
@@ -23,18 +24,31 @@ import {Provider as AlertProvider} from '$ecomponents/Dialog/confirm/Alert';
|
|
|
23
24
|
import APP from "$app";
|
|
24
25
|
|
|
25
26
|
export default function getIndex(options){
|
|
26
|
-
const {App} = defaultObj(options);
|
|
27
|
+
const {App,onMount,onUnmount,preferences:appPreferences} = defaultObj(options);
|
|
27
28
|
return function MainIndexComponent() {
|
|
28
29
|
React.useEffect(()=>{
|
|
29
|
-
|
|
30
|
+
///la fonction de rappel lorsque le composant est monté
|
|
31
|
+
let cb = typeof onMount =='function'? onMount() : null;
|
|
32
|
+
return ()=>{
|
|
33
|
+
if(typeof onUnmount =='function'){
|
|
34
|
+
onUnmount();
|
|
35
|
+
}
|
|
36
|
+
if(typeof cb =='function'){
|
|
37
|
+
cb();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
30
40
|
},[])
|
|
31
41
|
const [theme,setTheme] = React.useState(updateTheme(defaultTheme));
|
|
42
|
+
const updatePreferenceTheme = (customTheme,persist)=>{
|
|
43
|
+
setTheme(updateTheme(customTheme));
|
|
44
|
+
};
|
|
45
|
+
const forceRender = React.useForceRender();
|
|
46
|
+
const pref = typeof appPreferences =='function'? appPreferences({setTheme,forceRender,updateTheme:updatePreferenceTheme}) : appPreferences;
|
|
32
47
|
const preferences = React.useMemo(()=>({
|
|
33
|
-
updateTheme
|
|
34
|
-
setTheme(updateTheme(customTheme));
|
|
35
|
-
},
|
|
48
|
+
updateTheme:updatePreferenceTheme,
|
|
36
49
|
theme,
|
|
37
|
-
|
|
50
|
+
...defaultObj(pref),
|
|
51
|
+
}),[theme,pref]);
|
|
38
52
|
const child = <Index theme={theme}/>;
|
|
39
53
|
const children = typeof App =='function'? App({children:child,APP}) : child;
|
|
40
54
|
return (
|