nx-react-native-cli 1.0.9 → 1.0.10

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 (111) hide show
  1. package/lib/index.cjs +1 -1
  2. package/package.json +1 -1
  3. package/contents/.eslintrc.json +0 -293
  4. package/contents/.husky/pre-commit +0 -5
  5. package/contents/.husky/pre-push +0 -15
  6. package/contents/.nvmrc +0 -1
  7. package/contents/.prettierignore +0 -8
  8. package/contents/.prettierrc +0 -13
  9. package/contents/.ruby-version +0 -1
  10. package/contents/.vscode/extensions.json +0 -10
  11. package/contents/.vscode/settings.json +0 -18
  12. package/contents/apps/mobile/.env.template +0 -3
  13. package/contents/apps/mobile/.eslintrc.json +0 -34
  14. package/contents/apps/mobile/Gemfile +0 -11
  15. package/contents/apps/mobile/android/app/build.gradle +0 -164
  16. package/contents/apps/mobile/android/app/src/dev/res/values/strings.xml +0 -3
  17. package/contents/apps/mobile/android/app/src/production/res/values/strings.xml +0 -3
  18. package/contents/apps/mobile/android/build.gradle +0 -34
  19. package/contents/apps/mobile/babel.config.json +0 -14
  20. package/contents/apps/mobile/fastlane/.env.template +0 -24
  21. package/contents/apps/mobile/fastlane/Fastfile +0 -303
  22. package/contents/apps/mobile/fastlane/Matchfile +0 -5
  23. package/contents/apps/mobile/fastlane/Pluginfile +0 -6
  24. package/contents/apps/mobile/fastlane/README.md +0 -65
  25. package/contents/apps/mobile/package.json +0 -77
  26. package/contents/apps/mobile/project.json +0 -102
  27. package/contents/apps/mobile/src/app/index.tsx +0 -68
  28. package/contents/apps/mobile/src/components/atoms/BottomSheet/bottom-sheet.component.tsx +0 -145
  29. package/contents/apps/mobile/src/components/atoms/BottomSheet/index.ts +0 -1
  30. package/contents/apps/mobile/src/components/atoms/Button/button.component.tsx +0 -55
  31. package/contents/apps/mobile/src/components/atoms/Button/index.ts +0 -2
  32. package/contents/apps/mobile/src/components/atoms/Button/outlined-button.component.tsx +0 -59
  33. package/contents/apps/mobile/src/components/atoms/Divider/divider-component.tsx +0 -13
  34. package/contents/apps/mobile/src/components/atoms/Divider/index.ts +0 -1
  35. package/contents/apps/mobile/src/components/atoms/InputLayout/index.ts +0 -1
  36. package/contents/apps/mobile/src/components/atoms/InputLayout/input-layout.component.tsx +0 -34
  37. package/contents/apps/mobile/src/components/atoms/ListLoadingItem/index.ts +0 -1
  38. package/contents/apps/mobile/src/components/atoms/ListLoadingItem/list-loading-item.component.tsx +0 -56
  39. package/contents/apps/mobile/src/components/atoms/Modal/index.ts +0 -1
  40. package/contents/apps/mobile/src/components/atoms/Modal/modal.component.tsx +0 -58
  41. package/contents/apps/mobile/src/components/atoms/ScreenLoader/index.ts +0 -1
  42. package/contents/apps/mobile/src/components/atoms/ScreenLoader/screen-loader.component.tsx +0 -17
  43. package/contents/apps/mobile/src/components/atoms/Skeleton/index.ts +0 -1
  44. package/contents/apps/mobile/src/components/atoms/Skeleton/skeleton.component.tsx +0 -42
  45. package/contents/apps/mobile/src/components/atoms/Text/index.ts +0 -1
  46. package/contents/apps/mobile/src/components/atoms/Text/text.component.tsx +0 -23
  47. package/contents/apps/mobile/src/components/atoms/TextInput/constants.ts +0 -43
  48. package/contents/apps/mobile/src/components/atoms/TextInput/index.ts +0 -2
  49. package/contents/apps/mobile/src/components/atoms/TextInput/text-input.component.tsx +0 -137
  50. package/contents/apps/mobile/src/components/atoms/index.ts +0 -10
  51. package/contents/apps/mobile/src/components/index.ts +0 -3
  52. package/contents/apps/mobile/src/components/molecules/BackButton/back-button.component.tsx +0 -58
  53. package/contents/apps/mobile/src/components/molecules/BackButton/index.ts +0 -1
  54. package/contents/apps/mobile/src/components/molecules/BottomActionsContainer/BottomActionsContainer.component.tsx +0 -28
  55. package/contents/apps/mobile/src/components/molecules/BottomActionsContainer/index.ts +0 -1
  56. package/contents/apps/mobile/src/components/molecules/ScreenContainer/index.ts +0 -1
  57. package/contents/apps/mobile/src/components/molecules/ScreenContainer/screen-container.component.tsx +0 -100
  58. package/contents/apps/mobile/src/components/molecules/ScreenHeader/index.ts +0 -1
  59. package/contents/apps/mobile/src/components/molecules/ScreenHeader/screen-header.component.tsx +0 -71
  60. package/contents/apps/mobile/src/components/molecules/StorageManager/StorageManager.component.tsx +0 -18
  61. package/contents/apps/mobile/src/components/molecules/StorageManager/index.ts +0 -1
  62. package/contents/apps/mobile/src/components/molecules/index.ts +0 -5
  63. package/contents/apps/mobile/src/components/organisms/index.ts +0 -1
  64. package/contents/apps/mobile/src/config/index.ts +0 -13
  65. package/contents/apps/mobile/src/dimens/index.ts +0 -1
  66. package/contents/apps/mobile/src/env.d.ts +0 -17
  67. package/contents/apps/mobile/src/hooks/index.ts +0 -9
  68. package/contents/apps/mobile/src/hooks/useAppState.hook.tsx +0 -20
  69. package/contents/apps/mobile/src/hooks/useApplicationDimensions.hook.tsx +0 -10
  70. package/contents/apps/mobile/src/hooks/useDebounce.hook.ts +0 -11
  71. package/contents/apps/mobile/src/hooks/useGetLayoutHeight.hook.tsx +0 -27
  72. package/contents/apps/mobile/src/hooks/useGetLayoutWidth.hook.tsx +0 -27
  73. package/contents/apps/mobile/src/hooks/useNavigation.hook.tsx +0 -8
  74. package/contents/apps/mobile/src/hooks/useShakeAnimation.hook.tsx +0 -32
  75. package/contents/apps/mobile/src/hooks/useTextInputChangeFocus.hook.tsx +0 -12
  76. package/contents/apps/mobile/src/hooks/useThrottle.hook.ts +0 -11
  77. package/contents/apps/mobile/src/icons/arrow-left.svg +0 -3
  78. package/contents/apps/mobile/src/icons/checkbox-active.svg +0 -4
  79. package/contents/apps/mobile/src/icons/checkbox-unactive.svg +0 -4
  80. package/contents/apps/mobile/src/icons/close.svg +0 -3
  81. package/contents/apps/mobile/src/icons/download.svg +0 -4
  82. package/contents/apps/mobile/src/icons/email.svg +0 -10
  83. package/contents/apps/mobile/src/icons/eye-slash.svg +0 -11
  84. package/contents/apps/mobile/src/icons/eye.svg +0 -4
  85. package/contents/apps/mobile/src/icons/gear.svg +0 -4
  86. package/contents/apps/mobile/src/icons/home.svg +0 -3
  87. package/contents/apps/mobile/src/icons/index.ts +0 -33
  88. package/contents/apps/mobile/src/icons/pencil.svg +0 -3
  89. package/contents/apps/mobile/src/icons/phone.svg +0 -3
  90. package/contents/apps/mobile/src/icons/user-circle.svg +0 -3
  91. package/contents/apps/mobile/src/icons/user.svg +0 -4
  92. package/contents/apps/mobile/src/icons/warning.svg +0 -3
  93. package/contents/apps/mobile/src/main.tsx +0 -5
  94. package/contents/apps/mobile/src/routes/index.tsx +0 -65
  95. package/contents/apps/mobile/src/routes/privateRoutes.tsx +0 -32
  96. package/contents/apps/mobile/src/routes/publicRoutes.tsx +0 -26
  97. package/contents/apps/mobile/src/routes/routes.enum.ts +0 -5
  98. package/contents/apps/mobile/src/routes/screen-options.ts +0 -9
  99. package/contents/apps/mobile/src/routes/screens.enum.ts +0 -4
  100. package/contents/apps/mobile/src/screens/HomeScreen/home.screen.tsx +0 -12
  101. package/contents/apps/mobile/src/screens/LoginScreen/login.screen.tsx +0 -13
  102. package/contents/apps/mobile/src/stores/index.ts +0 -1
  103. package/contents/apps/mobile/src/stores/local-storage.store.ts +0 -60
  104. package/contents/apps/mobile/src/stores/mmkvStorage.ts +0 -19
  105. package/contents/apps/mobile/src/tailwind/index.ts +0 -24
  106. package/contents/apps/mobile/src/types/component.type.ts +0 -13
  107. package/contents/apps/mobile/src/types/index.ts +0 -1
  108. package/contents/apps/mobile/tailwind.config.js +0 -80
  109. package/contents/apps/mobile/tsconfig.app.json +0 -11
  110. package/contents/check-env.sh +0 -44
  111. package/contents/clean-generated-outputs.sh +0 -32
