@fto-consult/expo-ui 3.1.1 → 3.3.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.
@@ -113,7 +113,6 @@ module.exports = (opts)=>{
113
113
  });
114
114
  const $assets = r.$assets;
115
115
  const electronPaths = {
116
- ...r,
117
116
  assets : $assets,
118
117
  images : r.$images,
119
118
  projectRoot : base,//la racine au projet
@@ -1,48 +1,48 @@
1
- #!/usr/bin/env node
2
- /**@see : https://blog.shahednasser.com/how-to-create-a-npx-tool/ */
3
- 'use strict';
4
- process.on('unhandledRejection', err => {
5
- throw err;
6
- });
7
- const spawnAsync = require('cross-spawn').spawn;
8
- const { realpathSync } = require('fs-extra');
9
-
10
- //const { ensureMinProjectSetupAsync } = require('../build/Config');
11
-
12
- const args = process.argv.slice(2);
13
-
14
- const scriptIndex = args.findIndex(x => x === 'start' || x === 'customize');
15
- const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
16
- const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
17
- console.log(args," is argggggg",script);
18
- if (['start', 'customize'].includes(script)) {
19
- spawnAsync(
20
- 'node',
21
- nodeArgs.concat(require.resolve('./scripts/' + script)).concat(args.slice(scriptIndex + 1)),
22
- { stdio: 'inherit' }
23
- ).then(result => {
24
- if (result.signal) {
25
- if (result.signal === 'SIGKILL') {
26
- console.log(
27
- 'The build failed because the process exited too early. ' +
28
- 'This probably means the system ran out of memory or someone called ' +
29
- '`kill -9` on the process.'
30
- );
31
- } else if (result.signal === 'SIGTERM') {
32
- console.log(
33
- 'The build failed because the process exited too early. ' +
34
- 'Someone might have called `kill` or `killall`, or the system could ' +
35
- 'be shutting down.'
36
- );
37
- }
38
- process.exit(1);
39
- }
40
- process.exit(result.status);
41
- });
42
- } else if (script === undefined) {
43
- const projectRoot = realpathSync(process.cwd());
44
-
45
- //ensureMinProjectSetupAsync(projectRoot);
46
- } else {
47
- console.log('Invalid command "' + script + '".');
48
- }
1
+ #!/usr/bin/env node
2
+ /**@see : https://blog.shahednasser.com/how-to-create-a-npx-tool/ */
3
+ 'use strict';
4
+ process.on('unhandledRejection', err => {
5
+ throw err;
6
+ });
7
+ const spawnAsync = require('cross-spawn').spawn;
8
+ const { realpathSync } = require('fs-extra');
9
+
10
+ //const { ensureMinProjectSetupAsync } = require('../build/Config');
11
+
12
+ const args = process.argv.slice(2);
13
+
14
+ const scriptIndex = args.findIndex(x => x === 'start' || x === 'customize');
15
+ const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
16
+ const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
17
+ console.log(args," is argggggg",script);
18
+ if (['start', 'customize'].includes(script)) {
19
+ spawnAsync(
20
+ 'node',
21
+ nodeArgs.concat(require.resolve('./scripts/' + script)).concat(args.slice(scriptIndex + 1)),
22
+ { stdio: 'inherit' }
23
+ ).then(result => {
24
+ if (result.signal) {
25
+ if (result.signal === 'SIGKILL') {
26
+ console.log(
27
+ 'The build failed because the process exited too early. ' +
28
+ 'This probably means the system ran out of memory or someone called ' +
29
+ '`kill -9` on the process.'
30
+ );
31
+ } else if (result.signal === 'SIGTERM') {
32
+ console.log(
33
+ 'The build failed because the process exited too early. ' +
34
+ 'Someone might have called `kill` or `killall`, or the system could ' +
35
+ 'be shutting down.'
36
+ );
37
+ }
38
+ process.exit(1);
39
+ }
40
+ process.exit(result.status);
41
+ });
42
+ } else if (script === undefined) {
43
+ const projectRoot = realpathSync(process.cwd());
44
+
45
+ //ensureMinProjectSetupAsync(projectRoot);
46
+ } else {
47
+ console.log('Invalid command "' + script + '".');
48
+ }
@@ -1,11 +1,11 @@
1
- #!/usr/bin/env node
2
- /**@see : https://blog.shahednasser.com/how-to-create-a-npx-tool/ */
3
- 'use strict';
4
- process.on('unhandledRejection', err => {
5
- throw err;
6
- });
7
- const args = process.argv.slice(2);
8
-
9
- console.log(args," is arggggg");
10
-
1
+ #!/usr/bin/env node
2
+ /**@see : https://blog.shahednasser.com/how-to-create-a-npx-tool/ */
3
+ 'use strict';
4
+ process.on('unhandledRejection', err => {
5
+ throw err;
6
+ });
7
+ const args = process.argv.slice(2);
8
+
9
+ console.log(args," is arggggg");
10
+
11
11
  process.exist();
@@ -1,21 +1,21 @@
1
- const chalk = require('chalk');
2
- const fs = require('fs-extra');
3
-
4
- const { copyTemplateToProject, ensureMinProjectSetupAsync } = require('..');
5
- process.on('unhandledRejection', err => {
6
- throw err;
7
- });
8
-
9
- const projectRoot = fs.realpathSync(process.cwd());
10
-
11
- console.log();
12
- console.log(chalk.magenta('\u203A Copying Expo Electron main process to local project...'));
13
-
14
- copyTemplateToProject(projectRoot);
15
- ensureMinProjectSetupAsync(projectRoot);
16
-
17
- console.log(
18
- chalk.magenta(
19
- '\u203A You can now edit the Electron main process in the `electron/main` folder of your project...'
20
- )
21
- );
1
+ const chalk = require('chalk');
2
+ const fs = require('fs-extra');
3
+
4
+ const { copyTemplateToProject, ensureMinProjectSetupAsync } = require('..');
5
+ process.on('unhandledRejection', err => {
6
+ throw err;
7
+ });
8
+
9
+ const projectRoot = fs.realpathSync(process.cwd());
10
+
11
+ console.log();
12
+ console.log(chalk.magenta('\u203A Copying Expo Electron main process to local project...'));
13
+
14
+ copyTemplateToProject(projectRoot);
15
+ ensureMinProjectSetupAsync(projectRoot);
16
+
17
+ console.log(
18
+ chalk.magenta(
19
+ '\u203A You can now edit the Electron main process in the `electron/main` folder of your project...'
20
+ )
21
+ );
@@ -1,8 +1,8 @@
1
- const { ensureElectronConfig } = require('..');
2
-
3
- ensureElectronConfig(process.cwd());
4
-
5
- process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 1;
6
- process.env.platform = "electron";
7
-
8
- require('electron-webpack/out/dev/dev-runner');
1
+ const { ensureElectronConfig } = require('..');
2
+
3
+ ensureElectronConfig(process.cwd());
4
+
5
+ process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 1;
6
+ process.env.platform = "electron";
7
+
8
+ require('electron-webpack/out/dev/dev-runner');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "3.1.1",
3
+ "version": "3.3.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/auth/Login.js CHANGED
@@ -86,7 +86,11 @@ export default function LoginComponent(props){
86
86
  },1000)
