nx-react-native-cli 1.0.7 → 1.0.8
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.
- package/README.md +1 -1
- package/contents/.eslintrc.json +293 -0
- package/contents/.husky/pre-commit +5 -0
- package/contents/.husky/pre-push +15 -0
- package/contents/.nvmrc +1 -0
- package/contents/.prettierignore +8 -0
- package/contents/.prettierrc +13 -0
- package/contents/.ruby-version +1 -0
- package/contents/.vscode/extensions.json +10 -0
- package/contents/.vscode/settings.json +18 -0
- package/contents/apps/mobile/.env.template +3 -0
- package/contents/apps/mobile/.eslintrc.json +34 -0
- package/contents/apps/mobile/Gemfile +11 -0
- package/contents/apps/mobile/android/app/build.gradle +164 -0
- package/contents/apps/mobile/android/app/src/dev/res/values/strings.xml +3 -0
- package/contents/apps/mobile/android/app/src/production/res/values/strings.xml +3 -0
- package/contents/apps/mobile/android/build.gradle +34 -0
- package/contents/apps/mobile/babel.config.json +14 -0
- package/contents/apps/mobile/fastlane/.env.template +24 -0
- package/contents/apps/mobile/fastlane/Fastfile +303 -0
- package/contents/apps/mobile/fastlane/Matchfile +5 -0
- package/contents/apps/mobile/fastlane/Pluginfile +6 -0
- package/contents/apps/mobile/fastlane/README.md +65 -0
- package/contents/apps/mobile/package.json +77 -0
- package/contents/apps/mobile/project.json +102 -0
- package/contents/apps/mobile/src/app/index.tsx +68 -0
- package/contents/apps/mobile/src/components/atoms/BottomSheet/bottom-sheet.component.tsx +145 -0
- package/contents/apps/mobile/src/components/atoms/BottomSheet/index.ts +1 -0
- package/contents/apps/mobile/src/components/atoms/Button/button.component.tsx +55 -0
- package/contents/apps/mobile/src/components/atoms/Button/index.ts +2 -0
- package/contents/apps/mobile/src/components/atoms/Button/outlined-button.component.tsx +59 -0
- package/contents/apps/mobile/src/components/atoms/Divider/divider-component.tsx +13 -0
- package/contents/apps/mobile/src/components/atoms/Divider/index.ts +1 -0
- package/contents/apps/mobile/src/components/atoms/InputLayout/index.ts +1 -0
- package/contents/apps/mobile/src/components/atoms/InputLayout/input-layout.component.tsx +34 -0
- package/contents/apps/mobile/src/components/atoms/ListLoadingItem/index.ts +1 -0
- package/contents/apps/mobile/src/components/atoms/ListLoadingItem/list-loading-item.component.tsx +56 -0
- package/contents/apps/mobile/src/components/atoms/Modal/index.ts +1 -0
- package/contents/apps/mobile/src/components/atoms/Modal/modal.component.tsx +58 -0
- package/contents/apps/mobile/src/components/atoms/ScreenLoader/index.ts +1 -0
- package/contents/apps/mobile/src/components/atoms/ScreenLoader/screen-loader.component.tsx +17 -0
- package/contents/apps/mobile/src/components/atoms/Skeleton/index.ts +1 -0
- package/contents/apps/mobile/src/components/atoms/Skeleton/skeleton.component.tsx +42 -0
- package/contents/apps/mobile/src/components/atoms/Text/index.ts +1 -0
- package/contents/apps/mobile/src/components/atoms/Text/text.component.tsx +23 -0
- package/contents/apps/mobile/src/components/atoms/TextInput/constants.ts +43 -0
- package/contents/apps/mobile/src/components/atoms/TextInput/index.ts +2 -0
- package/contents/apps/mobile/src/components/atoms/TextInput/text-input.component.tsx +137 -0
- package/contents/apps/mobile/src/components/atoms/index.ts +10 -0
- package/contents/apps/mobile/src/components/index.ts +3 -0
- package/contents/apps/mobile/src/components/molecules/BackButton/back-button.component.tsx +58 -0
- package/contents/apps/mobile/src/components/molecules/BackButton/index.ts +1 -0
- package/contents/apps/mobile/src/components/molecules/BottomActionsContainer/BottomActionsContainer.component.tsx +28 -0
- package/contents/apps/mobile/src/components/molecules/BottomActionsContainer/index.ts +1 -0
- package/contents/apps/mobile/src/components/molecules/ScreenContainer/index.ts +1 -0
- package/contents/apps/mobile/src/components/molecules/ScreenContainer/screen-container.component.tsx +100 -0
- package/contents/apps/mobile/src/components/molecules/ScreenHeader/index.ts +1 -0
- package/contents/apps/mobile/src/components/molecules/ScreenHeader/screen-header.component.tsx +71 -0
- package/contents/apps/mobile/src/components/molecules/StorageManager/StorageManager.component.tsx +18 -0
- package/contents/apps/mobile/src/components/molecules/StorageManager/index.ts +1 -0
- package/contents/apps/mobile/src/components/molecules/index.ts +5 -0
- package/contents/apps/mobile/src/components/organisms/index.ts +1 -0
- package/contents/apps/mobile/src/config/index.ts +13 -0
- package/contents/apps/mobile/src/dimens/index.ts +1 -0
- package/contents/apps/mobile/src/env.d.ts +17 -0
- package/contents/apps/mobile/src/hooks/index.ts +9 -0
- package/contents/apps/mobile/src/hooks/useAppState.hook.tsx +20 -0
- package/contents/apps/mobile/src/hooks/useApplicationDimensions.hook.tsx +10 -0
- package/contents/apps/mobile/src/hooks/useDebounce.hook.ts +11 -0
- package/contents/apps/mobile/src/hooks/useGetLayoutHeight.hook.tsx +27 -0
- package/contents/apps/mobile/src/hooks/useGetLayoutWidth.hook.tsx +27 -0
- package/contents/apps/mobile/src/hooks/useNavigation.hook.tsx +8 -0
- package/contents/apps/mobile/src/hooks/useShakeAnimation.hook.tsx +32 -0
- package/contents/apps/mobile/src/hooks/useTextInputChangeFocus.hook.tsx +12 -0
- package/contents/apps/mobile/src/hooks/useThrottle.hook.ts +11 -0
- package/contents/apps/mobile/src/icons/arrow-left.svg +3 -0
- package/contents/apps/mobile/src/icons/checkbox-active.svg +4 -0
- package/contents/apps/mobile/src/icons/checkbox-unactive.svg +4 -0
- package/contents/apps/mobile/src/icons/close.svg +3 -0
- package/contents/apps/mobile/src/icons/download.svg +4 -0
- package/contents/apps/mobile/src/icons/email.svg +10 -0
- package/contents/apps/mobile/src/icons/eye-slash.svg +11 -0
- package/contents/apps/mobile/src/icons/eye.svg +4 -0
- package/contents/apps/mobile/src/icons/gear.svg +4 -0
- package/contents/apps/mobile/src/icons/home.svg +3 -0
- package/contents/apps/mobile/src/icons/index.ts +33 -0
- package/contents/apps/mobile/src/icons/pencil.svg +3 -0
- package/contents/apps/mobile/src/icons/phone.svg +3 -0
- package/contents/apps/mobile/src/icons/user-circle.svg +3 -0
- package/contents/apps/mobile/src/icons/user.svg +4 -0
- package/contents/apps/mobile/src/icons/warning.svg +3 -0
- package/contents/apps/mobile/src/main.tsx +5 -0
- package/contents/apps/mobile/src/routes/index.tsx +65 -0
- package/contents/apps/mobile/src/routes/privateRoutes.tsx +32 -0
- package/contents/apps/mobile/src/routes/publicRoutes.tsx +26 -0
- package/contents/apps/mobile/src/routes/routes.enum.ts +5 -0
- package/contents/apps/mobile/src/routes/screen-options.ts +9 -0
- package/contents/apps/mobile/src/routes/screens.enum.ts +4 -0
- package/contents/apps/mobile/src/screens/HomeScreen/home.screen.tsx +12 -0
- package/contents/apps/mobile/src/screens/LoginScreen/login.screen.tsx +13 -0
- package/contents/apps/mobile/src/stores/index.ts +1 -0
- package/contents/apps/mobile/src/stores/local-storage.store.ts +60 -0
- package/contents/apps/mobile/src/stores/mmkvStorage.ts +19 -0
- package/contents/apps/mobile/src/tailwind/index.ts +24 -0
- package/contents/apps/mobile/src/types/component.type.ts +13 -0
- package/contents/apps/mobile/src/types/index.ts +1 -0
- package/contents/apps/mobile/tailwind.config.js +80 -0
- package/contents/apps/mobile/tsconfig.app.json +11 -0
- package/contents/check-env.sh +44 -0
- package/contents/clean-generated-outputs.sh +32 -0
- package/lib/index.cjs +39 -39
- package/package.json +3 -2
- package/lib/index.js +0 -75
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './bottom-sheet.component';
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './divider-component';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './input-layout.component';
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './list-loading-item.component';
|
package/contents/apps/mobile/src/components/atoms/ListLoadingItem/list-loading-item.component.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modal.component';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* eslint-disable no-magic-numbers */
|
|
2
|
+
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
3
|
+
import React, { ReactNode, useCallback, useState } from 'react';
|
|
4
|
+
import { Keyboard, ModalBaseProps, StyleProp, View, ViewStyle } from 'react-native';
|
|
5
|
+
import RNModal from 'react-native-modal';
|
|
6
|
+
|
|
7
|
+
import { tw } from '../../../tailwind';
|
|
8
|
+
import { DefaultComponentProps } from '../../../types';
|
|
9
|
+
|
|
10
|
+
export type ModalProps = DefaultComponentProps &
|
|
11
|
+
ModalBaseProps & {
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
14
|
+
isVisible: boolean;
|
|
15
|
+
onBackdropPress?: () => void;
|
|
16
|
+
onBackButtonPress?: () => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const backdropColor = 'rgba(0, 0, 0, 0.6)';
|
|
20
|
+
|
|
21
|
+
export function Modal(props: ModalProps) {
|
|
22
|
+
const { children, containerStyle, isVisible, onBackButtonPress, onBackdropPress, style } = props;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<RNModal
|
|
26
|
+
backdropColor={backdropColor}
|
|
27
|
+
backdropTransitionOutTiming={0}
|
|
28
|
+
isVisible={isVisible}
|
|
29
|
+
style={[tw`m-0 w-full`, style]}
|
|
30
|
+
onBackButtonPress={onBackButtonPress}
|
|
31
|
+
onBackdropPress={onBackdropPress}
|
|
32
|
+
>
|
|
33
|
+
<BottomSheetModalProvider>
|
|
34
|
+
<View style={[tw`px-4`, containerStyle]}>{children}</View>
|
|
35
|
+
</BottomSheetModalProvider>
|
|
36
|
+
</RNModal>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function useModal() {
|
|
41
|
+
const [isVisible, setVisible] = useState<boolean>(false);
|
|
42
|
+
|
|
43
|
+
const showModal = useCallback(() => {
|
|
44
|
+
Keyboard.dismiss();
|
|
45
|
+
setVisible(true);
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
const hideModal = useCallback(() => {
|
|
49
|
+
Keyboard.dismiss();
|
|
50
|
+
setVisible(false);
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
hideModal,
|
|
55
|
+
isVisible,
|
|
56
|
+
showModal,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './screen-loader.component';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { colors, tw } from '../../../tailwind';
|
|
5
|
+
import { DefaultComponentProps } from '../../../types/component.type';
|
|
6
|
+
|
|
7
|
+
type Props = DefaultComponentProps;
|
|
8
|
+
|
|
9
|
+
export function ScreenLoader(props: Props): JSX.Element {
|
|
10
|
+
const { style } = props;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<View style={[tw`h-full w-full items-center justify-center bg-gray-50 p-8`, style]}>
|
|
14
|
+
<ActivityIndicator color={colors.primary[400]} />
|
|
15
|
+
</View>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './skeleton.component';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import Animated, {
|
|
4
|
+
useAnimatedStyle,
|
|
5
|
+
useSharedValue,
|
|
6
|
+
withRepeat,
|
|
7
|
+
withTiming,
|
|
8
|
+
} from 'react-native-reanimated';
|
|
9
|
+
|
|
10
|
+
import { tw } from '../../../tailwind';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function Skeleton(props: Props) {
|
|
18
|
+
const { children, isLoading } = props;
|
|
19
|
+
const opacity = useSharedValue(1);
|
|
20
|
+
|
|
21
|
+
const animatedStyle = useAnimatedStyle(
|
|
22
|
+
() => ({
|
|
23
|
+
opacity: withRepeat(withTiming(opacity.value, { duration: 500 }), -1, true),
|
|
24
|
+
}),
|
|
25
|
+
[],
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
opacity.value = 0.5; // Start the animation
|
|
30
|
+
}, []);
|
|
31
|
+
|
|
32
|
+
if (!isLoading) {
|
|
33
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
34
|
+
return <>{children}</>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Animated.View style={[tw`rounded-lg bg-gray-200`, animatedStyle]}>
|
|
39
|
+
<View style={tw`opacity-0`}>{children}</View>
|
|
40
|
+
</Animated.View>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './text.component';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text as RNText, TextProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { tw } from '../../../tailwind';
|
|
5
|
+
|
|
6
|
+
type Props = TextProps & {
|
|
7
|
+
numberOfLines?: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function Text(props: Props): JSX.Element {
|
|
11
|
+
const { numberOfLines = 0, style, ...extraProps } = props;
|
|
12
|
+
|
|
13
|
+
const shouldTruncateTextProps: TextProps =
|
|
14
|
+
numberOfLines > 0 ? { ellipsizeMode: 'tail', numberOfLines } : {};
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<RNText
|
|
18
|
+
{...shouldTruncateTextProps}
|
|
19
|
+
style={[tw`text-black-950 font-sans text-base font-normal`, style]}
|
|
20
|
+
{...extraProps}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TextInputProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const DefaultPhonePadInputProps: TextInputProps = {
|
|
4
|
+
autoCapitalize: 'none',
|
|
5
|
+
autoCorrect: false,
|
|
6
|
+
keyboardType: 'phone-pad',
|
|
7
|
+
numberOfLines: 1,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const DefaultNumberPadInputProps: TextInputProps = {
|
|
11
|
+
autoCapitalize: 'none',
|
|
12
|
+
autoCorrect: false,
|
|
13
|
+
keyboardType: 'number-pad',
|
|
14
|
+
numberOfLines: 1,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const DefaultNumericInputProps: TextInputProps = {
|
|
18
|
+
autoCapitalize: 'none',
|
|
19
|
+
autoCorrect: false,
|
|
20
|
+
keyboardType: 'numeric',
|
|
21
|
+
numberOfLines: 1,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const DefaultNameInputProps: TextInputProps = {
|
|
25
|
+
autoCapitalize: 'words',
|
|
26
|
+
autoCorrect: false,
|
|
27
|
+
keyboardType: 'default',
|
|
28
|
+
numberOfLines: 1,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const DefaultEmailInputProps: TextInputProps = {
|
|
32
|
+
autoCapitalize: 'none',
|
|
33
|
+
autoCorrect: false,
|
|
34
|
+
keyboardType: 'email-address',
|
|
35
|
+
numberOfLines: 1,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const DefaultTextAreaInputProps: TextInputProps = {
|
|
39
|
+
autoCapitalize: 'sentences',
|
|
40
|
+
autoCorrect: false,
|
|
41
|
+
keyboardType: 'default',
|
|
42
|
+
numberOfLines: 3,
|
|
43
|
+
};
|