@@ -1,77 +0,0 @@
1
- {
2
- "name": "mobile",
3
- "version": "0.0.1",
4
- "private": true,
5
- "scripts": {
6
- "android:connect": "adb reverse tcp:8081 tcp:8081",
7
- "start": "npx nx start mobile --skip-nx-cache",
8
- "run-ios": "npx nx run-ios mobile --skip-nx-cache --scheme=Dev --simulator='iPhone 13 (A96A9251-28D7-48B1-8F6A-20B6CCB8810B)'",
9
- "run-android": "npx nx run-android mobile --skip-nx-cache",
10
- "ensure-symlink": "npx nx ensure-symlink mobile",
11
- "sync-deps": "npx nx sync-deps mobile",
12
- "pod-install": "npx nx pod-install mobile",
13
- "bundle:pod-install": "cd ios && bundle install && bundle exec pod install --repo-update",
14
- "pre-build": "npm run ensure-symlink && npm run sync-deps && npm run pod-install",
15
- "list:ios-configurations": "cd ios && xcodebuild -list",
16
- "list:ios-devices": "xcrun xctrace list devices",
17
- "xcode": "open ios/AppsMobile.xcworkspace",
18
- "check-env:mobile": "cd ../.. && npm run check-env:mobile",
19
- "setup-fastlane": "rbenv local && bundle install && bundle update",
20
- "deploy-android:dev": "bundle exec fastlane android dev --env development",
21
- "deploy-ios:dev": "bundle exec fastlane ios dev --env development",
22
- "ios-certificates": "npm run setup-fastlane && bundle exec fastlane ios certificates --env development"
23
- },
24
- "dependencies": {
25
- "@gorhom/bottom-sheet": "*",
26
- "@hookform/resolvers": "*",
27
- "@react-native-async-storage/async-storage": "*",
28
- "@react-native-community/datetimepicker": "*",
29
- "@react-native-community/hooks": "*",
30
- "@react-native/metro-config": "*",
31
- "@react-navigation/core": "*",
32
- "@react-navigation/material-top-tabs": "*",
33
- "@react-navigation/native-stack": "*",
34
- "@react-navigation/native": "*",
35
- "@react-navigation/routers": "*",
36
- "@react-navigation/stack": "*",
37
- "@tanstack/query-async-storage-persister": "*",
38
- "@tanstack/query-core": "*",
39
- "@tanstack/query-sync-storage-persister": "*",
40
- "@tanstack/react-query-persist-client": "*",
41
- "@tanstack/react-query": "*",
42
- "@testing-library/jest-native": "*",
43
- "@testing-library/react-native": "*",
44
- "axios": "*",
45
- "babel-plugin-module-resolver": "*",
46
- "dayjs": "*",
47
- "jotai-optics": "*",
48
- "jotai": "*",
49
- "lodash": "*",
50
- "metro-config": "*",
51
- "react-hook-form": "*",
52
- "react-native-dotenv": "*",
53
- "react-native-fast-image": "*",
54
- "react-native-gesture-handler": "*",
55
- "react-native-get-random-values": "*",
56
- "react-native-keyboard-aware-scroll-view": "*",
57
- "react-native-mmkv": "*",
58
- "react-native-modal-datetime-picker": "*",
59
- "react-native-modal": "*",
60
- "react-native-pager-view": "*",
61
- "react-native-reanimated": "*",
62
- "react-native-safe-area-context": "*",
63
- "react-native-screens": "*",
64
- "react-native-simple-toast": "*",
65
- "react-native-svg-transformer": "*",
66
- "react-native-svg": "*",
67
- "react-native-url-polyfill": "*",
68
- "react-native": "*",
69
- "react": "*",
70
- "tailwindcss": "*",
71
- "twrnc": "*",
72
- "uuid": "*",
73
- "zod-validation-error": "*",
74
- "zod": "*",
75
- "zustand": "*"
76
- }
77
- }
@@ -1,102 +0,0 @@
1
- {
2
- "name": "mobile",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "apps/mobile/src",
5
- "projectType": "application",
6
- "targets": {
7
- "check-env": {
8
- "executor": "nx:run-script",
9
- "options": {
10
- "script": "check-env:mobile"
11
- }
12
- },
13
- "start": {
14
- "executor": "@nx/react-native:start",
15
- "dependsOn": ["check-env", "ensure-symlink", "pod-install"],
16
- "options": {
17
- "port": 8081,
18
- "resetCache": true
19
- }
20
- },
21
- "serve": {
22
- "executor": "nx:run-commands",
23
- "options": {
24
- "command": "nx start mobile"
25
- }
26
- },
27
- "run-ios": {
28
- "executor": "@nx/react-native:run-ios",
29
- "dependsOn": ["ensure-symlink", "pod-install"],
30
- "options": {}
31
- },
32
- "bundle-ios": {
33
- "executor": "@nx/react-native:bundle",
34
- "dependsOn": ["ensure-symlink"],
35
- "outputs": ["{options.bundleOutput}"],
36
- "options": {
37
- "entryFile": "src/main.tsx",
38
- "platform": "ios",
39
- "bundleOutput": "dist/apps/mobile/ios/main.jsbundle"
40
- }
41
- },
42
- "run-android": {
43
- "executor": "@nx/react-native:run-android",
44
- "dependsOn": ["ensure-symlink"],
45
- "options": {}
46
- },
47
- "build-android": {
48
- "executor": "@nx/react-native:build-android",
49
- "outputs": [
50
- "{projectRoot}/android/app/build/outputs/bundle",
51
- "{projectRoot}/android/app/build/outputs/apk"
52
- ],
53
- "dependsOn": ["ensure-symlink"],
54
- "options": {}
55
- },
56
- "build-ios": {
57
- "executor": "@nx/react-native:build-ios",
58
- "outputs": ["{projectRoot}/ios/build/Build"],
59
- "dependsOn": ["ensure-symlink", "pod-install"],
60
- "options": {}
61
- },
62
- "pod-install": {
63
- "executor": "nx:run-script",
64
- "options": {
65
- "script": "bundle:pod-install"
66
- }
67
- },
68
- "bundle-android": {
69
- "executor": "@nx/react-native:bundle",
70
- "dependsOn": ["ensure-symlink"],
71
- "outputs": ["{options.bundleOutput}"],
72
- "options": {
73
- "entryFile": "src/main.tsx",
74
- "platform": "android",
75
- "bundleOutput": "dist/apps/mobile/android/main.jsbundle"
76
- }
77
- },
78
- "sync-deps": {
79
- "executor": "@nx/react-native:sync-deps",
80
- "options": {}
81
- },
82
- "ensure-symlink": {
83
- "executor": "@nx/react-native:ensure-symlink",
84
- "options": {}
85
- },
86
- "lint": {
87
- "executor": "@nx/eslint:lint",
88
- "outputs": ["{options.outputFile}"],
89
- "options": {
90
- "lintFilePatterns": ["apps/mobile/**/*.{ts,tsx,js,jsx}"]
91
- }
92
- },
93
- "test": {
94
- "executor": "@nx/jest:jest",
95
- "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
96
- "options": {
97
- "jestConfig": "apps/mobile/jest.config.ts"
98
- }
99
- }
100
- },
101
- "tags": []
102
- }
@@ -1,68 +0,0 @@
1
- import AsyncStorage from '@react-native-async-storage/async-storage';
2
- import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister';
3
- import { QueryClient } from '@tanstack/react-query';
4
- import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client';
5
- import React from 'react';
6
- import { LogBox } from 'react-native';
7
- import { GestureHandlerRootView } from 'react-native-gesture-handler';
8
- import 'react-native-get-random-values';
9
- import { SafeAreaProvider } from 'react-native-safe-area-context';
10
- import { enableFreeze } from 'react-native-screens';
11
- import 'react-native-url-polyfill/auto';
12
-
13
- import { StorageManager } from '../components';
14
- import ApplicationRoutes from '../routes';
15
- import { tw } from '../tailwind';
16
-
17
- LogBox.ignoreLogs(['VirtualizedLists', 'onAnimatedValueUpdate']);
18
-
19
- enableFreeze(true);
20
-
21
- const MS_IN_S = 1000;
22
- const S_IN_A_MIN = 60;
23
- const MIN_IN_AN_HOUR = 60;
24
- const HOURS_IN_A_DAY = 24;
25
- const MS_IN_DAYS = MS_IN_S * S_IN_A_MIN * MIN_IN_AN_HOUR * HOURS_IN_A_DAY;
26
-
27
- const CACHE_TIME = MS_IN_DAYS * 1;
28
- const STALE_TIME = MS_IN_S * S_IN_A_MIN * MIN_IN_AN_HOUR; // 5 minutes
29
-
30
- const queryClient = new QueryClient({
31
- defaultOptions: {
32
- queries: {
33
- staleTime: STALE_TIME,
34
- },
35
- },
36
- });
37
-
38
- const persister = createAsyncStoragePersister({
39
- storage: AsyncStorage,
40
- });
41
-
42
- const persistOptions = { maxAge: CACHE_TIME, persister };
43
-
44
- function Application(): JSX.Element {
45
- return (
46
- <GestureHandlerRootView style={tw`flex-1`}>
47
- <SafeAreaProvider>
48
- <PersistQueryClientProvider client={queryClient} persistOptions={persistOptions}>
49
- <StorageManager>
50
- <ApplicationRoutes />
51
- </StorageManager>
52
- </PersistQueryClientProvider>
53
- </SafeAreaProvider>
54
- </GestureHandlerRootView>
55
- );
56
- }
57
-
58
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
- function HeadlessCheck({ isHeadless }: any) {
60
- if (isHeadless) {
61
- // App has been launched in the background by iOS, ignore
62
- return null;
63
- }
64
-
65
- return <Application />;
66
- }
67
-
68
- export default HeadlessCheck;
@@ -1,145 +0,0 @@
1
- /* eslint-disable no-magic-numbers */
2
- import {
3
- BottomSheetBackdropProps,
4
- BottomSheetHandle,
5
- BottomSheetHandleProps,
6
- BottomSheetModal,
7
- BottomSheetScrollView,
8
- } from '@gorhom/bottom-sheet';
9
- import React, { FC, ReactNode, RefObject, useCallback, useMemo, useRef } from 'react';
10
- import { Keyboard, StyleProp, ViewStyle } from 'react-native';
11
- import { TouchableWithoutFeedback } from 'react-native-gesture-handler';
12
- import Animated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated';
13
-
14
- import { tw } from '../../../tailwind';
15
- import { DefaultComponentProps } from '../../../types';
16
-
17
- export type BottomSheetProps = DefaultComponentProps & {
18
- backgroundStyle?: StyleProp<Omit<ViewStyle, 'left' | 'right' | 'position' | 'top' | 'bottom'>>;
19
- children?: ReactNode;
20
- contentContainerStyle?: StyleProp<ViewStyle>;
21
- enableDismissOnPressBackdrop?: boolean;
22
- enableDynamicSizing?: boolean;
23
- enablePanDownToClose?: boolean;
24
- handleComponent?: FC<BottomSheetHandleProps> | null;
25
- onExpand?: () => void;
26
- sheetRef: RefObject<BottomSheetModal>;
27
- snapPoints?: string[];
28
- };
29
-
30
- const DEFAULT_SNAP_POINTS = ['25%', '50%', '100%'];
31
-
32
- const CustomBackdrop = ({
33
- animatedIndex,
34
- enableDismissOnPressBackdrop = true,
35
- sheetRef,
36
- style,
37
- }: BottomSheetBackdropProps & {
38
- enableDismissOnPressBackdrop?: boolean;
39
- sheetRef: RefObject<BottomSheetModal>;
40
- }) => {
41
- function handleDismiss() {
42
- if (enableDismissOnPressBackdrop) {
43
- sheetRef.current?.close();
44
- }
45
- }
46
-
47
- const containerAnimatedStyle = useAnimatedStyle(() => {
48
- const opacity = interpolate(
49
- animatedIndex.value,
50
- [-1, 0, 1],
51
- [0, 0.5, 0.75],
52
- Extrapolation.CLAMP,
53
- );
54
- const pointerEvents = opacity > 0.25 ? 'auto' : 'none';
55
-
56
- return {
57
- opacity,
58
- pointerEvents,
59
- };
60
- });
61
-
62
- // styles
63
- const containerStyle = useMemo(
64
- () => [style, tw`bg-black-950/60`, containerAnimatedStyle],
65
- [style, containerAnimatedStyle],
66
- );
67
-
68
- return (
69
- <Animated.View style={containerStyle}>
70
- <TouchableWithoutFeedback style={tw`h-full w-full`} onPress={handleDismiss} />
71
- </Animated.View>
72
- );
73
- };
74
-
75
- export function BottomSheet(props: BottomSheetProps) {
76
- const {
77
- backgroundStyle,
78
- children,
79
- contentContainerStyle,
80
- enableDismissOnPressBackdrop = true,
81
- enableDynamicSizing = false,
82
- enablePanDownToClose = true,
83
- handleComponent = BottomSheetHandle,
84
- sheetRef,
85
- snapPoints = DEFAULT_SNAP_POINTS,
86
- style,
87
- } = props;
88
- const points = enableDynamicSizing ? undefined : snapPoints;
89
-
90
- function renderBackdrop(backdropProps: BottomSheetBackdropProps) {
91
- return (
92
- <CustomBackdrop
93
- {...backdropProps}
94
- enableDismissOnPressBackdrop={enableDismissOnPressBackdrop}
95
- sheetRef={sheetRef}
96
- />
97
- );
98
- }
99
-
100
- return (
101
- <BottomSheetModal
102
- ref={sheetRef}
103
- backdropComponent={renderBackdrop}
104
- backgroundStyle={[tw`bg-gray-50`, backgroundStyle]}
105
- enableDynamicSizing={enableDynamicSizing}
106
- enablePanDownToClose={enablePanDownToClose}
107
- handleComponent={handleComponent}
108
- handleIndicatorStyle={tw`bg-gray-50`}
109
- handleStyle={tw`rounded-tl-xl rounded-tr-xl`}
110
- keyboardBehavior="interactive"
111
- snapPoints={points}
112
- style={[
113
- tw`rounded-md`,
114
- {
115
- elevation: 10,
116
- },
117
- style,
118
- ]}
119
- >
120
- <BottomSheetScrollView contentContainerStyle={contentContainerStyle}>
121
- {children}
122
- </BottomSheetScrollView>
123
- </BottomSheetModal>
124
- );
125
- }
126
-
127
- export function useBottomSheet() {
128
- const sheetRef = useRef<BottomSheetModal>(null);
129
-
130
- const expandSheet = useCallback(() => {
131
- Keyboard.dismiss();
132
- sheetRef.current?.present();
133
- }, []);
134
-
135
- const closeSheet = useCallback(() => {
136
- Keyboard.dismiss();
137
- sheetRef.current?.close();
138
- }, []);
139
-
140
- return {
141
- closeSheet,
142
- expandSheet,
143
- sheetRef,
144
- };
145
- }
@@ -1 +0,0 @@
1
- export * from './bottom-sheet.component';
@@ -1,55 +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 Button(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 ?? <Text style={[tw`font-medium text-white`, textStyle]}>{title}</Text>;
41
-
42
- return (
43
- <TouchableOpacity activeOpacity={activeOpacity} disabled={disabled} style={[style]} {...rest}>
44
- <View
45
- style={[
46
- tw`bg-primary-700 items-center justify-center rounded-xl p-4`,
47
- buttonStyle,
48
- disabledInputStyle(disabled),
49
- ]}
50
- >
51
- {isLoading ? <ActivityIndicator color={colors.white} /> : display}
52
- </View>
53
- </TouchableOpacity>
54
- );
55
- }
@@ -1,2 +0,0 @@
1
- export * from './button.component';
2
- export * from './outlined-button.component';
@@ -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,13 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
-
4
- import { tw } from '../../../tailwind';
5
- import { DefaultComponentProps } from '../../../types';
6
-
7
- type Props = DefaultComponentProps & {};
8
-
9
- export function Divider(props: Props) {
10
- const { style } = props;
11
-
12
- return <View style={[tw`h-[1px] w-full bg-gray-200`, style]}></View>;
13
- }
@@ -1 +0,0 @@
1
- export * from './divider-component';
@@ -1 +0,0 @@
1
- export * from './input-layout.component';
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import { StyleProp, TextStyle, View } from 'react-native';
3
-
4
- import { tw } from '../../../tailwind';
5
- import { DefaultComponentProps } from '../../../types';
6
- import { Text } from '../Text';
7
-
8
- type Props = DefaultComponentProps & {
9
- children: React.ReactNode;
10
- isRequired?: boolean;
11
- label?: string;
12
- textStyle?: StyleProp<TextStyle>;
13
- };
14
-
15
- export function InputLayout(props: Props) {
16
- const { children, error, isRequired, label, style, textStyle } = props;
17
-
18
- return (
19
- <View style={[style]}>
20
- {label && (
21
- <Text style={[tw`mb-2 text-gray-600`, textStyle]}>
22
- {label}
23
- {isRequired && <Text style={tw`text-red-600`}>{isRequired && '*'}</Text>}
24
- </Text>
25
- )}
26
- {children}
27
- {!!error && (
28
- <View style={tw`items-end`}>
29
- <Text style={tw`text-right text-red-500`}>{error}</Text>
30
- </View>
31
- )}
32
- </View>
33
- );
34
- }
@@ -1 +0,0 @@
1
- export * from './list-loading-item.component';
@@ -1,56 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
-
4
- import { tw } from '../../../tailwind';
5
- import { DefaultComponentProps } from '../../../types';
6
- import { Skeleton } from '../Skeleton';
7
-
8
- type Props = DefaultComponentProps & {
9
- isLoading: boolean;
10
- };
11
-
12
- export function ListLoadingItemComponent(props: Props) {
13
- const { isLoading, style } = props;
14
-
15
- return (
16
- <View style={[style]}>
17
- <View style={[tw`gap-2`, style]}>
18
- <Skeleton isLoading={isLoading}>
19
- {isLoading && <View style={tw`h-[100px] w-full`} />}
20
- </Skeleton>
21
- <Skeleton isLoading={isLoading}>
22
- {isLoading && <View style={tw`h-[100px] w-full`} />}
23
- </Skeleton>
24
- <Skeleton isLoading={isLoading}>
25
- {isLoading && <View style={tw`h-[100px] w-full`} />}
26
- </Skeleton>
27
- </View>
28
- </View>
29
- );
30
- }
31
-
32
- export function ListLoadingHorizontalItemComponent(props: Props) {
33
- const { isLoading, style } = props;
34
-
35
- return (
36
- <View style={[style]}>
37
- <View style={[tw`flex-row gap-2`, style]}>
38
- <Skeleton isLoading={isLoading}>
39
- {isLoading && <View style={tw`h-[200px] w-[100px]`} />}
40
- </Skeleton>
41
- <Skeleton isLoading={isLoading}>
42
- {isLoading && <View style={tw`h-[200px] w-[100px]`} />}
43
- </Skeleton>
44
- <Skeleton isLoading={isLoading}>
45
- {isLoading && <View style={tw`h-[200px] w-[100px]`} />}
46
- </Skeleton>
47
- <Skeleton isLoading={isLoading}>
48
- {isLoading && <View style={tw`h-[200px] w-[100px]`} />}
49
- </Skeleton>
50
- <Skeleton isLoading={isLoading}>
51
- {isLoading && <View style={tw`h-[200px] w-[100px]`} />}
52
- </Skeleton>
53
- </View>
54
- </View>
55
- );
56
- }
@@ -1 +0,0 @@
1
- export * from './modal.component';