@wavemaker-ai/wm-reactnative-cli 1.0.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.
Files changed (39) hide show
  1. package/README.md +236 -0
  2. package/assets/CLI-EnvironmentVariable.png +0 -0
  3. package/assets/EnvironmentVariable.png +0 -0
  4. package/assets/EnvironmentVariable1.png +0 -0
  5. package/files/ui-build.js +331 -0
  6. package/index.js +381 -0
  7. package/package.json +39 -0
  8. package/src/android.js +479 -0
  9. package/src/command.js +552 -0
  10. package/src/config.js +11 -0
  11. package/src/custom-logger/progress-bar.js +97 -0
  12. package/src/custom-logger/steps.js +117 -0
  13. package/src/custom-logger/task-logger.js +147 -0
  14. package/src/exec.js +73 -0
  15. package/src/expo-launcher.js +596 -0
  16. package/src/ios.js +517 -0
  17. package/src/logger.js +104 -0
  18. package/src/mobileprovision-parse/index.js +72 -0
  19. package/src/project-sync.service.js +390 -0
  20. package/src/requirements.js +250 -0
  21. package/src/utils.js +100 -0
  22. package/src/web-preview-launcher.js +548 -0
  23. package/src/zip.js +19 -0
  24. package/templates/embed/android/ReactNativeAppFragment.java +78 -0
  25. package/templates/embed/android/SplashScreenReactActivityLifecycleListener.kt +41 -0
  26. package/templates/embed/android/fragment_react_native_app.xml +14 -0
  27. package/templates/embed/ios/ReactNativeView.h +12 -0
  28. package/templates/embed/ios/ReactNativeView.m +59 -0
  29. package/templates/embed/ios/ReactNativeView.swift +53 -0
  30. package/templates/expo-camera-patch/useWebQRScanner.js +100 -0
  31. package/templates/ios-build-patch/podFIlePostInstall.js +72 -0
  32. package/templates/package/packageLock.json +14334 -0
  33. package/templates/wm-rn-runtime/App.js +479 -0
  34. package/templates/wm-rn-runtime/App.navigator.js +109 -0
  35. package/test.js +0 -0
  36. package/tools-site/index.html.template +17 -0
  37. package/tools-site/page_background.svg +99 -0
  38. package/tools-site/qrcode.js +614 -0
  39. package/tools-site/styles.css +39 -0
