@fto-consult/expo-ui 8.77.0 → 8.77.2

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.
@@ -1,38 +1,38 @@
1
-
2
- module.exports = {
3
- "@emotion/native": "^11.11.0",
4
- "@expo/html-elements": "^0.5.1",
5
- "@expo/vector-icons": "^14.0.0",
6
- "@pchmn/expo-material3-theme": "^1.3.2",
7
- "@react-native-community/netinfo": "11.1.0",
8
- "@react-native/assets-registry": "^0.72.0",
9
- "react-native-get-random-values": "~1.8.0",
10
- "@react-navigation/native": "^6.1.17",
11
- "@react-navigation/native-stack": "^6.9.26",
12
- "@react-navigation/stack": "^6.3.29",
13
- "@shopify/flash-list": "1.6.3",
14
- "expo": "^50.0.17",
15
- "expo-camera": "~14.1.3",
16
- "expo-clipboard": "~5.0.1",
17
- "expo-font": "~11.10.3",
18
- "expo-image-picker": "~14.7.1",
19
- "expo-linking": "~6.2.2",
20
- "expo-sharing": "~11.10.0",
21
- "expo-sqlite": "~13.4.0",
22
- "expo-status-bar": "~1.11.1",
23
- "expo-system-ui": "~2.9.4",
24
- "expo-web-browser": "~12.8.2",
25
- "react": "18.2.0",
26
- "react-native": "0.73.6",
27
- "react-native-safe-area-context": "4.8.2",
28
- "react-native-screens": "~3.29.0",
29
- "react-native-svg": "14.1.0",
30
- "react-native-webview": "13.6.4",
31
- "react-native-gesture-handler": "~2.14.0",
32
- "react-native-reanimated": "~3.6.2",
33
- "react-native-view-shot": "3.8.0",
34
- "expo-intent-launcher": "~10.11.0",
35
- "expo-image-manipulator": "~11.8.0",
36
- "expo-document-picker": "~11.10.1"
37
- };
1
+
2
+ module.exports = {
3
+ "@emotion/native": "^11.11.0",
4
+ "@expo/html-elements": "^0.5.1",
5
+ "@expo/vector-icons": "^14.0.0",
6
+ "@pchmn/expo-material3-theme": "^1.3.2",
7
+ "@react-native-community/netinfo": "11.1.0",
8
+ "@react-native/assets-registry": "^0.72.0",
9
+ "react-native-get-random-values": "~1.8.0",
10
+ "@react-navigation/native": "^6.1.17",
11
+ "@react-navigation/native-stack": "^6.9.26",
12
+ "@react-navigation/stack": "^6.3.29",
13
+ "@shopify/flash-list": "1.6.3",
14
+ "expo": "^50.0.17",
15
+ "expo-camera": "~14.1.3",
16
+ "expo-clipboard": "~5.0.1",
17
+ "expo-font": "~11.10.3",
18
+ "expo-image-picker": "~14.7.1",
19
+ "expo-linking": "~6.2.2",
20
+ "expo-sharing": "~11.10.0",
21
+ "expo-sqlite": "~13.4.0",
22
+ "expo-status-bar": "~1.11.1",
23
+ "expo-system-ui": "~2.9.4",
24
+ "expo-web-browser": "~12.8.2",
25
+ "react": "18.2.0",
26
+ "react-native": "0.73.6",
27
+ "react-native-safe-area-context": "4.8.2",
28
+ "react-native-screens": "~3.29.0",
29
+ "react-native-svg": "14.1.0",
30
+ "react-native-webview": "13.6.4",
31
+ "react-native-gesture-handler": "~2.14.0",
32
+ "react-native-reanimated": "~3.6.2",
33
+ "react-native-view-shot": "3.8.0",
34
+ "expo-intent-launcher": "~10.11.0",
35
+ "expo-image-manipulator": "~11.8.0",
36
+ "expo-document-picker": "~11.10.1"
37
+ };
38
38
 
