nx-react-native-cli 1.0.16 → 1.0.18

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 (89) hide show
  1. package/lib/index.cjs +32 -32
  2. package/package.json +5 -1
  3. package/templates/.eslintrc.json +1 -0
  4. package/templates/.nvmrc +1 -1
  5. package/templates/apps/mobile/android/app/build.gradle +12 -24
  6. package/templates/apps/mobile/android/app/proguard-rules.pro +20 -0
  7. package/templates/apps/mobile/android/build.gradle +6 -19
  8. package/templates/apps/mobile/babel.config.json +2 -1
  9. package/templates/apps/mobile/export-node-binary.sh +6 -0
  10. package/templates/apps/mobile/jest.config.ts +12 -0
  11. package/templates/apps/mobile/package.json +6 -1
  12. package/templates/apps/mobile/project.json +3 -2
  13. package/templates/apps/mobile/react-native.config.js +7 -0
  14. package/templates/apps/mobile/src/app/index.tsx +7 -1
  15. package/templates/apps/mobile/src/assets/fonts/InterBlack.ttf +0 -0
  16. package/templates/apps/mobile/src/assets/fonts/InterBlackItalic.ttf +0 -0
  17. package/templates/apps/mobile/src/assets/fonts/InterBold.ttf +0 -0
  18. package/templates/apps/mobile/src/assets/fonts/InterBoldItalic.ttf +0 -0
  19. package/templates/apps/mobile/src/assets/fonts/InterExtraBold.ttf +0 -0
  20. package/templates/apps/mobile/src/assets/fonts/InterExtraBoldItalic.ttf +0 -0
  21. package/templates/apps/mobile/src/assets/fonts/InterExtraLight.ttf +0 -0
  22. package/templates/apps/mobile/src/assets/fonts/InterExtraLightItalic.ttf +0 -0
  23. package/templates/apps/mobile/src/assets/fonts/InterItalic.ttf +0 -0
  24. package/templates/apps/mobile/src/assets/fonts/InterLight.ttf +0 -0
  25. package/templates/apps/mobile/src/assets/fonts/InterLightItalic.ttf +0 -0
  26. package/templates/apps/mobile/src/assets/fonts/InterMedium.ttf +0 -0
  27. package/templates/apps/mobile/src/assets/fonts/InterMediumItalic.ttf +0 -0
  28. package/templates/apps/mobile/src/assets/fonts/InterRegular.ttf +0 -0
  29. package/templates/apps/mobile/src/assets/fonts/InterSemiBold.ttf +0 -0
  30. package/templates/apps/mobile/src/assets/fonts/InterSemiBoldItalic.ttf +0 -0
  31. package/templates/apps/mobile/src/assets/fonts/InterThin.ttf +0 -0
  32. package/templates/apps/mobile/src/assets/fonts/InterThinItalic.ttf +0 -0
  33. package/templates/apps/mobile/src/assets/fonts/MontserratBlack.ttf +0 -0
  34. package/templates/apps/mobile/src/assets/fonts/MontserratBlackItalic.ttf +0 -0
  35. package/templates/apps/mobile/src/assets/fonts/MontserratBold.ttf +0 -0
  36. package/templates/apps/mobile/src/assets/fonts/MontserratBoldItalic.ttf +0 -0
  37. package/templates/apps/mobile/src/assets/fonts/MontserratExtraBold.ttf +0 -0
  38. package/templates/apps/mobile/src/assets/fonts/MontserratExtraBoldItalic.ttf +0 -0
  39. package/templates/apps/mobile/src/assets/fonts/MontserratExtraLight.ttf +0 -0
  40. package/templates/apps/mobile/src/assets/fonts/MontserratExtraLightItalic.ttf +0 -0
  41. package/templates/apps/mobile/src/assets/fonts/MontserratItalic.ttf +0 -0
  42. package/templates/apps/mobile/src/assets/fonts/MontserratLight.ttf +0 -0
  43. package/templates/apps/mobile/src/assets/fonts/MontserratLightItalic.ttf +0 -0
  44. package/templates/apps/mobile/src/assets/fonts/MontserratMedium.ttf +0 -0
  45. package/templates/apps/mobile/src/assets/fonts/MontserratMediumItalic.ttf +0 -0
  46. package/templates/apps/mobile/src/assets/fonts/MontserratRegular.ttf +0 -0
  47. package/templates/apps/mobile/src/assets/fonts/MontserratSemiBold.ttf +0 -0
  48. package/templates/apps/mobile/src/assets/fonts/MontserratSemiBoldItalic.ttf +0 -0
  49. package/templates/apps/mobile/src/assets/fonts/MontserratThin.ttf +0 -0
  50. package/templates/apps/mobile/src/assets/fonts/MontserratThinItalic.ttf +0 -0
  51. package/templates/apps/mobile/src/components/atoms/BottomSheet/bottom-sheet.component.tsx +9 -7
  52. package/templates/apps/mobile/src/components/atoms/Box/box.component.tsx +21 -0
  53. package/templates/apps/mobile/src/components/atoms/Box/index.ts +1 -0
  54. package/templates/apps/mobile/src/components/atoms/Button/button.component.tsx +24 -8
  55. package/templates/apps/mobile/src/components/atoms/Button/index.ts +0 -1
  56. package/templates/apps/mobile/src/components/atoms/Divider/divider-component.tsx +2 -2
  57. package/templates/apps/mobile/src/components/atoms/InputLayout/input-layout.component.tsx +12 -11
  58. package/templates/apps/mobile/src/components/atoms/ListLoadingItem/list-loading-item.component.tsx +17 -17
  59. package/templates/apps/mobile/src/components/atoms/Modal/modal.component.tsx +5 -4
  60. package/templates/apps/mobile/src/components/atoms/ScreenLoader/screen-loader.component.tsx +5 -4
  61. package/templates/apps/mobile/src/components/atoms/Skeleton/skeleton.component.tsx +2 -2
  62. package/templates/apps/mobile/src/components/atoms/TextInput/text-input.component.tsx +5 -5
  63. package/templates/apps/mobile/src/components/atoms/Typography/index.ts +1 -0
  64. package/templates/apps/mobile/src/components/atoms/{Text/text.component.tsx → Typography/typography.component.tsx} +1 -1
  65. package/templates/apps/mobile/src/components/atoms/index.ts +2 -1
  66. package/templates/apps/mobile/src/components/molecules/BackButton/back-button.component.tsx +4 -4
  67. package/templates/apps/mobile/src/components/molecules/BottomActionsContainer/BottomActionsContainer.component.tsx +1 -4
  68. package/templates/apps/mobile/src/components/molecules/ScreenContainer/screen-container.component.tsx +11 -9
  69. package/templates/apps/mobile/src/components/molecules/ScreenHeader/screen-header.component.tsx +13 -19
  70. package/templates/apps/mobile/src/components/molecules/StorageManager/StorageManager.component.tsx +1 -3
  71. package/templates/apps/mobile/src/hooks/index.ts +2 -1
  72. package/templates/apps/mobile/src/hooks/useToggleDarkMode.hook.tsx +9 -0
  73. package/templates/apps/mobile/src/routes/index.tsx +3 -3
  74. package/templates/apps/mobile/src/routes/privateRoutes.tsx +10 -7
  75. package/templates/apps/mobile/src/routes/publicRoutes.tsx +12 -9
  76. package/templates/apps/mobile/src/routes/screen-options.ts +1 -6
  77. package/templates/apps/mobile/src/routes/screens.enum.ts +1 -1
  78. package/templates/apps/mobile/src/screens/HomeScreen/home.screen.tsx +2 -2
  79. package/templates/apps/mobile/src/screens/LandingScreen/landing.screen.tsx +37 -0
  80. package/templates/apps/mobile/src/types/component.type.ts +1 -6
  81. package/templates/apps/mobile/src/utils/axios.util.ts +10 -0
  82. package/templates/apps/mobile/src/utils/index.ts +4 -0
  83. package/templates/apps/mobile/src/utils/log.util.ts +40 -0
  84. package/templates/apps/mobile/src/utils/route.util.ts +48 -0
  85. package/templates/apps/mobile/test-setup.ts +1 -0
  86. package/templates/apps/mobile/tsconfig.spec.json +20 -0
  87. package/templates/apps/mobile/src/components/atoms/Button/outlined-button.component.tsx +0 -59
  88. package/templates/apps/mobile/src/components/atoms/Text/index.ts +0 -1
  89. package/templates/apps/mobile/src/screens/LoginScreen/login.screen.tsx +0 -13
