@admin-layout/gluestack-ui-mobile 9.0.2-alpha.0 → 9.0.4-alpha.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.
@@ -10,14 +10,16 @@ const require = createRequire(import.meta.url);
10
10
  const __filename = fileURLToPath(import.meta.url);
11
11
  const __dirname = path.dirname(__filename);
12
12
  const configFilePath = path.join(__dirname, '../layout.json');
13
- const appNavigationFileName = 'navigation.tsx';
13
+ const appNavigationFileName = 'navigation.js';
14
14
  const mainRoutesFileName = 'main_routes.json';
15
15
  const modulesFileName = 'modules.ts';
16
- const stacksDirPath = 'stack/index.tsx';
17
- const drawerFilePath = 'drawer/index.tsx';
18
- const hostDrawerFilePath = 'host_drawer/index.tsx';
19
- const bottomFilePath = 'bottom/index.tsx';
20
- const hostBottomFilePath = 'host_bottom/index.tsx';
16
+ const stacksDirPath = 'stack/index.js';
17
+ const drawerFilePath = 'drawer/index.js';
18
+ const hostDrawerFilePath = 'host_drawer/index.js';
19
+ const bottomFilePath = 'bottom/index.js';
20
+ const hostBottomFilePath = 'host_bottom/index.js';
21
+ const mainRoutesJsFileName = 'mainRoutes.js';
22
+ const mainAppFileName = 'index.js';
21
23
 