@@ -1,18 +1,18 @@
1
- {
2
- "build": {
3
- "development": {
4
- "developmentClient": true,
5
- "distribution": "internal"
6
- },
7
- "preview": {
8
- "distribution": "internal",
9
- "android": {
10
- "buildType": "apk"
11
- }
12
- },
13
- "production": {}
14
- },
15
- "submit": {
16
- "production": {}
17
- }
18
- }
1
+ {
2
+ "build": {
3
+ "development": {
4
+ "developmentClient": true,
5
+ "distribution": "internal"
6
+ },
7
+ "preview": {
8
+ "distribution": "internal",
9
+ "android": {
10
+ "buildType": "apk"
11
+ }
12
+ },
13
+ "production": {}
14
+ },
15
+ "submit": {
16
+ "production": {}
17
+ }
18
+ }
@@ -91,6 +91,11 @@ export default {
91
91
  beforeSubmit : ({step,data,...rest})=><void>, //la fonction appélée immédiatement avant le submit des donénes
92
92
  renderNextButton : <boolean>, //si le bouton next sera rendu
93
93
  renderPreviousButton : <boolean>, //si le bouton previous sera rendu
94
+ title : <string>, //le titre de l'interface de connexion, titre personnalisé s'il y a lieu
95
+ wrapperProps : <func({withScreen,withScrollView,state,...rest})=><object>,object>, //les props du composant wrapper,
96
+ containerProps : <object>, //les props du composant container, idem à ceux du composant $ecomponents/Surface
97
+ contentProps : <object>, //les props du composant parent direct à la form rendu par le composatn formData, idem à ceux du composant $ecomponents/Surface
98
+ onSuccess : (object)=><boolean | any>, la fonction de rappel appelée lorsque l'utilisateur a été connecté, via la fonction signIn. si onSuccess retourne false, alors l'action par défaut de redirection de l'utilisateur via l'interface de connexion ne sera pas appelée.
94
99
  ...loginProps {object}, les props Supplémentaires à passer au composant FormData utilisé pour le rendu du formulaire de connexion
95
100
  }
96
101
  */