87
87
  }
88
88
  },[withPortal])
89
- const {header,withScrollView:customWithScrollView,children,initialize,contentTop,data:loginData,canGoToNext,keyboardEvents,onSuccess:onLoginSuccess,mutateData,beforeSubmit:beforeSubmitForm,canSubmit:canSubmitForm,onStepChange,...loginProps} = defaultObj(getProps({
89
+ const {header,
90
+ headerTopContent:HeaderTopContent,
91
+ containerProps : customContainerProps,
92
+ contentProp,
93
+ withScrollView:customWithScrollView,children,initialize,contentTop,data:loginData,canGoToNext,keyboardEvents,onSuccess:onLoginSuccess,mutateData,beforeSubmit:beforeSubmitForm,canSubmit:canSubmitForm,onStepChange,...loginProps} = defaultObj(getProps({
90
94
  ...state,
91
95
  setState,
92
96
  state,
@@ -101,6 +105,8 @@ export default function LoginComponent(props){
101
105
  ProviderSelector,
102
106
  previousButtonRef,
103
107
  }));
108
+ const containerProps = defaultObj(customContainerProps);
109
+
104
110
  React.useEffect(()=>{
105
111
  Preloader.closeAll();
106
112
  /*** pour initializer les cordonnées du composant login */
@@ -191,13 +197,22 @@ export default function LoginComponent(props){
191
197
  });
192
198
  const withScrollView = typeof customWithScrollView =='boolean'? customWithScrollView : true;
193
199
  const Wrapper = withPortal ? ScreenWithoutAuthContainer : withScrollView ? ScrollView: View;
200
+ const mQueryUpdateProps = (a)=>{
201
+ const style = StyleSheet.flatten([updateMediaQueryStyle(),containerProps.style]);
202
+ if(typeof containerProps.updateMediaQueryStyle =='function'){
203
+ return containerProps.updateMediaQueryStyle({style})
204
+ }
205
+ return {style};
206
+ };
194
207
  const wrapperProps = withPortal ? {appBarProps,authRequired:false,title:loginTitle,withScrollView} : { style:styles.wrapper};
208
+ const sH = React.isComponent(HeaderTopContent)? <HeaderTopContent
209
+ mediaQueryUpdateNativeProps = {mQueryUpdateProps}
210
+ /> : React.isValidElement(HeaderTopContent)? HeaderTopContent : null;
195
211
  return <Wrapper testID = {testID+"_Wrapper" }{...wrapperProps}>
196
212
  <DialogProvider ref={dialogProviderRef}/>
213
+ {sH}
197
214
  <Surface style={[styles.container,{backgroundColor}]} testID={testID}>
198
- <Surface elevation = {0} mediaQueryUpdateNativeProps = {(a)=>{
199
- return {style:updateMediaQueryStyle()}
200
- }} testID={testID+"_Content"} style={[styles.content,updateMediaQueryStyle(),{backgroundColor}]}>
215
+ <Surface elevation = {0} {...containerProps} mediaQueryUpdateNativeProps = {mQueryUpdateProps} {...containerProps} testID={testID+"_Content"} style={[styles.content,updateMediaQueryStyle(),{backgroundColor},containerProps.style]}>
201
216
  <FormData
202
217
  formName = {formName}
203
218
  testID = {testID+"_FormData"}
@@ -1,5 +1,5 @@
1
1
  ///@see : https://github.com/vivaxy/react-native-auto-height-image
2
- import React, { useEffect, useState, useRef } from 'react';
2
+ import React, { useEffect, useState, useRef } from '$react';
3
3
  import ImagePolyfill from './ImagePolyfill';
4
4
  import AnimatableImage from './AnimatableImage';
5
5
  import PropTypes from 'prop-types';
@@ -22,6 +22,7 @@ function AutoHeightImage(props) {
22
22
  maxHeight,
23
23
  onError,
24
24
  testID:cTestID,
25
+ preloader,
25
26
  ...rest
26
27
  } = props;
27
28
  const [height, setHeight] = useState(
@@ -29,14 +30,14 @@ function AutoHeightImage(props) {
29
30
  DEFAULT_HEIGHT
30
31
  );
31
32
  const mountedRef = useRef(false);
32
-
33
- useEffect(function () {
33
+ const toolgeMounted = function () {
34
34
  mountedRef.current = true;
35
35
  return function () {
36
36
  mountedRef.current = false;
37
37
  };
38
- }, []);
39
-
38
+ }
39
+ useEffect(toolgeMounted,[])
40
+ React.useOnRender(toolgeMounted,0);
40
41
  useEffect(
41
42
  function () {
42
43
  (async function () {
@@ -75,7 +76,7 @@ function AutoHeightImage(props) {
75
76
  onError={onError}
76
77
  {...rest}
77
78
  />
78
- {!mountedRef.current ? <ActivityIndicator testID={testID+"_ActivityIndicator"} color={theme.colors.primary}/> : null}
79
+ {!mountedRef.current && preloader !== false && (!width || !height) ? <ActivityIndicator testID={testID+"_ActivityIndicator"} color={theme.colors.primary}/> : null}
79
80
  </View>
80
81
  );
81
82
  }
@@ -85,13 +86,15 @@ AutoHeightImage.propTypes = {
85
86
  width: PropTypes.number.isRequired,
86
87
  maxHeight: PropTypes.number,
87
88
  onHeightChange: PropTypes.func,
88
- animated: PropTypes.bool
89
+ animated: PropTypes.bool,
90
+ preloader : PropTypes.bool,//si l'on affichera le preloader
89
91
  };
90
92
 
91
93
  AutoHeightImage.defaultProps = {
92
94
  maxHeight: Infinity,
93
95
  onHeightChange: NOOP,
94
- animated: false
96
+ animated: false,
97
+ preloader : true,
95
98
  };
96
99
 
97
100
  export default AutoHeightImage;