@@ -0,0 +1,479 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import React from 'react';
4
+ import axios from 'axios';
5
+ import { Platform, TouchableOpacity, View } from 'react-native';
6
+ import ProtoTypes from 'prop-types';
7
+ import { SafeAreaProvider, SafeAreaInsetsContext } from 'react-native-safe-area-context';
8
+ import { DefaultTheme, Provider as PaperProvider } from 'react-native-paper';
9
+ import { Linking } from 'react-native';
10
+ import * as WebBrowser from 'expo-web-browser';
11
+ import { get, last } from 'lodash';
12
+ import { RENDER_LOGGER } from '@wavemaker/app-rn-runtime/core/logger';
13
+ import injector from '@wavemaker/app-rn-runtime/core/injector';
14
+ import formatters from '@wavemaker/app-rn-runtime/core/formatters';
15
+ import { deepCopy, isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';
16
+ import { ModalProvider } from '@wavemaker/app-rn-runtime/core/modal.service';
17
+ import { ToastProvider } from '@wavemaker/app-rn-runtime/core/toast.service';
18
+ import { NavigationServiceProvider } from '@wavemaker/app-rn-runtime/core/navigation.service';
19
+ import { PartialProvider } from '@wavemaker/app-rn-runtime/core/partial.service';
20
+ import ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';
21
+ import WmMessage from '@wavemaker/app-rn-runtime/components/basic/message/message.component';
22
+ import { Animatedview } from '@wavemaker/app-rn-runtime/components/basic/animatedview.component';
23
+ import { Watcher } from './watcher';
24
+ import AppDisplayManagerService from './services/app-display-manager.service';
25
+ import AppModalService from './services/app-modal.service';
26
+ import AppToastService from './services/app-toast.service';
27
+ import AppPartialService from './services/partial.service';
28
+ import { AppNavigator } from './App.navigator';
29
+ import { SecurityProvider } from '../core/security.service';
30
+ import { CameraProvider } from '../core/device/camera-service';
31
+ import CameraService from './services/device/camera-service';
32
+ import { ScanProvider } from '../core/device/scan-service';
33
+ import ScanService from './services/device/scan-service';
34
+ import AppSecurityService from './services/app-security.service';
35
+ import StorageService from './services/storage.service';
36
+ import { getValidJSON, parseErrors } from '@wavemaker/app-rn-runtime/variables/utils/variable.utils';
37
+ import * as SplashScreen from 'expo-splash-screen';
38
+ import { WmMemo } from './memo.component';
39
+ //some old react libraries need this
40
+ View['propTypes'] = {
41
+ style: ProtoTypes.any
42
+ };
43
+ const MIN_TIME_BETWEEN_REFRESH_CYCLES = 200;
44
+
45
+ class DrawerImpl {
46
+ constructor(onChange) {
47
+ this.onChange = onChange;
48
+
49
+ _defineProperty(this, "content", void 0);
50
+
51
+ _defineProperty(this, "animation", 'slide-in');
52
+ }
53
+
54
+ setContent(content) {
55
+ this.content = content;
56
+ this.onChange();
57
+ }
58
+
59
+ getContent() {
60
+ return this.content;
61
+ }
62
+
63
+ setAnimation(animation) {
64
+ this.animation = animation;
65
+ this.onChange();
66
+ }
67
+
68
+ getAnimation() {
69
+ return this.animation;
70
+ }
71
+
72
+ }
73
+
74
+ const SUPPORTED_SERVICES = {
75
+ StorageService: StorageService,
76
+ AppDisplayManagerService: AppDisplayManagerService
77
+ };
78
+ export default class BaseApp extends React.Component {
79
+ constructor(props) {
80
+ var _this;
81
+
82
+ super(props);
83
+ _this = this;
84
+
85
+ _defineProperty(this, "Actions", {});
86
+
87
+ _defineProperty(this, "Variables", {});
88
+
89
+ _defineProperty(this, "onAppVariablesReady", () => {});
90
+
91
+ _defineProperty(this, "isStarted", false);
92
+
93
+ _defineProperty(this, "appConfig", injector.get('APP_CONFIG'));
94
+
95
+ _defineProperty(this, "baseUrl", '');
96
+
97
+ _defineProperty(this, "startUpVariables", []);
98
+
99
+ _defineProperty(this, "startUpActions", []);
100
+
101
+ _defineProperty(this, "autoUpdateVariables", []);
102
+
103
+ _defineProperty(this, "axiosInterceptorIds", []);
104
+
105
+ _defineProperty(this, "formatters", formatters);
106
+
107
+ _defineProperty(this, "serviceDefinitions", {});
108
+
109
+ _defineProperty(this, "animatedRef", void 0);
110
+
111
+ _defineProperty(this, "modalsOpened", 0);
112
+
113
+ _defineProperty(this, "toastsOpened", 0);
114
+
115
+ _defineProperty(this, "watcher", Watcher.ROOT);
116
+
117
+ SplashScreen.preventAutoHideAsync();
118
+ this.appConfig.app = this;
119
+ this.appConfig.drawer = new DrawerImpl(() => this.setState({
120
+ 't': Date.now()
121
+ }));
122
+ let refreshAfterWait = false;
123
+ this.baseUrl = this.appConfig.url;
124
+ let wait = 0;
125
+ this.bindServiceInterceptors();
126
+
127
+ this.appConfig.refresh = function () {
128
+ let complete = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
129
+
130
+ if (complete) {
131
+ _this.reload();
132
+
133
+ return;
134
+ }
135
+
136
+ if (!wait) {
137
+ RENDER_LOGGER.debug('refreshing the app...');
138
+ wait = MIN_TIME_BETWEEN_REFRESH_CYCLES;
139
+ refreshAfterWait = false;
140
+ setTimeout(() => {
141
+ var _this$appConfig$curre;
142
+
143
+ _this.forceUpdate();
144
+
145
+ (_this$appConfig$curre = _this.appConfig.currentPage) === null || _this$appConfig$curre === void 0 ? void 0 : _this$appConfig$curre.forceUpdate();
146
+
147
+ _this.watcher.check();
148
+ });
149
+ setTimeout(() => {
150
+ wait = 0;
151
+ refreshAfterWait && _this.appConfig.refresh();
152
+ }, wait);
153
+ } else {
154
+ RENDER_LOGGER.debug('will refresh the app in the next cycle.');
155
+ refreshAfterWait = true;
156
+ }
157
+ };
158
+ }
159
+
160
+ goToPage(pageName, params) {
161
+ var _this$appConfig$curre2;
162
+
163
+ return (_this$appConfig$curre2 = this.appConfig.currentPage) === null || _this$appConfig$curre2 === void 0 ? void 0 : _this$appConfig$curre2.goToPage(pageName, params);
164
+ }
165
+
166
+ goBack(pageName, params) {
167
+ var _this$appConfig$curre3;
168
+
169
+ return (_this$appConfig$curre3 = this.appConfig.currentPage) === null || _this$appConfig$curre3 === void 0 ? void 0 : _this$appConfig$curre3.goBack(pageName, params);
170
+ }
171
+
172
+ openUrl(url, params) {
173
+ var _this$appConfig$curre4;
174
+
175
+ return (_this$appConfig$curre4 = this.appConfig.currentPage) === null || _this$appConfig$curre4 === void 0 ? void 0 : _this$appConfig$curre4.openUrl(url, params);
176
+ }
177
+
178
+ onBeforeServiceCall(config) {
179
+ config.headers['X-Requested-With'] = 'XMLHttpRequest';
180
+ console.log('onBeforeService call invoked on ' + config.url);
181
+ return config;
182
+ }
183
+
184
+ onServiceSuccess(data, response) {}
185
+
186
+ onServiceError(errorMsg, error) {}
187
+
188
+ onPageReady(activePageName, activePageScope) {}
189
+
190
+ openBrowser(url) {
191
+ let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
192
+
193
+ if (url) {
194
+ if (isWebPreviewMode()) {
195
+ window.open(url, '_blank');
196
+ } else if (url.startsWith('http') && params.target === '_blank') {
197
+ WebBrowser.openBrowserAsync(url);
198
+ } else {
199
+ return Linking.openURL(url);
200
+ }
201
+ }
202
+
203
+ return Promise.resolve();
204
+ } // To support old api
205
+
206
+
207
+ reload() {}
208
+
209
+ bindServiceInterceptors() {
210
+ this.axiosInterceptorIds = [axios.interceptors.request.use(config => this.onBeforeServiceCall(config)), axios.interceptors.response.use(response => {
211
+ this.onServiceSuccess(response.data, response);
212
+ return response;
213
+ }, error => {
214
+ var _errorDetails, _errorDetails2, _error$response, _error$response$confi, _error$response2;
215
+
216
+ let errorDetails = error.response,
217
+ errMsg;
218
+ errorDetails = getValidJSON((_errorDetails = errorDetails) === null || _errorDetails === void 0 ? void 0 : _errorDetails.data) || ((_errorDetails2 = errorDetails) === null || _errorDetails2 === void 0 ? void 0 : _errorDetails2.data);
219
+
220
+ if (errorDetails && errorDetails.errors) {
221
+ errMsg = parseErrors(errorDetails.errors) || "Service Call Failed";
222
+ } else {
223
+ errMsg = errMsg || "Service Call Failed";
224
+ }
225
+
226
+ error.message = errMsg;
227
+ this.onServiceError(error.message, error);
228
+
229
+ if ((_error$response = error.response) !== null && _error$response !== void 0 && (_error$response$confi = _error$response.config.url) !== null && _error$response$confi !== void 0 && _error$response$confi.startsWith(this.appConfig.url) && ((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) === 401) {
230
+ var _this$appConfig$curre5, _this$appConfig$curre6;
231
+
232
+ ((_this$appConfig$curre5 = this.appConfig.currentPage) === null || _this$appConfig$curre5 === void 0 ? void 0 : _this$appConfig$curre5.pageName) !== 'Login' && ((_this$appConfig$curre6 = this.appConfig.currentPage) === null || _this$appConfig$curre6 === void 0 ? void 0 : _this$appConfig$curre6.goToPage('Login'));
233
+ }
234
+
235
+ return Promise.reject(error);
236
+ })];
237
+ }
238
+
239
+ eval(fn) {
240
+ let failOnError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
241
+
242
+ try {
243
+ return fn.call(this);
244
+ } catch (e) {
245
+ if (failOnError) {
246
+ throw e;
247
+ } else {
248
+ return null;
249
+ }
250
+ }
251
+ }
252
+
253
+ componentDidMount() {
254
+ Promise.all(this.startUpVariables.map(s => this.Variables[s] && this.Variables[s].invoke())).then(() => {
255
+ this.onAppVariablesReady();
256
+ this.isStarted = true;
257
+ this.forceUpdate(); // TODO: Without callback, splashscreen was not getting hidden in ios mobile app. Later, remove the empty function.
258
+
259
+ SplashScreen.hideAsync().then(() => {});
260
+ });
261
+ this.startUpActions.map(a => this.Actions[a] && this.Actions[a].invoke());
262
+ }
263
+
264
+ componentWillUnmount() {
265
+ this.axiosInterceptorIds.map(id => {
266
+ axios.interceptors.request.eject(id);
267
+ });
268
+ }
269
+
270
+ refresh() {
271
+ this.appConfig.refresh();
272
+ }
273
+
274
+ getProviders(content) {
275
+ return /*#__PURE__*/React.createElement(NavigationServiceProvider, {
276
+ value: this
277
+ }, /*#__PURE__*/React.createElement(ToastProvider, {
278
+ value: AppToastService
279
+ }, /*#__PURE__*/React.createElement(PartialProvider, {
280
+ value: AppPartialService
281
+ }, /*#__PURE__*/React.createElement(SecurityProvider, {
282
+ value: AppSecurityService
283
+ }, /*#__PURE__*/React.createElement(CameraProvider, {
284
+ value: CameraService
285
+ }, /*#__PURE__*/React.createElement(ScanProvider, {
286
+ value: ScanService
287
+ }, /*#__PURE__*/React.createElement(ModalProvider, {
288
+ value: AppModalService
289
+ }, content)))))));
290
+ }
291
+
292
+ renderToasters() {
293
+ this.toastsOpened = AppToastService.toastsOpened.length;
294
+ return /*#__PURE__*/React.createElement(WmMemo, {
295
+ watcher: this.watcher,
296
+ render: watch => {
297
+ watch(() => AppToastService.toastsOpened);
298
+ return /*#__PURE__*/React.createElement(React.Fragment, null, AppToastService.toastsOpened.map((o, i) => /*#__PURE__*/React.createElement(View, {
299
+ key: i,
300
+ style: [{
301
+ position: 'absolute',
302
+ width: '100%',
303
+ elevation: o.elevationIndex,
304
+ zIndex: o.elevationIndex
305
+ }, o.styles]
306
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
307
+ onPress: () => o.onClick && o.onClick()
308
+ }, o.content, /*#__PURE__*/React.createElement(WmMessage, {
309
+ type: o.type,
310
+ caption: o.text,
311
+ hideclose: true
312
+ })))));
313
+ }
314
+ });
315
+ }
316
+
317
+ renderDialogs() {
318
+ return /*#__PURE__*/React.createElement(WmMemo, {
319
+ watcher: this.watcher,
320
+ render: watch => {
321
+ watch(() => {
322
+ var _last;
323
+
324
+ return (_last = last(AppModalService.modalsOpened)) === null || _last === void 0 ? void 0 : _last.content;
325
+ });
326
+ this.modalsOpened = AppModalService.modalsOpened.length;
327
+ AppModalService.animatedRefs.length = 0;
328
+ return /*#__PURE__*/React.createElement(React.Fragment, null, AppModalService.modalOptions.content && AppModalService.modalsOpened.map((o, i) => {
329
+ return /*#__PURE__*/React.createElement(View, {
330
+ key: (o.name || '') + i,
331
+ onStartShouldSetResponder: () => true,
332
+ onResponderEnd: () => o.isModal && AppModalService.hideModal(o),
333
+ style: deepCopy(styles.appModal, o.centered ? styles.centeredModal : null, o.modalStyle, {
334
+ elevation: o.elevationIndex,
335
+ zIndex: o.elevationIndex
336
+ })
337
+ }, /*#__PURE__*/React.createElement(Animatedview, {
338
+ entryanimation: o.animation || 'fadeIn',
339
+ ref: ref => {
340
+ this.animatedRef = ref;
341
+ AppModalService.animatedRefs[i] = ref;
342
+ },
343
+ style: [styles.appModalContent, o.contentStyle]
344
+ }, /*#__PURE__*/React.createElement(View, {
345
+ onStartShouldSetResponder: evt => true,
346
+ onResponderEnd: e => e.stopPropagation(),
347
+ style: {
348
+ width: '100%',
349
+ 'alignItems': 'center'
350
+ }
351
+ }, this.getProviders(o.content))));
352
+ }));
353
+ }
354
+ });
355
+ }
356
+
357
+ renderDisplayManager() {
358
+ return /*#__PURE__*/React.createElement(WmMemo, {
359
+ watcher: this.watcher,
360
+ render: watch => {
361
+ watch(() => AppDisplayManagerService.displayOptions.content);
362
+ return AppDisplayManagerService.displayOptions.content ? /*#__PURE__*/React.createElement(View, {
363
+ style: [styles.displayViewContainer, {
364
+ elevation: this.toastsOpened + this.modalsOpened + 1,
365
+ zIndex: this.toastsOpened + this.modalsOpened + 1
366
+ }]
367
+ }, AppDisplayManagerService.displayOptions.content) : null;
368
+ }
369
+ });
370
+ }
371
+
372
+ renderIconsViewSupportForWeb() {
373
+ try {
374
+ return /*#__PURE__*/React.createElement("style", {
375
+ type: "text/css"
376
+ }, `
377
+ @font-face {
378
+ font-family: 'MaterialCommunityIcons';
379
+ src: url(${require('react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf')}) format('truetype');
380
+ }
381
+ `);
382
+ } catch (e) {
383
+ console.log('require react-native-vector-icons could not be loaded.');
384
+ }
385
+
386
+ return null;
387
+ }
388
+
389
+ getSelectedLocale() {
390
+ return this.appConfig.selectedLocale;
391
+ }
392
+
393
+ getDependency(serviceName) {
394
+ const service = get(SUPPORTED_SERVICES, serviceName);
395
+
396
+ if (service) {
397
+ return service;
398
+ }
399
+ }
400
+
401
+ renderApp(commonPartial) {
402
+ var _this2 = this;
403
+ console.error("BOYINA : " + JSON.stringify(this.props));
404
+ this.autoUpdateVariables.forEach(value => {
405
+ var _this$Variables$value;
406
+
407
+ return (_this$Variables$value = this.Variables[value]) === null || _this$Variables$value === void 0 ? void 0 : _this$Variables$value.invokeOnParamChange();
408
+ });
409
+ return /*#__PURE__*/React.createElement(SafeAreaProvider, null, /*#__PURE__*/React.createElement(PaperProvider, {
410
+ theme: { ...DefaultTheme,
411
+ colors: { ...DefaultTheme.colors,
412
+ primary: ThemeVariables.primaryColor
413
+ }
414
+ }
415
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, Platform.OS === 'web' ? this.renderIconsViewSupportForWeb() : null, /*#__PURE__*/React.createElement(SafeAreaInsetsContext.Consumer, null, function () {
416
+ var _this2$appConfig$draw, _this2$appConfig$draw2;
417
+
418
+ let insets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
419
+ top: 0,
420
+ bottom: 0,
421
+ left: 0,
422
+ right: 0
423
+ };
424
+ return _this2.getProviders( /*#__PURE__*/React.createElement(View, {
425
+ style: [styles.container, {
426
+ paddingTop: (insets === null || insets === void 0 ? void 0 : insets.top) || 0,
427
+ paddingBottom: insets === null || insets === void 0 ? void 0 : insets.bottom,
428
+ paddingLeft: insets === null || insets === void 0 ? void 0 : insets.left,
429
+ paddingRight: insets === null || insets === void 0 ? void 0 : insets.right
430
+ }]
431
+ }, /*#__PURE__*/React.createElement(View, {
432
+ style: styles.container
433
+ }, /*#__PURE__*/React.createElement(AppNavigator, {
434
+ app: _this2,
435
+ landingPage: _this2.props.pageName,
436
+ hideDrawer: ((_this2$appConfig$draw = _this2.appConfig.drawer) === null || _this2$appConfig$draw === void 0 ? void 0 : _this2$appConfig$draw.getContent()) === null,
437
+ drawerContent: () => _this2.appConfig.drawer ? _this2.getProviders(_this2.appConfig.drawer.getContent()) : null,
438
+ drawerAnimation: (_this2$appConfig$draw2 = _this2.appConfig.drawer) === null || _this2$appConfig$draw2 === void 0 ? void 0 : _this2$appConfig$draw2.getAnimation()
439
+ }), commonPartial)));
440
+ }), this.renderToasters(), this.renderDialogs(), this.renderDisplayManager())));
441
+ }
442
+
443
+ }
444
+ const styles = {
445
+ container: {
446
+ flex: 1
447
+ },
448
+ appModal: {
449
+ position: 'absolute',
450
+ width: '100%'
451
+ },
452
+ appModalContent: {
453
+ flex: 1,
454
+ width: '100%',
455
+ alignItems: 'center',
456
+ flexDirection: 'column',
457
+ justifyContent: 'center'
458
+ },
459
+ centeredModal: {
460
+ flex: 1,
461
+ position: 'absolute',
462
+ top: 0,
463
+ flexDirection: 'row',
464
+ justifyContent: 'center',
465
+ alignItems: 'center',
466
+ backgroundColor: 'rgba(0, 0, 0, 0.4)',
467
+ height: '100%'
468
+ },
469
+ displayViewContainer: {
470
+ position: 'absolute',
471
+ justifyContent: 'center',
472
+ width: '100%',
473
+ left: 0,
474
+ right: 0,
475
+ top: 0,
476
+ bottom: 0
477
+ }
478
+ };
479
+ //# sourceMappingURL=App.js.map
@@ -0,0 +1,109 @@
1
+ import React from 'react';
2
+ import { Platform, View, StatusBar } from 'react-native';
3
+ import { NavigationContainer } from '@react-navigation/native';
4
+ import { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';
5
+ import injector from '@wavemaker/app-rn-runtime/core/injector';
6
+ import AppDrawerNavigator from './navigator/drawer.navigator';
7
+ import AppStackNavigator from './navigator/stack.navigator';
8
+ import { SafeAreaView } from 'react-native-safe-area-context';
9
+ import { isEmpty, keys, last } from 'lodash';
10
+
11
+ const getStateFromPath = (path, options) => {
12
+ let hash = window.location.hash;
13
+ hash = hash.substring(1);
14
+
15
+ if (hash && hash.startsWith('/')) {
16
+ hash = hash.substring(1);
17
+ }
18
+
19
+ if (!hash) {
20
+ return;
21
+ }
22
+
23
+ let [pageName, paramstr] = hash.split('?');
24
+ let params = {};
25
+
26
+ if (paramstr) {
27
+ paramstr.split('&').forEach(p => {
28
+ const [k, v] = p.split('=');
29
+ params[k] = v;
30
+ });
31
+ }
32
+
33
+ return {
34
+ routes: [{
35
+ name: 'pages',
36
+ state: {
37
+ index: 0,
38
+ routes: [{
39
+ name: pageName,
40
+ params: params
41
+ }]
42
+ }
43
+ }]
44
+ };
45
+ };
46
+
47
+ const getPathFromState = (state, options) => {
48
+ const pagesRoute = state === null || state === void 0 ? void 0 : state.routes[0];
49
+ const pageRoute = last(pagesRoute === null || pagesRoute === void 0 ? void 0 : pagesRoute.state.routes);
50
+ let path = '';
51
+
52
+ if (pageRoute) {
53
+ path = window.location.href.split('#')[0] + '#/' + pageRoute.name;
54
+
55
+ if (!isEmpty(pageRoute.params)) {
56
+ path += '?' + keys(pageRoute.params).map(k => {
57
+ return `${k}=${pageRoute.params[k]}`;
58
+ }).join('&');
59
+ }
60
+ }
61
+
62
+ return path;
63
+ };
64
+
65
+ export const AppNavigator = props => {
66
+ var _appConfig$pages;
67
+
68
+ const appConfig = injector.get('APP_CONFIG');
69
+ const pages = {};
70
+ const linking = {
71
+ config: {
72
+ screens: {
73
+ "pages": {
74
+ path: "pages",
75
+ screens: pages
76
+ }
77
+ }
78
+ },
79
+ getStateFromPath: isWebPreviewMode() ? getStateFromPath : undefined,
80
+ getPathFromState: isWebPreviewMode() ? getPathFromState : undefined
81
+ };
82
+ (_appConfig$pages = appConfig.pages) === null || _appConfig$pages === void 0 ? void 0 : _appConfig$pages.forEach(p => {
83
+ //@ts-ignore
84
+ pages[p.name] = p.name;
85
+ });
86
+ const stack = /*#__PURE__*/React.createElement(AppStackNavigator, {
87
+ pages: appConfig.pages || [],
88
+ landingPage: props.landingPage || appConfig.landingPage
89
+ });
90
+ const leftNav = /*#__PURE__*/React.createElement(AppDrawerNavigator, {
91
+ type: props.drawerAnimation === 'slide-over' ? 'front' : 'slide',
92
+ hide: props.hideDrawer,
93
+ content: () => /*#__PURE__*/React.createElement(SafeAreaView, {
94
+ style: [{
95
+ flex: 1
96
+ }, Platform.OS === 'ios' ? {
97
+ paddingTop: -40
98
+ } : {}]
99
+ }, /*#__PURE__*/React.createElement(StatusBar, {
100
+ barStyle: "light-content",
101
+ backgroundColor: "#000000"
102
+ }), props.drawerContent && props.drawerContent() || /*#__PURE__*/React.createElement(View, null)),
103
+ rootComponent: stack
104
+ });
105
+ return /*#__PURE__*/React.createElement(NavigationContainer, {
106
+ linking: linking
107
+ }, leftNav);
108
+ };
109
+ //# sourceMappingURL=App.navigator.js.map
package/test.js ADDED
File without changes
@@ -0,0 +1,17 @@
1
+ <html>
2
+ <head>
3
+ <script src="./qrcode.js" type="text/javascript"></script>
4
+ <link href="./styles.css" type="text/css" rel="stylesheet">
5
+ </head>
6
+ <body>
7
+ <div id="qrcode-container">
8
+ <span>Scan this QR code with your phone.</span>
9
+ <div id="qrcode"></div>
10
+ <span>{{url}}</span>
11
+ <span style="padding-top: 8px;">Please make sure that Expo Go is installed in your phone.</span>
12
+ </div>
13
+ <script type="text/javascript">
14
+ new QRCode(document.getElementById("qrcode"), "{{url}}");
15
+ </script>
16
+ </body>
17
+ </html>