package/expo-ui.json CHANGED
@@ -1,11 +1,11 @@
1
- {
2
- "name": "@fto-consult/expo-ui",
3
- "version": "6.44.4",
4
- "description": "Bibliothèque de composants UI Expo,react-native",
5
- "bin": {
6
- "expo-ui": "./bin/index.js"
7
- },
8
- "author": "Boris Fouomene",
9
- "license": "ISC",
10
- "homepage": "https://github.com/borispipo/expo-ui#readme"
1
+ {
2
+ "name": "@fto-consult/expo-ui",
3
+ "version": "6.44.4",
4
+ "description": "Bibliothèque de composants UI Expo,react-native",
5
+ "bin": {
6
+ "expo-ui": "./bin/index.js"
7
+ },
8
+ "author": "Boris Fouomene",
9
+ "license": "ISC",
10
+ "homepage": "https://github.com/borispipo/expo-ui#readme"
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "8.77.0",
3
+ "version": "8.77.2",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "react-native-paper-doc": "https://github.com/callstack/react-native-paper/tree/main/docs/docs/guides",
6
6
  "scripts": {
@@ -70,7 +70,7 @@
70
70
  "dependencies": {
71
71
  "@emotion/react": "^11.11.1",
72
72
  "@faker-js/faker": "^8.0.2",
73
- "@fto-consult/common": "^4.48.3",
73
+ "@fto-consult/common": "^4.50.8",
74
74
  "@fto-consult/expo-ui": "^8.73.1",
75
75
  "apexcharts": "^3.49.0",
76
76
  "file-saver": "^2.0.5",
package/src/auth/Login.js CHANGED
@@ -29,7 +29,7 @@ const WIDTH = 400;
29
29
  export default function LoginComponent(props){
30
30
  let {formName,step,appBarProps,onSuccess,withPortal,testID} = props;
31
31
  const {auth:{loginPropsMutator,Login}} = useContext();
32
- const loginTitle = getTitle();
32
+ let loginTitle = getTitle();
33
33
  testID = defaultStr(testID,"RN_Auth.LoginComponent");
34
34
  formName = React.useRef(uniqid(defaultStr(formName,"login-formname"))).current;
35
35
  const nextButtonRef = React.useRef(null);
@@ -131,14 +131,8 @@ export default function LoginComponent(props){
131
131
  }
132
132
  const beforeSubmitRef = React.useRef(null);
133
133
  const canSubmitRef = React.useRef(null);
134
- const mutateDataRef = React.useRef(null);
134
+ const onSuccesRef = React.useRef(null);
135
135
  const signIn = ()=>{
136
- const canSubmit = typeof canSubmitRef.current == 'function'? canSubmitRef.current : w=>true;
137
- const cS = canSubmit(args);
138
- if(typeof cS === 'string' && cS){
139
- return notifyUser(cS);
140
- }
141
- const data = getData();
142
136
  const form = _getForm();
143
137
  if(!form){
144
138
  notifyUser("Impossible de valider le formulaire car celui-ci semble invalide")
@@ -148,13 +142,19 @@ export default function LoginComponent(props){
148
142
  notifyUser(form.getErrorText());
149
143
  return;
150
144
  }
151
- const args = {...state,data,form,state,step,setState,nextButtonRef,previousButtonRef};
145
+ const data = getData();
146
+ const canSubmit = typeof canSubmitRef.current == 'function'? canSubmitRef.current : w=>true;
152
147
  const beforeSubmit = typeof beforeSubmitRef.current === 'function' ? beforeSubmitRef.current : ()=> true;
153
- if(cS && beforeSubmit(args) !== false){
148
+ const args = {...state,data,form,state,setState,nextButtonRef,previousButtonRef};
149
+ const cS = canSubmit(args);
150
+ if(typeof cS === 'string' && cS){
151
+ return notifyUser(cS);
152
+ }
153
+ if(cS !== false && beforeSubmit(args) !== false){
154
154
  Preloader.open("vérification ...");
155
155
  setIsLoading(nextButtonRef,true);
156
156
  return auth.signIn(data).then((a)=>{
157
- if(typeof onLoginSuccess =='function' && onLoginSuccess(a)=== false) return;
157
+ if(typeof onSuccesRef.current =='function' && onSuccesRef.current(a)=== false) return;
158
158
  if(isFunction(onSuccess)){
159
159
  onSuccess(data);
160
160
  } else {
@@ -171,9 +171,12 @@ export default function LoginComponent(props){
171
171
  containerProps : customContainerProps,
172
172
  contentProps : customContentProps,
173
173
  formProps,
174
+ wrapperProps : cWrapperProps,
175
+ title : customTitle,
174
176
  withScrollView:customWithScrollView,children,initialize,contentTop,renderNextButton,renderPreviousButton,data:loginData,canGoToNext,keyboardEvents,onSuccess:onLoginSuccess,beforeSubmit:beforeSubmitForm,canSubmit:canSubmitForm,onStepChange,...loginProps} = loginPropsMutator({
175
177
  ...state,
176
178
  getButtonAction,
179
+ data : getData(),
177
180
  signIn,
178
181
  setState,
179
182
  setIsLoading,
@@ -192,6 +195,9 @@ export default function LoginComponent(props){
192
195
  ProviderSelector,
193
196
  previousButtonRef,
194
197
  });
198
+ if(isNonNullString(customTitle)){
199
+ loginTitle = customTitle;
200
+ }
195
201
  const containerProps = defaultObj(customContainerProps);
196
202
  const contentProps = defaultObj(customContentProps);
197
203
  /****la fonction à utiliser pour vérifier si l'on peut envoyer les données pour connextion
@@ -199,6 +205,7 @@ export default function LoginComponent(props){
199
205
  * **/
200
206
  canSubmitRef.current = typeof canSubmitForm =='function'? canSubmitForm : ({step})=>step >= 2;
201
207
  beforeSubmitRef.current = typeof beforeSubmitForm =='function'? beforeSubmitForm : x=> true;
208
+ onSuccesRef.current = onLoginSuccess;
202
209
 
203
210
  const goToNext = ()=>{
204
211
  let step = state.step;
@@ -254,7 +261,8 @@ export default function LoginComponent(props){
254
261
  const mediaQueryUpdateStyle = (a)=>{
255
262
  return StyleSheet.flatten([updateMediaQueryStyle(),contentProps.style]);
256
263
  };
257
- const wrapperProps = withPortal ? {appBarProps,authRequired:false,title:loginTitle,withScrollView} : { style:styles.wrapper};
264
+ const wProps = defaultObj(typeof cWrapperProps =="function"? cWrapperProps({...state,setState,formName,state,withPortal,withScreen:withPortal,withScrollView,state,formName}) : cWrapperProps);
265
+ const wrapperProps = withPortal ? {appBarProps,authRequired:false,title:loginTitle,withScrollView,...wProps} : { ...wProps,style:[styles.wrapper,wProps.style]};
258
266
  const sH = React.isComponent(HeaderTopContent)? <HeaderTopContent mediaQueryUpdateStyle = {mediaQueryUpdateStyle} /> : React.isValidElement(HeaderTopContent)? HeaderTopContent : null;
259
267
  const header = React.isComponent(Header) ? <Header mediaQueryUpdateStyle = {mediaQueryUpdateStyle}/> : React.isValidElement(Header)? Header : null;
260
268
  return <Wrapper testID = {testID+"_Wrapper" }{...wrapperProps}>
@@ -296,6 +304,7 @@ export default function LoginComponent(props){
296
304
  onPress = {goToNext}
297
305
  icon = {state.step == 1? 'arrow-right':'login'}
298
306
  surface
307
+ testID = {testID+"_NextButton"}
299
308
  >
300
309
  {state.step == 1? 'Suivant' : 'Connexion' }
301
310
  </Action> : null}
@@ -309,6 +318,7 @@ export default function LoginComponent(props){
309
318
  secondary
310
319
  surface
311
320
  icon = {'arrow-left'}
321
+ testID = {testID+"_PrevButton"}
312
322
  >
313
323
  Précédent
314
324
  </Button> : null}
@@ -382,6 +392,25 @@ const styles = StyleSheet.create({
382
392
  });
383
393
 
384
394
  LoginComponent.propTypes = {
395
+ /****
396
+ les props du composant Wrapper, peut être une fonction où un objet
397
+ - s'il s'agit d'une fonction : elle est définie comme suit :
398
+ ({withScreen<boolean>,withPortal<boolean>,withScrolView<boolean>})=> <object>,
399
+
400
+ */
401
+ wrapperProps : PropTypes.oneOfType([
402
+ PropTypes.func,
403
+ PropTypes.object,
404
+ ]),
405
+ /***
406
+ les props du composant Container, enfant hiérachique au composant Wrapper
407
+ idem aux props du composant Surface
408
+ */
409
+ containerProps : PropTypes.shape(defaultObj(Surface.propTypes)),
410
+ //les props du composant Surface, parent direct du composant FormData utile pour le rendu du form
411
+ contentProps : PropTypes.shape(defaultObj(Surface.propTypes)),
412
+ //les props du form data, idem à ceux du composant FormData
413
+ formProps : PropTypes.object,
385
414
  headerTopContent : PropTypes.oneOfType([
386
415
  PropTypes.func,
387
416
  PropTypes.node,
@@ -392,13 +421,8 @@ LoginComponent.propTypes = {
392
421
  PropTypes.element,
393
422
  PropTypes.func,
394
423
  ]),
424
+ onSuccess : PropTypes.func, //la fonctino appelée lorsque l'utilisateur a été connecté, lorsque l'action liée à la fonction signIn de auth s'est terminée correctement
395
425
  renderNextButton : PropTypes.bool,//si le bouton next sera rendu
396
426
  renderPreviousButton : PropTypes.bool,//si le bouton previous sera rendu
397
427
  }
398
428
 
399
- /*** les loginProps sont les porps à passer au composant FormData
400
- */
401
- const loginPropTypes = {
402
- containerProps : PropTypes.object, //les props à passer au container
403
- ...FormData.propTypes, //les props type du composant form data
404
- }