@fto-consult/expo-ui 7.3.0 → 7.3.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.3.0",
3
+ "version": "7.3.3",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -71,7 +71,7 @@
71
71
  "@expo/html-elements": "^0.5.1",
72
72
  "@expo/vector-icons": "^13.0.0",
73
73
  "@faker-js/faker": "^8.0.2",
74
- "@fto-consult/common": "^3.72.19",
74
+ "@fto-consult/common": "^3.73.3",
75
75
  "@pchmn/expo-material3-theme": "^1.3.1",
76
76
  "@react-native-async-storage/async-storage": "1.18.2",
77
77
  "@react-native-community/datetimepicker": "7.2.0",
@@ -33,10 +33,10 @@ const DrawerNavigator = React.forwardRef(({content,children:customChildren,state
33
33
  },100)
34
34
  };
35
35
  APP.on(APP.EVENTS.AUTH_LOGOUT_USER,onLogoutUser);
36
- APP.on(APP.EVENTS.UPDATE_THEME,refreshItems);
36
+ //APP.on(APP.EVENTS.UPDATE_THEME,refreshItems);
37
37
  return ()=>{
38
38
  APP.off(APP.EVENTS.AUTH_LOGOUT_USER,onLogoutUser);
39
- APP.off(APP.EVENTS.UPDATE_THEME,refreshItems);
39
+ //APP.off(APP.EVENTS.UPDATE_THEME,refreshItems);
40
40
  }
41
41
  },[]);
42
42
  const headerCB = ({isMinimized})=>{
@@ -32,10 +32,8 @@ const useGetItems = (options)=>{
32
32
  }
33
33
  }
34
34
  APP.on(APP.EVENTS.REFRESH_MAIN_DRAWER,refreshItems);
35
- //APP.on(APP.EVENTS.UPDATE_THEME,refreshItems);
36
35
  return ()=>{
37
36
  APP.off(APP.EVENTS.REFRESH_MAIN_DRAWER,refreshItems);
38
- //APP.off(APP.EVENTS.UPDATE_THEME,refreshItems);
39
37
  }
40
38
  },[])
41
39
  return useMemo(()=>{
@@ -8,6 +8,8 @@ import {SignIn2SignOut} from "$cauth";
8
8
  import React from "$react";
9
9
  import avatarProps from "$eauth/avatarProps";
10
10
  import useContext from "$econtext/hooks";
11
+ import PropTypes from "prop-types";
12
+ import APP from "$capp/instance";
11
13
 
12
14
  import {screenName} from "./utils";
13
15
 
@@ -67,10 +69,16 @@ export default function UserProfileScreen({fields,...p}){
67
69
  const onSaveProfile = ({data,goBack,...rest})=>{
68
70
  data.theme = themeRef.current;
69
71
  Preloader.open("Modification en cours...");
70
- const opts = {...user,...data};
71
- return Auth.upsertUser(opts,true).then((response)=>{
72
- if(typeof props.onSave ==='function' && props.onSave({...opts,response,goBack,navigate}) === false) return;
73
- if(typeof goBack =='function' && !hasChangeRef.current){
72
+ const toSave = {...user,...data};
73
+ return Auth.upsertUser(toSave,true).then((response)=>{
74
+ setTimeout(()=>{
75
+ if(hasChangeRef.current){
76
+ APP.trigger(APP.EVENTS.UPDATE_THEME,user.theme);
77
+ }
78
+ APP.trigger(APP.EVENTS.AUTH_UPDATE_PROFILE,toSave);
79
+ },100);
80
+ if(typeof props.onSave ==='function' && props.onSave({...rest,data:toSave,response,goBack,navigate}) === false) return;
81
+ if(props.navigateToHomeOnSave !== true && typeof goBack =='function' && !hasChangeRef.current){
74
82
  return goBack(true);
75
83
  }
76
84
  navigate('Home');
@@ -98,4 +106,9 @@ UserProfileScreen.screenName = screenName;
98
106
 
99
107
  UserProfileScreen.Modal = true;
100
108
 
101
- UserProfileScreen.authRequired = true;
109
+ UserProfileScreen.authRequired = true;
110
+
111
+ UserProfileScreen.propTypes = {
112
+ navigateToHomeOnSave : PropTypes.bool,//pour forcer la navigation à l'écran d'acceuil une fois qu'on est enregistrée les préférences, peut importe si le profil utilisateur a été mis à jour
113
+
114
+ }