@wavemaker/rn-codegen 11.4.0-next.28152 → 11.4.0-rc.121
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.
- rn-codegen/command.js +12 -5
- rn-codegen/command.js.map +1 -1
- rn-codegen/index.js +1 -1
- rn-codegen/index.js.map +1 -1
- rn-codegen/package.json +3 -1
- rn-codegen/src/app.generator.js +71 -16
- rn-codegen/src/app.generator.js.map +1 -1
- rn-codegen/src/project.service.js +10 -0
- rn-codegen/src/project.service.js.map +1 -1
- rn-codegen/src/templates/app.template +40 -12
- rn-codegen/src/templates/app.theme.template +10 -1
- rn-codegen/src/templates/bootstrap.template +4 -0
- rn-codegen/src/templates/build-info/info.html +64 -0
- rn-codegen/src/templates/component/component.template +4 -2
- rn-codegen/src/templates/entity-provider.template +21 -0
- rn-codegen/src/templates/package.web.json +81 -1
- rn-codegen/src/templates/pages-config.template +0 -8
- rn-codegen/src/templates/project/app.json +2 -0
- rn-codegen/src/templates/project/esbuild/esbuild.script.js +41 -0
- rn-codegen/src/templates/project/index.js +8 -0
- rn-codegen/src/templates/project/metro.config.js +24 -20
- rn-codegen/src/templates/project/package-lock.json +23362 -0
- rn-codegen/src/templates/project/package.json +65 -59
- rn-codegen/src/templates/resource.resolver.template +2 -1
- rn-codegen/src/templates/theme.index.html +132 -0
- rn-codegen/src/templates/variables.template +57 -8
- rn-codegen/src/theme/components/basic/audio.styledef.js +18 -0
- rn-codegen/src/theme/components/basic/audio.styledef.js.map +1 -0
- rn-codegen/src/theme/components/container/tabs/tabheader.styledef.js +16 -0
- rn-codegen/src/theme/components/container/tabs/tabheader.styledef.js.map +1 -1
- rn-codegen/src/theme/components/container/wizard.styledef.js +7 -0
- rn-codegen/src/theme/components/container/wizard.styledef.js.map +1 -1
- rn-codegen/src/theme/components/input/radioset.styledef.js +5 -0
- rn-codegen/src/theme/components/input/radioset.styledef.js.map +1 -1
- rn-codegen/src/theme/components/input/slider.styledef.js +16 -0
- rn-codegen/src/theme/components/input/slider.styledef.js.map +1 -1
- rn-codegen/src/theme/components/input/toggle.styledef.js +8 -1
- rn-codegen/src/theme/components/input/toggle.styledef.js.map +1 -1
- rn-codegen/src/theme/components/style-definition.provider.js +2 -0
- rn-codegen/src/theme/components/style-definition.provider.js.map +1 -1
- rn-codegen/src/theme/theme.service.js +40 -1
- rn-codegen/src/theme/theme.service.js.map +1 -1
- rn-codegen/src/theme/variables.js +10 -1
- rn-codegen/src/theme/variables.js.map +1 -1
- rn-codegen/src/transpile/components/basic/audio.transformer.js +13 -0
- rn-codegen/src/transpile/components/basic/audio.transformer.js.map +1 -0
- rn-codegen/src/transpile/components/data/form/form-action.transformer.js +14 -1
- rn-codegen/src/transpile/components/data/form/form-action.transformer.js.map +1 -1
- rn-codegen/src/transpile/components/data/form/form-field.transformer.js +8 -1
- rn-codegen/src/transpile/components/data/form/form-field.transformer.js.map +1 -1
- rn-codegen/src/transpile/components/data/liveform.transformer.js +147 -0
- rn-codegen/src/transpile/components/data/liveform.transformer.js.map +1 -0
- rn-codegen/src/transpile/components/page/partial-container.transformer.js +2 -1
- rn-codegen/src/transpile/components/page/partial-container.transformer.js.map +1 -1
- rn-codegen/src/transpile/components/prefab/prefab.transformer.js +3 -2
- rn-codegen/src/transpile/components/prefab/prefab.transformer.js.map +1 -1
- rn-codegen/src/transpile/components/transform-register.js +4 -0
- rn-codegen/src/transpile/components/transform-register.js.map +1 -1
- rn-codegen/src/transpile/property/property-parser.js +8 -0
- rn-codegen/src/transpile/property/property-parser.js.map +1 -1
- rn-codegen/src/transpile/transpile.js +8 -3
- rn-codegen/src/transpile/transpile.js.map +1 -1
- rn-codegen/src/utils.js +39 -9
- rn-codegen/src/utils.js.map +1 -1
- rn-codegen/src/variables/variable.transformer.js +43 -7
- rn-codegen/src/variables/variable.transformer.js.map +1 -1
|
@@ -24,8 +24,9 @@ import { ThemeEvent } from '@wavemaker/app-rn-runtime/styles/theme';
|
|
|
24
24
|
import themeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';
|
|
25
25
|
import SecurityService from '@wavemaker/app-rn-runtime/runtime/services/app-security.service';
|
|
26
26
|
import AppI18nService from '@wavemaker/app-rn-runtime/runtime/services/app-i18n.service';
|
|
27
|
+
import WM from '@wavemaker/app-rn-runtime/runtime/platform.api';
|
|
27
28
|
|
|
28
|
-
import { setAppTheme, resolveThemeAsset } from './app.theme';
|
|
29
|
+
import { getThemes, getSelectedTheme, hasAppTheme, setAppTheme, resolveThemeAsset } from './app.theme';
|
|
29
30
|
import styles from './app.style';
|
|
30
31
|
import fontConfig from './font.config';
|
|
31
32
|
import LocaleResolver from './src/resolve/locale.resolver';
|
|
@@ -36,6 +37,7 @@ import bootstrap, { appConfig } from './bootstrap';
|
|
|
36
37
|
import CommonPartial from './src/partials/Common/Common.component';
|
|
37
38
|
import { initialize as initializeDeviceOperations } from './src/device-operation-loader';
|
|
38
39
|
import Lottie from 'lottie-react-native';
|
|
40
|
+
import RNRestart from 'react-native-restart';
|
|
39
41
|
import * as SplashScreen from 'expo-splash-screen';
|
|
40
42
|
|
|
41
43
|
let _reloadApp = null;
|
|
@@ -46,6 +48,7 @@ class App extends BaseApp {
|
|
|
46
48
|
this.reload = () => {
|
|
47
49
|
_reloadApp();
|
|
48
50
|
};
|
|
51
|
+
WM.App = this;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
getSecurityInfo() {
|
|
@@ -108,21 +111,40 @@ class App extends BaseApp {
|
|
|
108
111
|
}));
|
|
109
112
|
}
|
|
110
113
|
|
|
114
|
+
set activeTheme(themeName) {
|
|
115
|
+
this.setTheme(themeName);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
get activeTheme() {
|
|
119
|
+
return getSelectedTheme();
|
|
120
|
+
}
|
|
121
|
+
|
|
111
122
|
setTheme(name) {
|
|
112
123
|
StorageService.setItem('activeTheme', name);
|
|
113
|
-
setAppTheme(name);
|
|
124
|
+
setAppTheme(name).then(() => this.refresh());
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
getTheme() {
|
|
128
|
+
return StorageService.getItem('activeTheme')
|
|
129
|
+
.then(name => {
|
|
130
|
+
return hasAppTheme(name)
|
|
131
|
+
.then((flag) => flag ? name : this.appConfig.appProperties.activeTheme);
|
|
132
|
+
});
|
|
114
133
|
}
|
|
115
134
|
|
|
116
135
|
loadTheme() {
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
.then((theme) => setAppTheme(theme))
|
|
136
|
+
return this.getTheme()
|
|
137
|
+
.then((theme) => setAppTheme(theme))
|
|
120
138
|
}
|
|
121
139
|
|
|
122
140
|
get appLocale() {
|
|
123
141
|
return this.appConfig.appLocale.messages;
|
|
124
142
|
}
|
|
125
143
|
|
|
144
|
+
get themes() {
|
|
145
|
+
return getThemes();
|
|
146
|
+
}
|
|
147
|
+
|
|
126
148
|
bootstrap() {
|
|
127
149
|
const data = getAppVariables(this);
|
|
128
150
|
this.appConfig.theme = this.appConfig.theme.$new('app-styles', styles);
|
|
@@ -168,7 +190,10 @@ class App extends BaseApp {
|
|
|
168
190
|
.then(() => newLocale || AppI18nService.getSelectedLocale())
|
|
169
191
|
.then((newLocale) => newLocale || this.getDefaultLocale())
|
|
170
192
|
.then((newLocale) => {
|
|
171
|
-
AppI18nService.setSelectedLocale(newLocale);
|
|
193
|
+
const needsRestart = AppI18nService.setSelectedLocale(newLocale);
|
|
194
|
+
if(needsRestart){
|
|
195
|
+
RNRestart.Restart();
|
|
196
|
+
}
|
|
172
197
|
this.appConfig.selectedLocale = newLocale;
|
|
173
198
|
{{#if profile.useLocalMetadata}}
|
|
174
199
|
return this.handleLocaleUrl(`i18n/${newLocale}.json`)
|
|
@@ -200,7 +225,9 @@ class App extends BaseApp {
|
|
|
200
225
|
NetworkService.start(this.appConfig)
|
|
201
226
|
{{#if profile.useLocalMetadata}}
|
|
202
227
|
{{else}}
|
|
203
|
-
.then(() =>
|
|
228
|
+
.then(() => {
|
|
229
|
+
NetworkService.connect(true);
|
|
230
|
+
})
|
|
204
231
|
{{/if}}
|
|
205
232
|
.then(() => {console.log('NetworkService started')})
|
|
206
233
|
.then(() => this.loadWmProperties())
|
|
@@ -211,6 +238,7 @@ class App extends BaseApp {
|
|
|
211
238
|
{{/if}}
|
|
212
239
|
.then(() => this.loadTheme())
|
|
213
240
|
.then(() => {console.log('Theme loaded')})
|
|
241
|
+
.then(() => AppI18nService.init())
|
|
214
242
|
.then(() => this.changeLocale())
|
|
215
243
|
.then(() => {console.log('Locale files loaded')})
|
|
216
244
|
.then(() => this.getSecurityInfo())
|
|
@@ -239,11 +267,11 @@ class App extends BaseApp {
|
|
|
239
267
|
}
|
|
240
268
|
|
|
241
269
|
render() {
|
|
242
|
-
return
|
|
243
|
-
<View style=\{{flex: 1}}>
|
|
244
|
-
{ super.renderApp(this.getCommonPartial())}
|
|
270
|
+
return (
|
|
271
|
+
<View dir={AppI18nService.isRTLLocale(this.appConfig.selectedLocale)?'rtl':null} style=\{{flex: 1, backgroundColor: themeVariables.INSTANCE.pageContentBgColor}}>
|
|
272
|
+
{ this.isStarted ? super.renderApp(this.getCommonPartial()) : null}
|
|
245
273
|
</View>
|
|
246
|
-
)
|
|
274
|
+
);
|
|
247
275
|
}
|
|
248
276
|
}
|
|
249
277
|
|
|
@@ -263,7 +291,7 @@ const AnimatedSplash = (props) => {
|
|
|
263
291
|
return (appConfig.splash.src.includes("splash-bg")?
|
|
264
292
|
<ImageBackground source={ResourceResolver.resolve(appConfig.splash.src, appConfig.url)}
|
|
265
293
|
resizeMode="cover"
|
|
266
|
-
style=\{{
|
|
294
|
+
style=\{{ justifyContent: "center", width: '100%', height: '100%' }}>
|
|
267
295
|
<Lottie
|
|
268
296
|
source={ResourceResolver.resolve(appConfig.splash.animationSrc, appConfig.url)}
|
|
269
297
|
autoPlay={true}
|
|
@@ -21,21 +21,30 @@ const themes = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
let selectedTheme = null;
|
|
24
|
+
let selectedThemeName = null;
|
|
24
25
|
let getAsset = null;
|
|
25
26
|
const appTheme = BASE_THEME.$new('app-theme', {});
|
|
26
27
|
export const setAppTheme = (themeName) => {
|
|
27
28
|
return Promise.resolve().then(() => {
|
|
28
29
|
selectedTheme = (themes[themeName]||{})[isIos() ? 'ios': 'android'];
|
|
29
30
|
if (selectedTheme) {
|
|
31
|
+
selectedThemeName = themeName;
|
|
30
32
|
Object.assign(themeVariables.INSTANCE, selectedTheme.variables());
|
|
31
33
|
getAsset = selectedTheme.getAsset();
|
|
32
34
|
if (fontConfig.baseFont) {
|
|
33
35
|
themeVariables.baseFont = fontConfig.baseFont;
|
|
34
36
|
}
|
|
35
|
-
BASE_THEME.reset();
|
|
36
37
|
appTheme.reset(selectedTheme.style());
|
|
38
|
+
BASE_THEME.reset();
|
|
37
39
|
}
|
|
38
40
|
});
|
|
39
41
|
};
|
|
42
|
+
export const hasAppTheme = (themeName) => {
|
|
43
|
+
return Promise.resolve()
|
|
44
|
+
.then(() => !!(themes[themeName]||{})[isIos() ? 'ios': 'android']);
|
|
45
|
+
};
|
|
46
|
+
setAppTheme(Object.keys(themes)[0]);
|
|
47
|
+
export const getThemes = () => Object.keys(themes);
|
|
48
|
+
export const getSelectedTheme = () => selectedThemeName;
|
|
40
49
|
export const resolveThemeAsset = (path) => (getAsset && getAsset(path));
|
|
41
50
|
export default appTheme;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { LogBox } from 'react-native';
|
|
2
2
|
import injector from '@wavemaker/app-rn-runtime/core/injector';
|
|
3
|
+
import Logger from '@wavemaker/app-rn-runtime/core/logger';
|
|
3
4
|
import StorageService from '@wavemaker/app-rn-runtime/core/storage.service';
|
|
4
5
|
import WM from '@wavemaker/app-rn-runtime/runtime/platform.api';
|
|
6
|
+
import AppI18nService from '@wavemaker/app-rn-runtime/runtime/services/app-i18n.service';
|
|
5
7
|
import appTheme from './app.theme';
|
|
6
8
|
import PageConfig from './src/pages/pages-config';
|
|
7
9
|
import PartialConfig from './src/partials/partial-config';
|
|
@@ -25,6 +27,7 @@ appConfig.url = location.href.split('/rn-bundle')[0];
|
|
|
25
27
|
{{/if}}
|
|
26
28
|
|
|
27
29
|
injector.set('APP_CONFIG', appConfig);
|
|
30
|
+
injector.I18nService.set(AppI18nService);
|
|
28
31
|
|
|
29
32
|
global.wm = WM;
|
|
30
33
|
{{#if enableLogs}}
|
|
@@ -35,6 +38,7 @@ axios.defaults.withCredentials = true;
|
|
|
35
38
|
StorageService.target = config.id;
|
|
36
39
|
|
|
37
40
|
const bootstrap = () => {
|
|
41
|
+
Logger.init();
|
|
38
42
|
injector.set('AppConfig', appConfig);
|
|
39
43
|
appConfig.appId = config.id;
|
|
40
44
|
appConfig.pages = PageConfig;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
+
<title>WaveMaker Preview</title>
|
|
6
|
+
<style>
|
|
7
|
+
.show {
|
|
8
|
+
opacity: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.hide {
|
|
12
|
+
opacity: 0;
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body style="height: 100vh; display: flex; padding: 16px;
|
|
18
|
+
justify-content: center; flex-direction: column;
|
|
19
|
+
font-family:Arial, Helvetica, sans-serif;
|
|
20
|
+
background-color: #111; color: #f4f4f4;line-height: 24px;overflow: hidden;">
|
|
21
|
+
<div>
|
|
22
|
+
<b style="color: #82d3e0;">1.</b> Studio web preview is disabled. To enable, visit Project Settings.<br>
|
|
23
|
+
<b style="color: #82d3e0;">2.</b> Otherwise, execute the following command in your local terminal.
|
|
24
|
+
<br>
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
<div style="position: relative;background-color: #ccc;color: #333; padding: 24px 16px 16px 16px;
|
|
28
|
+
border-radius: 8px; font-family:monospace, 'Courier New', Courier;overflow: auto;margin: 8px 0;">
|
|
29
|
+
<div style="position: absolute;top: 0; right: 0; background: #666; padding: 2px 8px; color: #82d3e0;" onclick="copy()">Copy</div>
|
|
30
|
+
<div id="command-info" style="word-break: break-word;"></div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div>
|
|
34
|
+
<b style="color: #82d3e0;">3.</b> Then, open <a style="color: #82d3e0;" href="http://localhost:19009" target="_blank">http://localhost:19009</a> in a web browser.
|
|
35
|
+
<br><span><br><br><br><i style="color: #eee;">To know more, <a
|
|
36
|
+
href="https://docs.wavemaker.com/learn/react-native/generate-web-preview-locally" target="_blank"
|
|
37
|
+
style="color: #82d3e0;">please visit this link</a>.</i></span>
|
|
38
|
+
<span style="display:none">Modified at : {{modified_date}}</span>
|
|
39
|
+
</div>
|
|
40
|
+
<div id="message" style="position: fixed; top: 0; right: 0;
|
|
41
|
+
background: #eee; color: #666; padding: 16px; left: 0;
|
|
42
|
+
margin: 4pt; border-radius: 4pt;transition: opacity linear 1s;" class="hide">
|
|
43
|
+
Copied !!!
|
|
44
|
+
</div>
|
|
45
|
+
<script>
|
|
46
|
+
var div = document.getElementById('command-info');
|
|
47
|
+
|
|
48
|
+
function copy() {
|
|
49
|
+
// Copy the text inside the text field
|
|
50
|
+
navigator.clipboard.writeText(div.innerText);
|
|
51
|
+
document.getElementById('message').classList.remove('hide');
|
|
52
|
+
}
|
|
53
|
+
var xhr = new XMLHttpRequest();
|
|
54
|
+
xhr.onreadystatechange = function() {
|
|
55
|
+
if (xhr.readyState == XMLHttpRequest.DONE) {
|
|
56
|
+
div.innerText = `wm-reactnative run web-preview "${location.href.split('/rn-bundle')[0]}#${xhr.responseText.split(';')[0]}"`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
xhr.open('GET', '/studio/services/auth/token', true);
|
|
60
|
+
xhr.send(null);
|
|
61
|
+
</script>
|
|
62
|
+
</body>
|
|
63
|
+
|
|
64
|
+
</html>
|
|
@@ -74,7 +74,7 @@ export default class {{name}}{{typeLabel}} extends Base{{typeLabel}} {
|
|
|
74
74
|
{{/ifEquals}}
|
|
75
75
|
|
|
76
76
|
init() {
|
|
77
|
-
const data = getVariables(this);
|
|
77
|
+
const data = getVariables(this.proxy);
|
|
78
78
|
this.fragmentVariables = data.Variables;
|
|
79
79
|
this.fragmentActions = data.Actions;
|
|
80
80
|
this.Variables = Object.assign(this.Variables, data.Variables);
|
|
@@ -83,6 +83,8 @@ export default class {{name}}{{typeLabel}} extends Base{{typeLabel}} {
|
|
|
83
83
|
this.startUpActions = [{{#each startUpActions}}'{{this}}',{{/each}}];
|
|
84
84
|
this.autoUpdateVariables = [{{#each autoUpdateVariables}}'{{this}}',{{/each}}];
|
|
85
85
|
}
|
|
86
|
+
|
|
87
|
+
provideAsset = (path) => this.handleUrl(path);
|
|
86
88
|
|
|
87
89
|
componentDidMount() {
|
|
88
90
|
{{#ifEquals lType 'prefab' this}}
|
|
@@ -123,7 +125,7 @@ export default class {{name}}{{typeLabel}} extends Base{{typeLabel}} {
|
|
|
123
125
|
{{/ifEquals}}
|
|
124
126
|
const fragment = this.proxy;
|
|
125
127
|
return (<FragmentContext.Provider value={this.proxy}>
|
|
126
|
-
<AssetProvider value={
|
|
128
|
+
<AssetProvider value={this.provideAsset}>
|
|
127
129
|
{{{markup}}}
|
|
128
130
|
</AssetProvider>
|
|
129
131
|
</FragmentContext.Provider>);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{{#each liveSources}}
|
|
2
|
+
import {{this}}Json from './{{this}}.json';
|
|
3
|
+
{{/each}}
|
|
4
|
+
|
|
5
|
+
const metadata = {
|
|
6
|
+
{{#each liveSources}}
|
|
7
|
+
{{this}}: {{this}}Json,
|
|
8
|
+
{{/each}}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const getEntityPropertyMap = (liveSource, entityName) => {
|
|
12
|
+
return metadata[liveSource] &&
|
|
13
|
+
metadata[liveSource][entityName] &&
|
|
14
|
+
metadata[liveSource][entityName].propertiesMap;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const getEntityRelatedTables = (liveSource, entityName) => {
|
|
18
|
+
return metadata[liveSource] &&
|
|
19
|
+
metadata[liveSource][entityName] &&
|
|
20
|
+
metadata[liveSource][entityName].relatedTables;
|
|
21
|
+
}
|
|
@@ -1,9 +1,89 @@
|
|
|
1
1
|
{
|
|
2
|
+
"main": "index.js",
|
|
2
3
|
"scripts": {
|
|
4
|
+
"start": "expo start",
|
|
5
|
+
"android": "expo start --android",
|
|
6
|
+
"ios": "expo start --ios",
|
|
7
|
+
"web": "expo start --web",
|
|
8
|
+
"eject": "expo eject",
|
|
3
9
|
"postinstall": "echo \"\""
|
|
4
10
|
},
|
|
5
11
|
"dependencies": {
|
|
12
|
+
"@unimodules/react-native-adapter": "6.3.9",
|
|
13
|
+
"@wavemaker/app-rn-runtime": "11.4.0-rc.121",
|
|
14
|
+
"@wavemaker/variables": "11.4.0-rc.121",
|
|
15
|
+
"axios": "^1.4.0",
|
|
16
|
+
"css-mediaquery": "^0.1.2",
|
|
17
|
+
"deprecated-react-native-prop-types": "~4.1.0",
|
|
18
|
+
"expo": "49.0.7",
|
|
19
|
+
"@expo/vector-icons": "13.0.0",
|
|
20
|
+
"expo-font": "11.4.0",
|
|
21
|
+
"expo-file-system": "15.4.3",
|
|
22
|
+
"expo-camera": "13.4.2",
|
|
23
|
+
"expo-av": "13.4.1",
|
|
24
|
+
"expo-barcode-scanner": "12.5.3",
|
|
25
|
+
"expo-web-browser": "12.3.2",
|
|
26
|
+
"expo-device": "5.4.0",
|
|
27
|
+
"expo-network": "5.4.0",
|
|
28
|
+
"expo-location": "16.1.0",
|
|
29
|
+
"expo-localization": "14.3.0",
|
|
30
|
+
"expo-contacts": "12.2.0",
|
|
31
|
+
"expo-calendar": "11.3.0",
|
|
32
|
+
"expo-splash-screen": "0.20.5",
|
|
33
|
+
"expo-document-picker": "11.5.4",
|
|
34
|
+
"expo-constants": "14.4.2",
|
|
35
|
+
"@react-native/assets": "1.0.0",
|
|
36
|
+
"hermes-engine": "0.11.0",
|
|
37
|
+
"react": "18.2.0",
|
|
38
|
+
"react-dom": "18.2.0",
|
|
39
|
+
"react-native": "0.72.4",
|
|
40
|
+
"react-native-web": "0.18.12",
|
|
41
|
+
"@react-native-async-storage/async-storage": "1.18.2",
|
|
42
|
+
"@react-native-community/netinfo": "9.3.10",
|
|
43
|
+
"react-native-gesture-handler": "2.12.1",
|
|
6
44
|
"react-native-reanimated": "^1.13.2",
|
|
45
|
+
"react-native-bundle-splitter": "2.2.3",
|
|
46
|
+
"react-native-safe-area-context": "4.6.3",
|
|
47
|
+
"@react-native-community/datetimepicker": "7.2.0",
|
|
48
|
+
"@react-native-community/slider": "4.4.2",
|
|
49
|
+
"react-native-circular-progress": "1.3.9",
|
|
50
|
+
"@react-native-masked-view/masked-view": "0.2.9",
|
|
51
|
+
"react-native-snap-carousel": "3.9.1",
|
|
52
|
+
"react-native-svg": "13.4.0",
|
|
53
|
+
"react-native-ssl-public-key-pinning": "1.1.1",
|
|
54
|
+
"victory-native": "36.6.11",
|
|
55
|
+
"@react-navigation/native": "6.1.7",
|
|
56
|
+
"react-native-pager-view": "6.2.0",
|
|
57
|
+
"react-native-webview": "13.2.2",
|
|
58
|
+
"react-native-vector-icons": "10.0.0",
|
|
59
|
+
"@react-navigation/drawer": "6.6.3",
|
|
60
|
+
"react-native-screens": "3.22.0",
|
|
61
|
+
"react-native-svg-transformer": "1.0.0",
|
|
62
|
+
"lottie-react-native": "5.1.6",
|
|
63
|
+
"react-lottie-player": "1.5.4",
|
|
64
|
+
"expo-linear-gradient": "12.3.0",
|
|
65
|
+
"setimmediate": "1.0.5",
|
|
66
|
+
"react-native-restart": "0.0.27",
|
|
67
|
+
"@expo/webpack-config": "18.0.1",
|
|
68
|
+
"@babel/core": "7.20.2",
|
|
7
69
|
"victory": "^36.5.3"
|
|
8
|
-
}
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"webpack-dev-middleware": "6.1.1",
|
|
73
|
+
"react-devtools-core": "4.28.0",
|
|
74
|
+
"@babel/cli": "7.14.5",
|
|
75
|
+
"esbuild": "0.15.15",
|
|
76
|
+
"esbuild-plugin-resolve": "1.0.3",
|
|
77
|
+
"fs-extra": "10.0.0",
|
|
78
|
+
"expo-modules-autolinking": "1.5.0",
|
|
79
|
+
"babel-plugin-transform-remove-console": "6.9.4",
|
|
80
|
+
"@babel/plugin-proposal-optional-chaining": "7.21.0",
|
|
81
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
|
|
82
|
+
"@babel/plugin-syntax-jsx": "7.21.4"
|
|
83
|
+
},
|
|
84
|
+
"resolutions": {
|
|
85
|
+
"react-error-overlay": "6.0.9",
|
|
86
|
+
"react-native-reanimated": "3.3.0"
|
|
87
|
+
},
|
|
88
|
+
"private": true
|
|
9
89
|
}
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
{{#if lazyload}}
|
|
2
|
-
import { register } from 'react-native-bundle-splitter';
|
|
3
|
-
{{else}}
|
|
4
1
|
{{#each pageConfigs}}
|
|
5
2
|
import {{name}}Component from "./{{name}}/{{name}}.component";
|
|
6
3
|
{{/each}}
|
|
7
|
-
{{/if}}
|
|
8
4
|
|
|
9
5
|
const components = {
|
|
10
6
|
{{#each pageConfigs}}
|
|
11
7
|
'{{name}}': {
|
|
12
|
-
{{#if ../lazyload}}
|
|
13
|
-
type: register({ loader: () => import('./{{name}}/{{name}}.component') }),
|
|
14
|
-
{{else}}
|
|
15
8
|
type: {{name}}Component,
|
|
16
|
-
{{/if}}
|
|
17
9
|
name: '{{name}}Component'
|
|
18
10
|
},
|
|
19
11
|
{{/each}}
|
|
@@ -26,11 +26,13 @@
|
|
|
26
26
|
"supportsTablet": true
|
|
27
27
|
},
|
|
28
28
|
"android": {
|
|
29
|
+
"softwareKeyboardLayoutMode": "pan",
|
|
29
30
|
"adaptiveIcon": {
|
|
30
31
|
"foregroundImage": "./assets/adaptive-icon.png"
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
34
|
"web": {
|
|
35
|
+
"bundler": "metro",
|
|
34
36
|
"favicon": "./assets/favicon.png"
|
|
35
37
|
}
|
|
36
38
|
}
|
|
@@ -51,6 +51,46 @@ class EsBuilder {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
async patchReactNativeAssets() {
|
|
55
|
+
const path = `${__dirname}/../node_modules/@react-native/assets-registry/`
|
|
56
|
+
fs.removeSync(path+'registry.js');
|
|
57
|
+
const registry_content = `
|
|
58
|
+
'use strict';
|
|
59
|
+
|
|
60
|
+
export type PackagerAsset = {
|
|
61
|
+
__packager_asset: boolean,
|
|
62
|
+
fileSystemLocation: string,
|
|
63
|
+
httpServerLocation: string,
|
|
64
|
+
width?: number,
|
|
65
|
+
height?: number,
|
|
66
|
+
scales: Array<number>,
|
|
67
|
+
hash: string,
|
|
68
|
+
name: string,
|
|
69
|
+
type: string,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const assets: Array<PackagerAsset> = [];
|
|
73
|
+
|
|
74
|
+
export function registerAsset(asset: PackagerAsset): number {
|
|
75
|
+
// push returns new array length, so the first asset will
|
|
76
|
+
// get id 1 (not 0) to make the value truthy
|
|
77
|
+
return assets.push(asset);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function getAssetByID(assetId: number): PackagerAsset {
|
|
81
|
+
return assets[assetId - 1];
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
fs.writeFileSync(path+'registry.ts', registry_content);
|
|
85
|
+
const content = fs.readFileSync(path+'path-support.js', 'utf-8');
|
|
86
|
+
fs.removeSync(path+'path-support.js')
|
|
87
|
+
fs.writeFileSync(path+'path-support.ts', content);
|
|
88
|
+
await readAndReplaceFileContent(path+'path-support.ts', (content)=>{
|
|
89
|
+
return content.replace(`import type {PackagerAsset} from './registry.js';`,`import type {PackagerAsset} from './registry.ts';`)
|
|
90
|
+
.replace(` | $TEMPORARY$string<'raw'> `, '');
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
54
94
|
async patchReactNativeWeb() {
|
|
55
95
|
const path = `${__dirname}/../node_modules/react-native-web/dist/cjs/exports/render/index.js`;
|
|
56
96
|
await readAndReplaceFileContent(path, (content) => {
|
|
@@ -125,6 +165,7 @@ class EsBuilder {
|
|
|
125
165
|
.then(() => this.patchPackageLib(['@koale/useworker', 'victory']))
|
|
126
166
|
.then(() => this.patchWithDevTools('expo/build/launch/withDevTools.js'))
|
|
127
167
|
.then(() => this.patchReactNativeWeb())
|
|
168
|
+
.then(() => this.patchReactNativeAssets())
|
|
128
169
|
.then(() => {
|
|
129
170
|
console.log('*********** LIBRARIES ARE BUILT FOR ESBUILD **************');
|
|
130
171
|
}, (e) => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { registerRootComponent } from 'expo';
|
|
2
|
+
|
|
3
|
+
import App from './App';
|
|
4
|
+
|
|
5
|
+
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
|
|
6
|
+
// It also ensures that whether you load the app in Expo Go or in a native build,
|
|
7
|
+
// the environment is set up appropriately
|
|
8
|
+
registerRootComponent(App);
|
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
const { getDefaultConfig } = require('metro-config');
|
|
1
|
+
const { getDefaultConfig } = require('expo/metro-config');
|
|
2
|
+
const path = require('path');
|
|
2
3
|
|
|
3
4
|
module.exports = (async () => {
|
|
4
5
|
try {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
const projectRoot = __dirname;
|
|
7
|
+
const config = getDefaultConfig(projectRoot);
|
|
8
|
+
config.watchFolders = [projectRoot];
|
|
9
|
+
config.resolver.nodeModulesPaths = [
|
|
10
|
+
path.resolve(projectRoot, 'node_modules')
|
|
11
|
+
];
|
|
12
|
+
config.resolver.disableHierarchicalLookup = true;
|
|
13
|
+
config.transformer = {
|
|
14
|
+
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
15
|
+
getTransformOptions: async () => ({
|
|
16
|
+
transform: {
|
|
17
|
+
experimentalImportSupport: false,
|
|
18
|
+
inlineRequires: false
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
config.resolver = {
|
|
23
|
+
assetExts: config.resolver.assetExts.filter(ext => ext !== 'svg'),
|
|
24
|
+
sourceExts: [...config.resolver.sourceExts, 'svg']
|
|
25
|
+
}
|
|
26
|
+
return config;
|
|
23
27
|
}
|
|
24
28
|
catch (e) {
|
|
25
29
|
console.log('error in metro config file');
|
|
26
30
|
}
|
|
27
|
-
})();
|
|
31
|
+
})();
|