22
24
  type IGenerateMobileNavigationsProps = {
23
25
  appDirPath: string;
@@ -27,6 +29,7 @@ type IGenerateMobileNavigationsProps = {
27
29
  customTabBarPath?: string;
28
30
  customDrawerPath?: string;
29
31
  customHeaderPath?: string;
32
+ i18Options: any;
30
33
  };
31
34
 
32
35
  export const readJsonFile = (filePath) => {
@@ -74,6 +77,7 @@ export class GenerateMobileNavigations {
74
77
  #customTabBarPath: string;
75
78
  #customDrawerPath: string;
76
79
  #customHeaderPath: string;
80
+ #i18Options: any;
77
81
 
78
82
  constructor({
79
83
  appDirPath,
@@ -83,6 +87,7 @@ export class GenerateMobileNavigations {
83
87
  customTabBarPath = null,
84
88
  customDrawerPath = null,
85
89
  customHeaderPath = null,
90
+ i18Options = {},
86
91
  }: IGenerateMobileNavigationsProps) {
87
92
  this.#layoutSettings = process.env.LAYOUT_SETTINGS ? JSON.parse(process.env.LAYOUT_SETTINGS) : null;
88
93
  this.#appDirPath = appDirPath;
@@ -92,6 +97,7 @@ export class GenerateMobileNavigations {
92
97
  this.#customTabBarPath = customTabBarPath;
93
98
  this.#customDrawerPath = customDrawerPath;
94
99
  this.#customHeaderPath = customHeaderPath;
100
+ this.#i18Options = i18Options;
95
101
  }
96
102
 
97
103
  async #readJsonFile(filePath) {
@@ -393,6 +399,212 @@ export class GenerateMobileNavigations {
393
399
  return false;
394
400
  }
395
401
 
402
+ async #generateMainRoutesFile({ initialRouteName, i18Options }) {
403
+ try {
404
+ const layoutSettings = this.#layoutSettings;
405
+ const layoutConfigFileData = await this.#getLayoutConfig();
406
+ const hostRouteConfig = layoutConfigFileData['host-bottom'];
407
+ const hostRouteKey = Object.keys(hostRouteConfig)[1];
408
+ const hostLayout = hostRouteConfig[hostRouteKey];
409
+
410
+ let importStatements = '';
411
+ importStatements += `import React from 'react';\n`;
412
+ importStatements += `import { InversifyProvider, PluginArea } from '@common-stack/client-react';\n`;
413
+ importStatements += `import { useSelector, useDispatch } from 'react-redux';\n`;
414
+ importStatements += `import { CHANGE_SETTINGS_ACTION } from '@admin-layout/client';\n`;
415
+ importStatements += `import {layoutRouteConfig,getReplacedRouteConfig,ErrorBoundary,NavigationContainerComponent,ApplicationErrorHandler,Box,Spinner,} from '@admin-layout/gluestack-ui-mobile';\n`;
416
+ importStatements += `import mainRouteConfig from './main_routes.json';\n`;
417
+ importStatements += `import features from './mobile-stack-react/modules.js';\n`;
418
+ importStatements += `import AppNavigations from './navigation';\n`;
419
+ importStatements += `import {loadContext} from './mobile-stack-react/load-context.mobile.js';\n`;
420
+
421
+ let classStructure = `
422
+
423
+ const mainAppRoutes = mainRouteConfig || [];
424
+
425
+ const appRoutes = [...[mainAppRoutes],features?.routeConfig];
426
+
427
+ const featureRouteConfig = appRoutes?.flat(1)??features?.routeConfig;
428
+ features.routeConfig = featureRouteConfig;
429
+ let appConfiguredRoutes = features?.getConfiguredRoutes2("/");
430
+
431
+ const DefaultProvider = ({children}) => <>{children}</>
432
+
433
+ export function MainRoute({ container,externalProvider: ExternalProvider = DefaultProvider,externalProviderProps={},linking = {} }){
434
+ const dispatch = useDispatch();
435
+ const defaultSettings = useSelector((state) => state.settings);
436
+ const initialRouteName = '${initialRouteName}';
437
+ const layoutSettings = ${JSON.stringify({ ...layoutSettings, hostLayout: hostLayout.key })}
438
+ const [mainFeatures, setMainFeatures] = React.useState(null);
439
+
440
+ React.useEffect(() => {
441
+ setDefalutSettings();
442
+ }, []);
443
+
444
+
445
+ const setDefalutSettings = React.useCallback(()=>{
446
+ const config = {
447
+ ...defaultSettings,
448
+ ...layoutSettings,
449
+ };
450
+ dispatch({
451
+ type: CHANGE_SETTINGS_ACTION,
452
+ payload: config,
453
+ });
454
+ },[]);
455
+
456
+ React.useEffect(() => {
457
+ if (defaultSettings) {
458
+ const settingObj = { ...defaultSettings };
459
+ const layoutType = settingObj.layout;
460
+ const {replacedConfiguredRouteConfig} = getReplacedRouteConfig({
461
+ layoutType: layoutType,
462
+ routeConfig: appRoutes,
463
+ layoutConfigData: layoutRouteConfig,
464
+ initialRouteName,
465
+ });
466
+ if(replacedConfiguredRouteConfig){
467
+ const moduleRouteConfigObject = Object.assign({}, ...replacedConfiguredRouteConfig?.flat(1)??[]);
468
+ const replacedRouteConfig = Object.fromEntries(Object.entries(moduleRouteConfigObject));
469
+ const appReplacedRouteConfig = replacedRouteConfig ? Object.keys(replacedRouteConfig)?.map((k)=>({[k]:replacedRouteConfig[k]})) : [];
470
+
471
+ if (appReplacedRouteConfig) {
472
+ const hostRouteConfig = appReplacedRouteConfig?.map((obj)=> Object.fromEntries(Object.entries(obj)?.filter(([key,val])=>key === '/' || key.startsWith('//'+layoutSettings.hostLayout))))?.filter(value => Object.keys(value).length !== 0)??[];
473
+ const layoutRouteConfig = appReplacedRouteConfig?.map((obj)=> Object.fromEntries(Object.entries(obj)?.filter(([key,val])=>key === '/' || !key.startsWith('//'+layoutSettings.hostLayout))))?.filter(value => Object.keys(value).length !== 0)??[];
474
+ const featureRouteConfig = defaultSettings?.layout == 'host-bottom' ? hostRouteConfig:layoutRouteConfig;
475
+ features.routeConfig = featureRouteConfig;
476
+ setMainFeatures(features);
477
+ }
478
+ }
479
+ }
480
+ }, [defaultSettings]);
481
+
482
+ const loadingComponent = () => <Box flex={1}>{<Spinner />}</Box>;
483
+
484
+ if (!mainFeatures || mainFeatures?.routeConfig?.length == 0) return loadingComponent();
485
+
486
+ const plugins = mainFeatures?.getComponentFillPlugins();
487
+ const configuredRoutes = mainFeatures?.getConfiguredRoutes2('/');
488
+ appConfiguredRoutes = configuredRoutes;
489
+
490
+ return (
491
+ <InversifyProvider container={container} modules={mainFeatures}>
492
+ {mainFeatures?.getWrappedRoot(
493
+ <ErrorBoundary>
494
+ <NavigationContainerComponent configurableRoutes={configuredRoutes} independent={true} linking={linking}>
495
+ <ExternalProvider {...externalProviderProps}>
496
+ <AppNavigations />
497
+ </ExternalProvider>
498
+ <PluginArea />
499
+ <ApplicationErrorHandler plugins={plugins} />
500
+ </NavigationContainerComponent>
501
+ </ErrorBoundary>,
502
+ )}
503
+ </InversifyProvider>
504
+ );
505
+ }
506
+
507
+ export { loadContext,appConfiguredRoutes };
508
+
509
+ export default features;
510
+ `.replace(/,(\s*)$/, ''); // Removes trailing comma
511
+
512
+ // Use Prettier to format the code
513
+ classStructure = prettier.format(classStructure, { parser: 'babel' });
514
+
515
+ const appFeatures = importStatements + '\n' + classStructure;
516
+
517
+ return { appFeatures };
518
+ } catch (err) {
519
+ console.error('Error:', err);
520
+ return false;
521
+ }
522
+ }
523
+
524
+ async #generateMainRoutes({ appDirPath, i18Options, initialRouteName }) {
525
+ const mainRoutesFile = path.join(appDirPath, `/${mainRoutesJsFileName}`);
526
+ const imports: any = await this.#generateMainRoutesFile({ initialRouteName, i18Options });
527
+ const { appFeatures } = imports;
528
+ if (appFeatures) {
529
+ const writeFileResponse = await this.#writeFile(mainRoutesFile, appFeatures);
530
+ if (writeFileResponse) return true;
531
+ else return false;
532
+ }
533
+ return false;
534
+ }
535
+
536
+ async #generateAppFile({ initialRouteName, i18Options }) {
537
+ try {
538
+ let importStatements = '';
539
+ importStatements += `import 'reflect-metadata';\n`;
540
+ importStatements += `import React from 'react';\n`;
541
+ importStatements += `import { SlotFillProvider } from '@common-stack/components-pro';\n`;
542
+ importStatements += `import { ApolloProvider } from '@apollo/client';\n`;
543
+ importStatements += `import { Provider } from 'react-redux';\n`;
544
+ importStatements += `import { PersistGate } from 'redux-persist/integration/react';\n`;
545
+ importStatements += `import { SafeAreaProvider } from 'react-native-safe-area-context';\n`;
546
+ importStatements += `import {GluestackUIProvider,config,i18next,reactI18Next} from '@admin-layout/gluestack-ui-mobile';\n`;
547
+ importStatements += `import { enableScreens } from 'react-native-screens';\n`;
548
+ importStatements += `import {MainRoute,loadContext,appConfiguredRoutes} from './mainRoutes.js'\n`;
549
+
550
+ let classStructure = `
551
+ enableScreens(true);
552
+ const { I18nextProvider } = reactI18Next;
553
+ i18next.options ={...i18next?.options??{},...${JSON.stringify(i18Options)}};
554
+
555
+ const DefaultProvider = ({children}) => <>{children}</>
556
+
557
+ function App({externalProvider = DefaultProvider,externalProviderProps={},linking = {}}){
558
+ const {store,persistor,container,apolloClient: client} = loadContext();
559
+
560
+
561
+ return (
562
+ <SlotFillProvider>
563
+ <ApolloProvider client={client}>
564
+ <Provider store={store}>
565
+ <PersistGate persistor={persistor}>
566
+ <I18nextProvider i18n={i18next}>
567
+ <SafeAreaProvider>
568
+ <GluestackUIProvider config={config}>
569
+ <MainRoute container={container} externalProvider={externalProvider} linking={linking} externalProviderProps={externalProviderProps} />
570
+ </GluestackUIProvider>
571
+ </SafeAreaProvider>
572
+ </I18nextProvider>
573
+ </PersistGate>
574
+ </Provider>
575
+ </ApolloProvider>
576
+ </SlotFillProvider>
577
+ );
578
+ }
579
+
580
+ export const configuredRoutes = appConfiguredRoutes;
581
+ export default App;
582
+ `.replace(/,(\s*)$/, ''); // Removes trailing comma
583
+
584
+ // Use Prettier to format the code
585
+ classStructure = prettier.format(classStructure, { parser: 'babel' });
586
+
587
+ const appFeatures = importStatements + '\n' + classStructure;
588
+
589
+ return { appFeatures };
590
+ } catch (err) {
591
+ console.error('Error:', err);
592
+ return false;
593
+ }
594
+ }
595
+
596
+ async #generateApp({ appDirPath, i18Options, initialRouteName }) {
597
+ const mainRoutesFile = path.join(appDirPath, `/${mainAppFileName}`);
598
+ const imports: any = await this.#generateAppFile({ initialRouteName, i18Options });
599
+ const { appFeatures } = imports;
600
+ if (appFeatures) {
601
+ const writeFileResponse = await this.#writeFile(mainRoutesFile, appFeatures);
602
+ if (writeFileResponse) return true;
603
+ else return false;
604
+ }
605
+ return false;
606
+ }
607
+
396
608
  async #generateStackNavigations({ appDirPath, modules, initialRouteName, unauthenticatedComponentPath }) {
397
609
  const mainRoutes = path.join(appDirPath, `/${mainRoutesFileName}`);
398
610
  const stackDirPath = path.join(appDirPath, `/${stacksDirPath}`);
@@ -445,7 +657,7 @@ export class GenerateMobileNavigations {
445
657
  const regex = /\.(tsx|ts|jsx|js)$/i;
446
658
 
447
659
  importStatements += `import * as React from 'react';\n`;
448
- importStatements += `import {AuthWrapper} from '@admin-layout/gluestack-ui-mobile';\n`;
660
+ importStatements += `import AuthWrapper from '@admin-layout/gluestack-ui-mobile/lib/components/AuthWrapper.js';\n`;
449
661
 
450
662
  if (unauthenticatedComponentPath)
451
663
  importStatements += `import UnauthenticatedComponent from '${unauthenticatedComponentPath}';\n`;
@@ -492,12 +704,12 @@ export class GenerateMobileNavigations {
492
704
  pkgRouteConfig?.customHeader &&
493
705
  Object.keys(pkgRouteConfig.customHeader)?.length &&
494
706
  customHeaderComponentPath
495
- ? `header: (props: any) => <${customHeaderName} {...props} {...${JSON.stringify(
707
+ ? `header: (props) => <${customHeaderName} {...props} {...${JSON.stringify(
496
708
  pkgRouteConfig?.customHeader?.props ?? '',
497
709
  )}} />`
498
710
  : ''
499
711
  }}}}
500
- >{(props:any) => <AuthWrapper
712
+ >{(props) => <AuthWrapper
501
713
  auth={${pkgRouteConfig?.props?.initialParams?.auth ?? false}}
502
714
  component={<Component${moduleNumber} {...props} />}
503
715
  ${
@@ -550,7 +762,7 @@ export class GenerateMobileNavigations {
550
762
  }
551
763
 
552
764
  moduleContent += `</Stack.Group>`;
553
- moduleRender = `export default ({Stack,...rest}:any) => { return (<>${moduleContent}</>)}`;
765
+ moduleRender = `export default ({Stack,...rest}) => { return (<>${moduleContent}</>)}`;
554
766
  }
555
767
  stackNavigator = importStatements + '\n' + moduleRender;
556
768
  if (stackNavigator) {
@@ -580,7 +792,7 @@ export class GenerateMobileNavigations {
580
792
  const regex = /\.(tsx|ts|jsx|js)$/i;
581
793
 
582
794
  importStatements += `import * as React from 'react';\n`;
583
- importStatements += `import {AuthWrapper} from '@admin-layout/gluestack-ui-mobile';\n`;
795
+ importStatements += `import AuthWrapper from '@admin-layout/gluestack-ui-mobile/lib/components/AuthWrapper.js';\n`;
584
796
 
585
797
  if (unauthenticatedComponentPath)
586
798
  importStatements += `import UnauthenticatedComponent from '${unauthenticatedComponentPath}';\n`;
@@ -626,23 +838,23 @@ export class GenerateMobileNavigations {
626
838
  initialParams={${JSON.stringify(pkgRouteConfig?.props?.initialParams || {})}}
627
839
  options={{...${options},...{${
628
840
  pkgRouteConfig?.icon && Object.keys(pkgRouteConfig.icon)?.length && pkgRouteConfig?.icon?.name
629
- ? `drawerIcon: ({ color, size }: { color: any,size:any }) => <${pkgRouteConfig?.icon?.name} name="${
841
+ ? `drawerIcon: ({ color, size }) => <${pkgRouteConfig?.icon?.name} name="${
630
842
  pkgRouteConfig?.icon?.props?.name ?? 'home'
631
843
  }" size={${pkgRouteConfig?.icon?.props?.size ?? `size`}} color={${
632
844
  pkgRouteConfig?.icon?.props?.color ?? 'color'
633
- }} />`
845
+ }} />,`
634
846
  : ''
635
847
  }
636
848
  ${
637
849
  pkgRouteConfig?.customHeader &&
638
850
  Object.keys(pkgRouteConfig.customHeader)?.length &&
639
851
  customHeaderComponentPath
640
- ? `header: (props: any) => <${customHeaderName} {...props} {...${JSON.stringify(
852
+ ? `header: (props) => <${customHeaderName} {...props} {...${JSON.stringify(
641
853
  pkgRouteConfig?.customHeader?.props ?? '',
642
854
  )}} />`
643
855
  : ''
644
856
  }}}}
