@fto-consult/expo-ui 5.0.3 → 5.2.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/babel.config.js +11 -18
- package/compiler.config.js +12 -6
- package/copy-env-file.js +22 -0
- package/electron/index.js +0 -1
- package/electron/preload.js +1 -1
- package/metro.config.js +7 -3
- package/package.json +3 -3
- package/process.browser.js +184 -0
- package/readMe.md +1 -1
- package/src/App.js +2 -2
- package/src/components/PhoneInput/index.js +18 -10
- package/src/components/TextField/index.js +7 -3
- package/src/index.js +3 -3
- package/src/navigation/index.js +0 -1
- package/webpack.config.js +31 -16
package/babel.config.js
CHANGED
|
@@ -2,30 +2,19 @@ module.exports = function(api,opts) {
|
|
|
2
2
|
opts = typeof opts =='object' && opts ? opts : {};
|
|
3
3
|
api = api && typeof api =='object'? api : {};
|
|
4
4
|
///les chemin vers la variable d'environnement, le chemin du fichier .env,@see : https://github.com/brysgo/babel-plugin-inline-dotenv
|
|
5
|
-
let environmentPath = opts.environmentPath || opts.envPath;
|
|
6
5
|
//console.log(environmentPath," is envvv ",opts);
|
|
7
6
|
const path = require("path");
|
|
8
7
|
const fs = require("fs");
|
|
9
8
|
const dir = path.resolve(__dirname);
|
|
10
9
|
typeof api.cache =='function' && api.cache(true);
|
|
11
|
-
const inlineDovOptions = {};
|
|
10
|
+
const inlineDovOptions = { unsafe: true};
|
|
12
11
|
const options = {base:dir,...opts,platform:"expo"};
|
|
13
|
-
|
|
14
|
-
if(
|
|
15
|
-
|
|
16
|
-
environmentPath = path.resolve(baseStr,".env");
|
|
17
|
-
} else {
|
|
18
|
-
environmentPath = "";
|
|
19
|
-
}
|
|
20
|
-
if(environmentPath && fs.existsSync(environmentPath)){
|
|
21
|
-
// File ".env" will be created or overwritten by default.
|
|
22
|
-
try {
|
|
23
|
-
fs.copyFileSync(environmentPath, path.resolve(dir,'.env'));
|
|
24
|
-
}
|
|
25
|
-
catch (e){
|
|
26
|
-
inlineDovOptions.path = environmentPath;
|
|
27
|
-
}
|
|
12
|
+
const environmentPath = require("./copy-env-file")();
|
|
13
|
+
if(fs.existsSync(environmentPath)){
|
|
14
|
+
inlineDovOptions.path ='./.env';
|
|
28
15
|
}
|
|
16
|
+
/*** par défaut, les variables d'environnements sont stockés dans le fichier .env situé à la racine du projet, référencée par la prop base */
|
|
17
|
+
|
|
29
18
|
const alias = require("./babel.config.alias")(options);
|
|
30
19
|
return {
|
|
31
20
|
presets: [
|
|
@@ -36,7 +25,11 @@ module.exports = function(api,opts) {
|
|
|
36
25
|
["inline-dotenv",inlineDovOptions],
|
|
37
26
|
["module-resolver", {"alias": alias}],
|
|
38
27
|
['@babel/plugin-proposal-export-namespace-from'],
|
|
39
|
-
['transform-inline-environment-variables'
|
|
28
|
+
['transform-inline-environment-variables',{
|
|
29
|
+
"include": [
|
|
30
|
+
"NODE_ENV"
|
|
31
|
+
]
|
|
32
|
+
}],
|
|
40
33
|
['react-native-reanimated/plugin'],
|
|
41
34
|
],
|
|
42
35
|
};
|
package/compiler.config.js
CHANGED
|
@@ -4,22 +4,28 @@ module.exports = function({config,nodeModulesPath}){
|
|
|
4
4
|
const expoUi = path.resolve(require("./expo-ui-path")());
|
|
5
5
|
nodeModulesPath = Array.isArray(nodeModulesPath)? nodeModulesPath : [];
|
|
6
6
|
config.resolve.modules = Array.isArray(config.resolve.modules)? config.resolve.modules:[]
|
|
7
|
-
config.resolve.modules = [path.resolve(base, 'node_modules'),
|
|
7
|
+
config.resolve.modules = [path.resolve(base, 'node_modules'),path.resolve(expoUi,"node_modules"),...nodeModulesPath,...config.resolve.modules];
|
|
8
8
|
config.module.rules.push({
|
|
9
9
|
test: /\.(js|jsx|ts|tsx)$/,
|
|
10
|
+
type: "javascript/auto",
|
|
10
11
|
include: [
|
|
11
12
|
base,
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
/node_modules\/@fto-consult/,
|
|
14
|
+
expoUi,
|
|
14
15
|
],
|
|
15
16
|
exclude:[
|
|
16
|
-
path.resolve(base,"nodes_modules"),
|
|
17
|
-
path.resolve(expoUi,"node_modules"),
|
|
18
17
|
/node_modules[/\\](?!react-native-paper|react-native|react-native-vector-icons|react-native-safe-area-view)/,
|
|
19
|
-
/(node_modules)/
|
|
20
18
|
],
|
|
21
19
|
use: {
|
|
22
20
|
loader: 'babel-loader',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
config.module.rules.push({
|
|
24
|
+
test: /\.mjs$/,
|
|
25
|
+
include: /node_modules/,
|
|
26
|
+
type: 'javascript/auto',
|
|
27
|
+
resolve: {
|
|
28
|
+
fullySpecified: false
|
|
23
29
|
}
|
|
24
30
|
});
|
|
25
31
|
config.plugins.push(require("@fto-consult/common/circular-dependencies"));
|
package/copy-env-file.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const writeFile = require("./electron/utils/writeFile");
|
|
4
|
+
/*** create and copy environment path to this directory
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
module.exports = (projectRoot,forceCreate)=>{
|
|
8
|
+
projectRoot = projectRoot && typeof projectRoot =="string" && fs.existsSync(projectRoot) && projectRoot || process.cwd();
|
|
9
|
+
const environmentPath = path.resolve(projectRoot,".env");
|
|
10
|
+
const localEnv = path.resolve(__dirname,".env");
|
|
11
|
+
if(environmentPath && fs.existsSync(environmentPath)){
|
|
12
|
+
// File ".env" will be created or overwritten by default.
|
|
13
|
+
try {
|
|
14
|
+
fs.copyFileSync(environmentPath, localEnv,fs.constants.COPYFILE_FICLONE_FORCE);
|
|
15
|
+
}
|
|
16
|
+
catch (e){}
|
|
17
|
+
}
|
|
18
|
+
if(!fs.existsSync(localEnv) && forceCreate !==false){
|
|
19
|
+
writeFile(localEnv,"");
|
|
20
|
+
}
|
|
21
|
+
return localEnv;
|
|
22
|
+
}
|
package/electron/index.js
CHANGED
package/electron/preload.js
CHANGED
|
@@ -93,7 +93,7 @@ const removeListener = (channel, callback) => {
|
|
|
93
93
|
};
|
|
94
94
|
const ELECTRON = {
|
|
95
95
|
get getPouchdb(){
|
|
96
|
-
return (PouchDB,sqlPouch)=> {
|
|
96
|
+
return ({PouchDB,sqlPouch})=> {
|
|
97
97
|
window.sqlitePlugin = {openDatabase:require('websql')};
|
|
98
98
|
PouchDB.plugin(function CapacitorSqlitePlugin (PouchDB) {
|
|
99
99
|
PouchDB.adapter('node-sqlite', sqlPouch(), true)
|
package/metro.config.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
const { getDefaultConfig } = require('@expo/metro-config');
|
|
2
1
|
const path = require("path");
|
|
2
|
+
const fs = require("fs");
|
|
3
3
|
module.exports = function(opts){
|
|
4
|
+
const nodeModulePath = `${process.cwd()}/node_modules`;
|
|
5
|
+
const mConfigPath = fs.existsSync(`${nodeModulePath}/@expo/metro-config`) && `${nodeModulePath}/@expo/metro-config` || "@expo/metro-config";
|
|
6
|
+
const { getDefaultConfig } = require(`${mConfigPath}`);
|
|
7
|
+
|
|
4
8
|
opts = opts && typeof opts =='object'? opts : {};
|
|
5
9
|
let {assetExts,sourceExts} = opts;
|
|
6
10
|
assetExts = Array.isArray(assetExts)? assetExts: [];
|
|
@@ -26,11 +30,11 @@ module.exports = function(opts){
|
|
|
26
30
|
]
|
|
27
31
|
// Remove all console logs in production...
|
|
28
32
|
config.transformer.minifierConfig.compress.drop_console = false;
|
|
29
|
-
config.platforms = Array.isArray(config.platforms) && config.platforms || [];
|
|
33
|
+
/*config.platforms = Array.isArray(config.platforms) && config.platforms || [];
|
|
30
34
|
['ios', 'android', 'windows', 'web',"electron"].map(p=>{
|
|
31
35
|
if(!config.platforms.includes(p)){
|
|
32
36
|
config.platforms.push(p);
|
|
33
37
|
}
|
|
34
|
-
})
|
|
38
|
+
});*/
|
|
35
39
|
return config;
|
|
36
40
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.2.0",
|
|
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
|
"@emotion/native": "^11.10.0",
|
|
62
62
|
"@expo/html-elements": "^0.2.0",
|
|
63
63
|
"@expo/vector-icons": "^13.0.0",
|
|
64
|
-
"@fto-consult/common": "^2.
|
|
64
|
+
"@fto-consult/common": "^2.21.4",
|
|
65
65
|
"@gorhom/portal": "^1.0.14",
|
|
66
66
|
"@react-native-async-storage/async-storage": "^1.17.11",
|
|
67
67
|
"@react-native-community/datetimepicker": "^6.7.3",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@react-navigation/native": "^6.1.1",
|
|
71
71
|
"@react-navigation/native-stack": "^6.9.7",
|
|
72
72
|
"@shopify/flash-list": "^1.4.0",
|
|
73
|
-
"expo": "^48.0.
|
|
73
|
+
"expo": "^48.0.7",
|
|
74
74
|
"expo-camera": "~13.2.1",
|
|
75
75
|
"expo-clipboard": "~4.1.1",
|
|
76
76
|
"expo-font": "~11.1.1",
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// shim for using process in browser
|
|
2
|
+
var process = module.exports = {};
|
|
3
|
+
|
|
4
|
+
// cached from whatever global is present so that test runners that stub it
|
|
5
|
+
// don't break things. But we need to wrap it in a try catch in case it is
|
|
6
|
+
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
7
|
+
// function because try/catches deoptimize in certain engines.
|
|
8
|
+
|
|
9
|
+
var cachedSetTimeout;
|
|
10
|
+
var cachedClearTimeout;
|
|
11
|
+
|
|
12
|
+
function defaultSetTimout() {
|
|
13
|
+
throw new Error('setTimeout has not been defined');
|
|
14
|
+
}
|
|
15
|
+
function defaultClearTimeout () {
|
|
16
|
+
throw new Error('clearTimeout has not been defined');
|
|
17
|
+
}
|
|
18
|
+
(function () {
|
|
19
|
+
try {
|
|
20
|
+
if (typeof setTimeout === 'function') {
|
|
21
|
+
cachedSetTimeout = setTimeout;
|
|
22
|
+
} else {
|
|
23
|
+
cachedSetTimeout = defaultSetTimout;
|
|
24
|
+
}
|
|
25
|
+
} catch (e) {
|
|
26
|
+
cachedSetTimeout = defaultSetTimout;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
if (typeof clearTimeout === 'function') {
|
|
30
|
+
cachedClearTimeout = clearTimeout;
|
|
31
|
+
} else {
|
|
32
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
33
|
+
}
|
|
34
|
+
} catch (e) {
|
|
35
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
36
|
+
}
|
|
37
|
+
} ())
|
|
38
|
+
function runTimeout(fun) {
|
|
39
|
+
if (cachedSetTimeout === setTimeout) {
|
|
40
|
+
//normal enviroments in sane situations
|
|
41
|
+
return setTimeout(fun, 0);
|
|
42
|
+
}
|
|
43
|
+
// if setTimeout wasn't available but was latter defined
|
|
44
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
45
|
+
cachedSetTimeout = setTimeout;
|
|
46
|
+
return setTimeout(fun, 0);
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
50
|
+
return cachedSetTimeout(fun, 0);
|
|
51
|
+
} catch(e){
|
|
52
|
+
try {
|
|
53
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
54
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
55
|
+
} catch(e){
|
|
56
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
57
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
function runClearTimeout(marker) {
|
|
64
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
65
|
+
//normal enviroments in sane situations
|
|
66
|
+
return clearTimeout(marker);
|
|
67
|
+
}
|
|
68
|
+
// if clearTimeout wasn't available but was latter defined
|
|
69
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
70
|
+
cachedClearTimeout = clearTimeout;
|
|
71
|
+
return clearTimeout(marker);
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
75
|
+
return cachedClearTimeout(marker);
|
|
76
|
+
} catch (e){
|
|
77
|
+
try {
|
|
78
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
79
|
+
return cachedClearTimeout.call(null, marker);
|
|
80
|
+
} catch (e){
|
|
81
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
82
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
83
|
+
return cachedClearTimeout.call(this, marker);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
var queue = [];
|
|
91
|
+
var draining = false;
|
|
92
|
+
var currentQueue;
|
|
93
|
+
var queueIndex = -1;
|
|
94
|
+
|
|
95
|
+
function cleanUpNextTick() {
|
|
96
|
+
if (!draining || !currentQueue) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
draining = false;
|
|
100
|
+
if (currentQueue.length) {
|
|
101
|
+
queue = currentQueue.concat(queue);
|
|
102
|
+
} else {
|
|
103
|
+
queueIndex = -1;
|
|
104
|
+
}
|
|
105
|
+
if (queue.length) {
|
|
106
|
+
drainQueue();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function drainQueue() {
|
|
111
|
+
if (draining) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
115
|
+
draining = true;
|
|
116
|
+
|
|
117
|
+
var len = queue.length;
|
|
118
|
+
while(len) {
|
|
119
|
+
currentQueue = queue;
|
|
120
|
+
queue = [];
|
|
121
|
+
while (++queueIndex < len) {
|
|
122
|
+
if (currentQueue) {
|
|
123
|
+
currentQueue[queueIndex].run();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
queueIndex = -1;
|
|
127
|
+
len = queue.length;
|
|
128
|
+
}
|
|
129
|
+
currentQueue = null;
|
|
130
|
+
draining = false;
|
|
131
|
+
runClearTimeout(timeout);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
process.nextTick = function (fun) {
|
|
135
|
+
var args = new Array(arguments.length - 1);
|
|
136
|
+
if (arguments.length > 1) {
|
|
137
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
138
|
+
args[i - 1] = arguments[i];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
queue.push(new Item(fun, args));
|
|
142
|
+
if (queue.length === 1 && !draining) {
|
|
143
|
+
runTimeout(drainQueue);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// v8 likes predictible objects
|
|
148
|
+
function Item(fun, array) {
|
|
149
|
+
this.fun = fun;
|
|
150
|
+
this.array = array;
|
|
151
|
+
}
|
|
152
|
+
Item.prototype.run = function () {
|
|
153
|
+
this.fun.apply(null, this.array);
|
|
154
|
+
};
|
|
155
|
+
process.title = 'browser';
|
|
156
|
+
process.browser = true;
|
|
157
|
+
process.env = {};
|
|
158
|
+
process.argv = [];
|
|
159
|
+
process.version = ''; // empty string to avoid regexp issues
|
|
160
|
+
process.versions = {};
|
|
161
|
+
|
|
162
|
+
function noop() {}
|
|
163
|
+
|
|
164
|
+
process.on = noop;
|
|
165
|
+
process.addListener = noop;
|
|
166
|
+
process.once = noop;
|
|
167
|
+
process.off = noop;
|
|
168
|
+
process.removeListener = noop;
|
|
169
|
+
process.removeAllListeners = noop;
|
|
170
|
+
process.emit = noop;
|
|
171
|
+
process.prependListener = noop;
|
|
172
|
+
process.prependOnceListener = noop;
|
|
173
|
+
|
|
174
|
+
process.listeners = function (name) { return [] }
|
|
175
|
+
|
|
176
|
+
process.binding = function (name) {
|
|
177
|
+
throw new Error('process.binding is not supported');
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
process.cwd = function () { return '/' };
|
|
181
|
+
process.chdir = function (dir) {
|
|
182
|
+
throw new Error('process.chdir is not supported');
|
|
183
|
+
};
|
|
184
|
+
process.umask = function() { return 0; };
|
package/readMe.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
## Installation des dépendences, packages de dévéloppement
|
|
2
2
|
|
|
3
3
|
```javascript
|
|
4
|
-
npm i --D @babel/plugin-proposal-export-namespace-from
|
|
4
|
+
npm i --D @babel/plugin-proposal-export-namespace-from @babel/preset-react babel-plugin-inline-dotenv babel-plugin-module-resolver babel-plugin-transform-inline-environment-variables @expo/metro-config @expo/webpack-config
|
|
5
5
|
```
|
|
6
6
|
|
|
7
7
|
## **#ELECTRON**
|
package/src/App.js
CHANGED
|
@@ -40,7 +40,7 @@ Object.map(Utils,(v,i)=>{
|
|
|
40
40
|
window[i] = v;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
export default function getIndex({onMount,onUnmount,onRender,preferences:appPreferences}){
|
|
43
|
+
export default function getIndex({onMount,onUnmount,onRender,preferences:appPreferences,...rest}){
|
|
44
44
|
const isScreenFocusedRef = React.useRef(true);
|
|
45
45
|
///garde pour chaque écran sa date de dernière activité
|
|
46
46
|
const screensRef = React.useRef({});//la liste des écrans actifs
|
|
@@ -186,7 +186,7 @@ export default function getIndex({onMount,onUnmount,onRender,preferences:appPref
|
|
|
186
186
|
<DialogProvider responsive/>
|
|
187
187
|
<AlertProvider SimpleSelect={SimpleSelect}/>
|
|
188
188
|
<FormDataDialogProvider/>
|
|
189
|
-
{<Index theme={theme}/>}
|
|
189
|
+
{<Index {...rest} theme={theme}/>}
|
|
190
190
|
<ErrorBoundaryProvider/>
|
|
191
191
|
<BottomSheetProvider/>
|
|
192
192
|
</PreferencesContext.Provider>
|
|
@@ -10,6 +10,9 @@ import PhoneNumber from "./PhoneNumber";
|
|
|
10
10
|
import SelectCountry from "$ecomponents/Countries/SelectCountry";
|
|
11
11
|
import {getFlag} from "$ecomponents/Countries";
|
|
12
12
|
|
|
13
|
+
export {PhoneNumber};
|
|
14
|
+
export * from "./PhoneNumber";
|
|
15
|
+
|
|
13
16
|
import libPhoneNumber from 'google-libphonenumber';
|
|
14
17
|
const asYouTypeFormatter = libPhoneNumber.AsYouTypeFormatter;
|
|
15
18
|
|
|
@@ -116,6 +119,7 @@ export default function PhoneInputComponent(props){
|
|
|
116
119
|
country : iso2,
|
|
117
120
|
displayValue,
|
|
118
121
|
defaultValue : modifiedNumber,
|
|
122
|
+
countryDialCode
|
|
119
123
|
}
|
|
120
124
|
setState(nState);
|
|
121
125
|
return nState;
|
|
@@ -137,6 +141,9 @@ export default function PhoneInputComponent(props){
|
|
|
137
141
|
<>
|
|
138
142
|
<TextField
|
|
139
143
|
{...rest}
|
|
144
|
+
toCase = {(val)=>{
|
|
145
|
+
return (val.startsWith("+")?"+":"")+val.replace(/[^\s0-9]/g, '');
|
|
146
|
+
}}
|
|
140
147
|
testID = {testID}
|
|
141
148
|
error = {error}
|
|
142
149
|
errorText = {errorText}
|
|
@@ -162,18 +169,19 @@ export default function PhoneInputComponent(props){
|
|
|
162
169
|
}
|
|
163
170
|
keyboardType ={keyboardTypes.number}
|
|
164
171
|
defaultValue = {state.displayValue}
|
|
165
|
-
onChange = {(
|
|
172
|
+
onChange = {(args)=>{
|
|
173
|
+
const {value:nValue} = args;
|
|
166
174
|
const prevState = state;
|
|
167
175
|
const nState = updateValue(nValue);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
let value = defaultStr(nState.defaultValue).trim();
|
|
177
|
+
if(prevState.defaultValue === value) return;
|
|
178
|
+
if(value =="+" || value =="("){
|
|
179
|
+
value = "";
|
|
180
|
+
}
|
|
181
|
+
if(prevState.defaultValue === value) return;
|
|
182
|
+
if(onChange){
|
|
183
|
+
onChange({...nState,value,country:nState.country,displayValue:nState.displayValue,realValue:nState.defaultValue})
|
|
184
|
+
}
|
|
177
185
|
}}
|
|
178
186
|
ref = {ref}
|
|
179
187
|
style = {[props.style,inputProps.style,disabledStyle]}
|
|
@@ -31,7 +31,7 @@ const isIos = _isIos();
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
34
|
-
let {defaultValue,color,validType,validRule,placeholder,outlined,placeholderColor,
|
|
34
|
+
let {defaultValue,toCase:toCustomCase,color,validType,validRule,placeholder,outlined,placeholderColor,
|
|
35
35
|
label,labelProps,labelStyle,fontSize,containerProps,selection,roundness,
|
|
36
36
|
autoCapitalize,disabled,editable,readOnly,elevation,divider,render,
|
|
37
37
|
leftContainerProps,left,right,rightContainerProps,rows,
|
|
@@ -149,8 +149,11 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
|
149
149
|
if(t === emptyValue){
|
|
150
150
|
t = "";
|
|
151
151
|
}
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
const ret = ((upper !== true && lower !== true) || isAndroid) ? (typeof t =='string'? t : "") : (isNonNullString(t)? (upper ? t.toUpperCase() : lower ? t.toLowerCase():t) : "");
|
|
153
|
+
if(toCustomCase){
|
|
154
|
+
toCustomCase(ret);
|
|
155
|
+
}
|
|
156
|
+
return ret;
|
|
154
157
|
};
|
|
155
158
|
const [text, _setText] = React.useState(toCase(defaultValue));
|
|
156
159
|
const previousText = React.usePrevious(text);
|
|
@@ -748,5 +751,6 @@ TextFieldComponent.propTypes = {
|
|
|
748
751
|
///le style à afficher sur l'affix
|
|
749
752
|
affixStyle : PropTypes.object,
|
|
750
753
|
handleOpacity : PropTypes.bool,///si l'opacité sera géré automatiquement en fonction du status disabled de la textField
|
|
754
|
+
toCase : PropTypes.func,
|
|
751
755
|
};
|
|
752
756
|
|
package/src/index.js
CHANGED
|
@@ -33,7 +33,7 @@ const resetExitCounter = ()=>{
|
|
|
33
33
|
|
|
34
34
|
const NAVIGATION_PERSISTENCE_KEY = 'NAVIGATION_STATE';
|
|
35
35
|
|
|
36
|
-
function App(
|
|
36
|
+
function App({init:initApp}) {
|
|
37
37
|
AppStateService.init();
|
|
38
38
|
const [initialState, setInitialState] = React.useState(undefined);
|
|
39
39
|
const appReadyRef = React.useRef(true);
|
|
@@ -156,9 +156,9 @@ function App(props) {
|
|
|
156
156
|
console.log(e," is net info heinn")
|
|
157
157
|
});
|
|
158
158
|
loadResources().finally(()=>{
|
|
159
|
-
init().then(()=>{
|
|
159
|
+
(typeof initApp =='function'?initApp : init)().then(()=>{
|
|
160
160
|
if(Auth.isLoggedIn()){
|
|
161
|
-
|
|
161
|
+
Auth.loginUser(false);
|
|
162
162
|
}
|
|
163
163
|
setState({
|
|
164
164
|
...state,isInitialized:true,isLoading : false,
|
package/src/navigation/index.js
CHANGED
|
@@ -16,7 +16,6 @@ export default function NavigationComponent (props){
|
|
|
16
16
|
const drawerScreens = handleContent({screens:allScreens,hasGetStarted,initialRouteName,state,Factory:Stack});
|
|
17
17
|
const stackScreens = handleContent({screens:allScreens.modals,hasGetStarted,initialRouteName,state,Factory:Stack});
|
|
18
18
|
if(!drawerScreens.length && !stackScreens.length){
|
|
19
|
-
willRenderNavigation = false;
|
|
20
19
|
console.error("apps will stuck on splash screen because any valid screen has been found on screens ",allScreens);
|
|
21
20
|
}
|
|
22
21
|
setInitialRouteName(initialRouteName);
|
package/webpack.config.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
/**@see : https://www.npmjs.com/package/@expo/webpack-config
|
|
2
|
-
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
|
|
3
|
-
const path = require("path");
|
|
1
|
+
/**@see : https://www.npmjs.com/package/@expo/webpack-config */
|
|
4
2
|
const isObj = x => x && typeof x =='object' && !Array.isArray(x);
|
|
5
|
-
const webpack = require("webpack");
|
|
3
|
+
//const webpack = require("webpack");
|
|
6
4
|
const fs = require("fs");
|
|
7
|
-
const writeFile = require("./electron/utils/writeFile");
|
|
8
5
|
const supportedPlatforms = ["web","electron"];
|
|
6
|
+
const mainExtensions = [".js", ".jsx",".ts",".tsx",".mjs"];
|
|
7
|
+
const path = require("path");
|
|
8
|
+
|
|
9
9
|
// Expo CLI will await this method so you can optionally return a promise.
|
|
10
10
|
module.exports = async function(env, argv,opts) {
|
|
11
|
+
const nodeModulePath = `${process.cwd()}/node_modules`;
|
|
12
|
+
const wConfigPath = fs.existsSync(`${nodeModulePath}/@expo/webpack-config`) && `${nodeModulePath}/@expo/webpack-config` || "@expo/webpack-config";
|
|
13
|
+
const webpackPath = fs.existsSync(`${nodeModulePath}/webpack`) && `${nodeModulePath}/webpack` || "webpack";
|
|
14
|
+
const webpack = require(`${webpackPath}`);
|
|
15
|
+
const createExpoWebpackConfigAsync = require(wConfigPath);
|
|
11
16
|
env = env || {};
|
|
12
17
|
opts = typeof opts =="object" && opts ? opts : {};
|
|
13
18
|
const babel = isObj(opts.babel)? opts.babel : {};
|
|
@@ -18,7 +23,6 @@ module.exports = async function(env, argv,opts) {
|
|
|
18
23
|
env.pwa = false;
|
|
19
24
|
}
|
|
20
25
|
const platform = isElectron && "electron" || process.env.platform && supportedPlatforms.includes(process.platform) && process.platform || typeof opts.platform =="string" && supportedPlatforms.includes(opts.platform)? opts.platform : "web";
|
|
21
|
-
//writeFile(path.resolve(__dirname,"is-electron-platform.txt"),`platform = ${process.env.platform} and is electron = true ${process.env.isElectron}`)
|
|
22
26
|
const transpileModules = Array.isArray(opts.transpileModules)? opts.transpileModules : [];
|
|
23
27
|
const projectRoot = opts.projectRoot && typeof opts.projectRoot =="string" && fs.existsSync(opts.projectRoot) && opts.projectRoot || process.cwd();
|
|
24
28
|
const config = await createExpoWebpackConfigAsync(
|
|
@@ -44,7 +48,6 @@ module.exports = async function(env, argv,opts) {
|
|
|
44
48
|
type: "javascript/auto",
|
|
45
49
|
use: {loader: 'babel-loader'}
|
|
46
50
|
});
|
|
47
|
-
//config.resolve.alias['moduleA'] = 'moduleB';
|
|
48
51
|
config.mode = (config.mode =="development" || config.mode =='production') ? config.mode : "development";
|
|
49
52
|
// Maybe you want to turn off compression in dev mode.
|
|
50
53
|
if (config.mode === 'development') {
|
|
@@ -60,15 +63,27 @@ module.exports = async function(env, argv,opts) {
|
|
|
60
63
|
config.performance.maxAssetSize = typeof config.performance.maxAssetSize =='number'? config.performance.maxAssetSize : 512000;
|
|
61
64
|
config.devtool = (config.mode === 'development') ? 'inline-source-map' : false;
|
|
62
65
|
require("./compiler.config.js")({config,...opts});
|
|
63
|
-
|
|
64
|
-
config.
|
|
65
|
-
process: 'process/browser',
|
|
66
|
-
}));
|
|
66
|
+
const envPath = require("./copy-env-file")();
|
|
67
|
+
const extensions = config.resolve.extensions;
|
|
67
68
|
if(isElectron){
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
mainExtensions.map((ex)=>{
|
|
70
|
+
const nExt = `.electron${ex}`;
|
|
71
|
+
if(!extensions.includes(nExt)){
|
|
72
|
+
extensions.unshift(nExt);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
//const electronPath = process.cwd();
|
|
76
|
+
//config.output = config.output || {};
|
|
77
|
+
//config.output.publicPath = "./";
|
|
78
|
+
//config.output.path = path.join(electronPath,"dist");
|
|
79
|
+
//writeFile(path.resolve(__dirname,"is-electron-platform.txt"),` ${JSON.stringify(extensions)} is extensions to resolve`)
|
|
72
80
|
}
|
|
81
|
+
//fix process is not defined
|
|
82
|
+
config.plugins.unshift(new webpack.ProvidePlugin({
|
|
83
|
+
process: 'process/browser',
|
|
84
|
+
}));
|
|
85
|
+
config.resolve.alias.process = "process/browser";
|
|
86
|
+
config.resolve.fallback = typeof config.resolve.fallback =="object" && config.resolve.fallback || {};
|
|
87
|
+
config.resolve.fallback = {...config.resolve.fallback,process: require.resolve('process/browser')};
|
|
73
88
|
return config;
|
|
74
|
-
}
|
|
89
|
+
};;
|