@@ -0,0 +1,40 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /* eslint-disable no-console */
3
+ /* global __DEV__ */
4
+ import SimpleToast from 'react-native-simple-toast';
5
+
6
+ export const devLog = (message?: any, ...optionalParams: any[]) => {
7
+ if (__DEV__) {
8
+ console.log(message, ...optionalParams);
9
+ }
10
+ };
11
+
12
+ export const logToast = (message?: any, ...optionalParams: any[]) => {
13
+ if (__DEV__) {
14
+ devLog(message, ...optionalParams);
15
+ SimpleToast.show(message, SimpleToast.SHORT);
16
+ }
17
+ };
18
+
19
+ export const toast = (message: string) => {
20
+ SimpleToast.show(message, SimpleToast.SHORT);
21
+ };
22
+
23
+ export function comingSoon() {
24
+ toast('Feature coming soon');
25
+ }
26
+
27
+ export const prettyJSON = (obj: any) => JSON.stringify(obj, null, 2);
28
+
29
+ export const startTimer = () => Date.now();
30
+
31
+ export const endTimer = (startTime: number, label = 'total duration', enableDebug = false) => {
32
+ const endTime = Date.now();
33
+ const duration = endTime - startTime;
34
+
35
+ if (enableDebug) {
36
+ devLog(`${label}: ${duration}ms`);
37
+ }
38
+
39
+ return duration;
40
+ };
@@ -0,0 +1,48 @@
1
+ /* eslint-disable max-params */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import { CommonActions, NavigationState, ParamListBase, Route } from '@react-navigation/native';
4
+
5
+ export function getPreviousRouteName(navigationState: NavigationState<ParamListBase>) {
6
+ const routes = navigationState.routes;
7
+ const currentIndex = navigationState.index;
8
+
9
+ if (currentIndex > 0) {
10
+ return routes[currentIndex - 1].name;
11
+ }
12
+
13
+ return null;
14
+ }
15
+
16
+ export function getCurrentRouteName(navigation: any) {
17
+ return navigation.getState().routes[navigation.getState().index].name;
18
+ }
19
+
20
+ export function navigationPop(navigation: any, frequency = 2) {
21
+ navigation.dispatch((state: any) => {
22
+ const routes = state.routes.slice(0, -frequency);
23
+
24
+ return CommonActions.reset({
25
+ ...state,
26
+ index: routes.length - 1,
27
+ routes,
28
+ });
29
+ });
30
+ }
31
+
32
+ export function navigationNavigateAndReset(
33
+ navigation: any,
34
+ routeName: string,
35
+ frequency = 1,
36
+ params?: any,
37
+ ) {
38
+ navigation.dispatch((state: any) => {
39
+ const routes = state.routes.slice(0, -frequency);
40
+ routes.push({ name: routeName, params });
41
+
42
+ return CommonActions.reset({
43
+ ...state,
44
+ index: routes.length - 1,
45
+ routes,
46
+ });
47
+ });
48
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-native/extend-expect';
@@ -0,0 +1,20 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["jest", "node"]
7
+ },
8
+ "include": [
9
+ "jest.config.ts",
10
+ "src/**/*.test.ts",
11
+ "src/**/*.spec.ts",
12
+ "src/**/*.test.tsx",
13
+ "src/**/*.spec.tsx",
14
+ "src/**/*.test.js",
15
+ "src/**/*.spec.js",
16
+ "src/**/*.test.jsx",
17
+ "src/**/*.spec.jsx",
18
+ "src/**/*.d.ts"
19
+ ]
20
+ }
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import {
3
- ActivityIndicator,
4
- StyleProp,
5
- TextStyle,
6
- TouchableOpacity,
7
- TouchableOpacityProps,
8
- View,
9
- ViewStyle,
10
- } from 'react-native';
11
-
12
- import { colors, disabledInputStyle, tw } from '../../../tailwind';
13
- import { DefaultComponentProps } from '../../../types/component.type';
14
- import { Text } from '../Text';
15
-
16
- type Props = DefaultComponentProps &
17
- TouchableOpacityProps & {
18
- buttonStyle?: StyleProp<ViewStyle>;
19
- children?: React.ReactNode;
20
- isLoading?: boolean;
21
- textStyle?: StyleProp<TextStyle>;
22
- title?: string;
23
- };
24
-
25
- const ACTIVE_OPACITY = 0.5;
26
-
27
- export function OutlinedButton(props: Props): JSX.Element {
28
- const {
29
- activeOpacity = ACTIVE_OPACITY,
30
- buttonStyle,
31
- children,
32
- isDisabled = false,
33
- isLoading = false,
34
- style,
35
- textStyle,
36
- title = 'Button',
37
- ...rest
38
- } = props;
39
- const disabled = isDisabled || isLoading;
40
- const display = children ? (
41
- children
42
- ) : (
43
- <Text style={[tw`text-primary-700 font-medium`, textStyle]}>{title}</Text>
44
- );
45
-
46
- return (
47
- <TouchableOpacity activeOpacity={activeOpacity} disabled={disabled} style={[style]} {...rest}>
48
- <View
49
- style={[
50
- tw`border-primary-700 items-center justify-center rounded-md border-2 bg-white p-4`,
51
- buttonStyle,
52
- disabledInputStyle(disabled),
53
- ]}
54
- >
55
- {isLoading ? <ActivityIndicator color={colors.primary[100]} /> : display}
56
- </View>
57
- </TouchableOpacity>
58
- );
59
- }
@@ -1 +0,0 @@
1
- export * from './text.component';
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
-
3
- import { ScreenContainer, Text } from '../../components';
4
- import { PublicScreenProps, Screens } from '../../routes';
5
- import { tw } from '../../tailwind';
6
-
7
- export function LoginScreen(props: PublicScreenProps<Screens.LOGIN>) {
8
- return (
9
- <ScreenContainer style={tw`bg-gray-50`}>
10
- <Text>Login</Text>
11
- </ScreenContainer>
12
- );
13
- }