645
- >{(props:any) => <AuthWrapper
857
+ >{(props) => <AuthWrapper
646
858
  auth={${pkgRouteConfig?.props?.initialParams?.auth ?? false}}
647
859
  component={<Component${moduleNumber} {...props} />}
648
860
  ${
@@ -699,7 +911,7 @@ export class GenerateMobileNavigations {
699
911
  });
700
912
  }
701
913
 
702
- moduleRender = `export default ({Drawer,...rest}:any) => { return (<>${moduleContent}</>)}`;
914
+ moduleRender = `export default ({Drawer,...rest}) => { return (<>${moduleContent}</>)}`;
703
915
  moduleNavigation = importStatements + '\n' + moduleRender;
704
916
 
705
917
  const drawerNavigator = moduleNavigation;
@@ -807,7 +1019,7 @@ export class GenerateMobileNavigations {
807
1019
  const regex = /\.(tsx|ts|jsx|js)$/i;
808
1020
 
809
1021
  importStatements += `import * as React from 'react';\n`;
810
- importStatements += `import {AuthWrapper} from '@admin-layout/gluestack-ui-mobile';\n`;
1022
+ importStatements += `import AuthWrapper from '@admin-layout/gluestack-ui-mobile/lib/components/AuthWrapper.js';\n`;
811
1023
 
812
1024
  if (unauthenticatedComponentPath)
813
1025
  importStatements += `import UnauthenticatedComponent from '${unauthenticatedComponentPath}';\n`;
@@ -860,7 +1072,7 @@ export class GenerateMobileNavigations {
860
1072
  initialParams={${JSON.stringify(pkgRouteConfig?.props?.initialParams || {})}}
861
1073
  options={{...${options},...{${
862
1074
  pkgRouteConfig?.icon && Object.keys(pkgRouteConfig.icon)?.length && pkgRouteConfig?.icon?.name
863
- ? `tabBarIcon: ({ color }: { color: any }) => <${pkgRouteConfig?.icon?.name} name="${
1075
+ ? `tabBarIcon: ({ color }) => <${pkgRouteConfig?.icon?.name} name="${
864
1076
  pkgRouteConfig?.icon?.props?.name ?? 'home'
865
1077
  }" size={${pkgRouteConfig?.icon?.props?.size ?? 24}} color={${
866
1078
  pkgRouteConfig?.icon?.props?.color ?? 'color'
@@ -871,13 +1083,13 @@ export class GenerateMobileNavigations {
871
1083
  pkgRouteConfig?.customHeader &&
872
1084
  Object.keys(pkgRouteConfig.customHeader)?.length &&
873
1085
  customHeaderComponentPath
874
- ? `,header: (props: any) => <${customHeaderName} {...props} {...${JSON.stringify(
1086
+ ? `,header: (props) => <${customHeaderName} {...props} {...${JSON.stringify(
875
1087
  pkgRouteConfig?.customHeader?.props ?? '',
876
1088
  )}} />`
877
1089
  : ''
878
1090
  }
879
1091
  }}}
880
- >{(props:any) => <AuthWrapper
1092
+ >{(props) => <AuthWrapper
881
1093
  auth={${pkgRouteConfig?.props?.initialParams?.auth ?? false}}
882
1094
  component={<Component${moduleNumber} {...props} />}
883
1095
  ${
@@ -936,7 +1148,7 @@ export class GenerateMobileNavigations {
936
1148
  });
937
1149
  }
938
1150
 
939
- moduleRender = `export default ({Tab,...rest}:any) => { return (<>${moduleContent}</>)}`;
1151
+ moduleRender = `export default ({Tab,...rest}) => { return (<>${moduleContent}</>)}`;
940
1152
  moduleNavigation = importStatements + '\n' + moduleRender;
941
1153
  const bottomTabNavigator = moduleNavigation;
942
1154
  if (bottomTabNavigator) {
@@ -1178,8 +1390,8 @@ export class GenerateMobileNavigations {
1178
1390
  const Drawer = createDrawerNavigator();
1179
1391
  `;
1180
1392
  rootComponent += `
1181
- const RootComponent = (props:any) => {
1182
- const settings = useSelector((state: any) => state.settings);
1393
+ const RootComponent = (props) => {
1394
+ const settings = useSelector((state) => state.settings);
1183
1395
  const defaultHeaderProps = ${JSON.stringify(defaultHeaderProps || {})};
1184
1396
  return (
1185
1397
  <Drawer.Navigator
@@ -1188,14 +1400,14 @@ export class GenerateMobileNavigations {
1188
1400
  screenOptions={({ route }) => ({ ...${JSON.stringify(screenOptions)} ,...{
1189
1401
  ${
1190
1402
  customHeaderPath
1191
- ? `header: (props:any) => {
1403
+ ? `header: (props) => {
1192
1404
  const title = getHeaderTitle(props.options, props.route.name);
1193
1405
  return <CustomHeader {...defaultHeaderProps} {...props} title={title} style={props.options.headerStyle} />;
1194
1406
  }`
1195
1407
  : ''
1196
1408
  }
1197
1409
  }})}
1198
- ${customDrawerPath ? 'drawerContent={(props:any) => <CustomDrawerContent {...props} />}' : ''}
1410
+ ${customDrawerPath ? 'drawerContent={(props) => <CustomDrawerContent {...props} />}' : ''}
1199
1411
  >
1200
1412
  {settings?.layout == 'host-bottom' ? hostDrawerNavigations({ Drawer }) : drawerNavigations({ Drawer })}
1201
1413
  </Drawer.Navigator>
@@ -1219,20 +1431,20 @@ export class GenerateMobileNavigations {
1219
1431
  const Tab = createBottomTabNavigator();
1220
1432
  `;
1221
1433
  rootComponent += `
1222
- const RootComponent = (props:any) => {
1223
- const settings = useSelector((state: any) => state.settings);
1434
+ const RootComponent = (props) => {
1435
+ const settings = useSelector((state) => state.settings);
1224
1436
  const initialRouteName = ${JSON.stringify(initialRouteName)};
1225
1437
  let defaultScreenOptions = ${JSON.stringify(screenOptionsTab)};
1226
1438
  const defaultHeaderProps = ${JSON.stringify(defaultHeaderProps || {})};
1227
1439
  const defaultHeader = {${
1228
- isShowDefalutHeader ? `header:(props:any)=><Header {...defaultHeaderProps} {...props} />` : ''
1440
+ isShowDefalutHeader ? `header:(props)=><Header {...defaultHeaderProps} {...props} />` : ''
1229
1441
  }};
1230
1442
  return (
1231
1443
  <Tab.Navigator
1232
1444
  initialRouteName={initialRouteName}
1233
- screenOptions={(props:any)=>({...props,...defaultScreenOptions,...{${
1445
+ screenOptions={(props)=>({...props,...defaultScreenOptions,...{${
1234
1446
  customHeaderPath
1235
- ? `header: (props:any) => {
1447
+ ? `header: (props) => {
1236
1448
  const title = getHeaderTitle(props.options, props.route.name);
1237
1449
  return <CustomHeader {...defaultHeaderProps} {...props} title={title} style={props.options.headerStyle} />;
1238
1450
  }`
@@ -1240,7 +1452,7 @@ export class GenerateMobileNavigations {
1240
1452
  }}})}
1241
1453
  ${
1242
1454
  customTabBarPath
1243
- ? 'tabBar={(props:any) => <CustomTabBar key={props?.key??"customTabBarKey"} {...props} />}'
1455
+ ? 'tabBar={(props) => <CustomTabBar key={props?.key??"customTabBarKey"} {...props} />}'
1244
1456
  : ''
1245
1457
  }
1246
1458
  >
@@ -1274,21 +1486,21 @@ export class GenerateMobileNavigations {
1274
1486
  `;
1275
1487
  rootComponent += `
1276
1488
  const TabNavigator = () => {
1277
- const settings = useSelector((state: any) => state.settings);
1489
+ const settings = useSelector((state) => state.settings);
1278
1490
  const initialRouteName = ${JSON.stringify(initialRouteName)};
1279
1491
  let defaultScreenOptions = ${JSON.stringify(screenOptionsTab)};
1280
1492
  const defaultHeaderProps = ${JSON.stringify(defaultHeaderProps || {})};
1281
1493
  const defaultHeader = {${
1282
- isShowDefalutHeader ? `header:(props:any)=><Header {...defaultHeaderProps} {...props} />` : ''
1494
+ isShowDefalutHeader ? `header:(props)=><Header {...defaultHeaderProps} {...props} />` : ''
1283
1495
  }};
1284
1496
 
1285
1497
  return (
1286
1498
  <Tab.Navigator
1287
1499
  initialRouteName={initialRouteName}
1288
- screenOptions={(props:any)=>({...props,...defaultScreenOptions,...{headerShown: false,header:()=>null},})}
1500
+ screenOptions={(props)=>({...props,...defaultScreenOptions,...{headerShown: false,header:()=>null},})}
1289
1501
  ${
1290
1502
  customTabBarPath
1291
- ? 'tabBar={(props:any) => <CustomTabBar key={props?.key??"customTabBarKey"} {...props} />}'
1503
+ ? 'tabBar={(props) => <CustomTabBar key={props?.key??"customTabBarKey"} {...props} />}'
1292
1504
  : ''
1293
1505
  }
1294
1506
  >
@@ -1296,13 +1508,13 @@ export class GenerateMobileNavigations {
1296
1508
  </Tab.Navigator>
1297
1509
  )
1298
1510
  }
1299
- const RootComponent = (props:any) => {
1511
+ const RootComponent = (props) => {
1300
1512
  const initialRouteName = ${JSON.stringify(initialRouteName)};
1301
- const settings = useSelector((state: any) => state.settings);
1513
+ const settings = useSelector((state) => state.settings);
1302
1514
  let defaultScreenOptions = ${JSON.stringify(screenOptionsTab)};
1303
1515
  const defaultHeaderProps = ${JSON.stringify(defaultHeaderProps || {})};
1304
1516
  const defaultHeader = {${
1305
- isShowDefalutHeader ? `header:(props:any)=><Header {...defaultHeaderProps} {...props} />` : ''
1517
+ isShowDefalutHeader ? `header:(props)=><Header {...defaultHeaderProps} {...props} />` : ''
1306
1518
  }};
1307
1519
  return (
1308
1520
  <Drawer.Navigator
@@ -1317,7 +1529,7 @@ export class GenerateMobileNavigations {
1317
1529
  : "Home",
1318
1530
  ${
1319
1531
  customHeaderPath
1320
- ? `header: (props:any) => {
1532
+ ? `header: (props) => {
1321
1533
  const title = getHeaderTitle(props.options, props.route.name);
1322
1534
  return <CustomHeader {...defaultHeaderProps} {...props} title={title} isMixedLayout={true} style={props.options.headerStyle} />;
1323
1535
  }`
@@ -1327,11 +1539,11 @@ export class GenerateMobileNavigations {
1327
1539
  }})}
1328
1540
  ${
1329
1541
  customDrawerPath
1330
- ? 'drawerContent={((props:any)) => <CustomDrawerContent {...props} showDefaultRoutes={true} />}'
1542
+ ? 'drawerContent={((props)) => <CustomDrawerContent {...props} showDefaultRoutes={true} />}'
1331
1543
  : ''
1332
1544
  }
1333
1545
  >
1334
- <Drawer.Screen name="Layout" options={{title:"Home", drawerIcon: ({ color, size }: { color: any, size: any }) => (
1546
+ <Drawer.Screen name="Layout" options={{title:"Home", drawerIcon: ({ color, size }) => (
1335
1547
  <MaterialIcons name="home" size={24} color={color} />
1336
1548
  ),}}
1337
1549
  component={TabNavigator} />
@@ -1372,18 +1584,29 @@ export class GenerateMobileNavigations {
1372
1584
  const customTabBarPath = this.#customTabBarPath;
1373
1585
  const customDrawerPath = this.#customDrawerPath;
1374
1586
  const customHeaderPath = this.#customHeaderPath;
1587
+ const i18Options = this.#i18Options;
1375
1588
 
1376
1589
  const layoutSettings = this.#layoutSettings;
1377
1590
  const layoutConfigFileData = await this.#getLayoutConfig();
1378
1591
  const layoutType = layoutSettings?.layout || 'bottom';
1379
1592
  const isAppRoutesGenerated = await this.#generateAppRoutesJson({ appDirPath });
1380
1593
  if (isAppRoutesGenerated) {
1381
- const isModuleTsFileGenerated = await this.#generateModulesTsFile({
1594
+ // await this.#generateModulesTsFile({
1595
+ // appDirPath,
1596
+ // modules,
1597
+ // initialRouteName,
1598
+ // });
1599
+ await this.#generateMainRoutes({
1600
+ appDirPath,
1601
+ i18Options,
1602
+ initialRouteName,
1603
+ });
1604
+ const isAppFileGenerated = await this.#generateApp({
1382
1605
  appDirPath,
1383
- modules,
1606
+ i18Options,
1384
1607
  initialRouteName,
1385
1608
  });
1386
- if (isModuleTsFileGenerated) {
1609
+ if (isAppFileGenerated) {
1387
1610
  const isStackCreated = await this.#generateStackNavigations({
1388
1611
  appDirPath,
1389
1612
  modules,