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.
- package/lib/index.cjs +32 -32
- package/package.json +5 -1
- package/templates/.eslintrc.json +1 -0
- package/templates/.nvmrc +1 -1
- package/templates/apps/mobile/android/app/build.gradle +12 -24
- package/templates/apps/mobile/android/app/proguard-rules.pro +20 -0
- package/templates/apps/mobile/android/build.gradle +6 -19
- package/templates/apps/mobile/babel.config.json +2 -1
- package/templates/apps/mobile/export-node-binary.sh +6 -0
- package/templates/apps/mobile/jest.config.ts +12 -0
- package/templates/apps/mobile/package.json +6 -1
- package/templates/apps/mobile/project.json +3 -2
- package/templates/apps/mobile/react-native.config.js +7 -0
- package/templates/apps/mobile/src/app/index.tsx +7 -1
- package/templates/apps/mobile/src/assets/fonts/InterBlack.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterBlackItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterExtraBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterExtraBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterExtraLight.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterExtraLightItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterLight.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterLightItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterMedium.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterMediumItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterRegular.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterSemiBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterSemiBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterThin.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/InterThinItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratBlack.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratBlackItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratExtraBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratExtraBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratExtraLight.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratExtraLightItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratLight.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratLightItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratMedium.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratMediumItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratRegular.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratSemiBold.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratSemiBoldItalic.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratThin.ttf +0 -0
- package/templates/apps/mobile/src/assets/fonts/MontserratThinItalic.ttf +0 -0
- package/templates/apps/mobile/src/components/atoms/BottomSheet/bottom-sheet.component.tsx +9 -7
- package/templates/apps/mobile/src/components/atoms/Box/box.component.tsx +21 -0
- package/templates/apps/mobile/src/components/atoms/Box/index.ts +1 -0
- package/templates/apps/mobile/src/components/atoms/Button/button.component.tsx +24 -8
- package/templates/apps/mobile/src/components/atoms/Button/index.ts +0 -1
- package/templates/apps/mobile/src/components/atoms/Divider/divider-component.tsx +2 -2
- package/templates/apps/mobile/src/components/atoms/InputLayout/input-layout.component.tsx +12 -11
- package/templates/apps/mobile/src/components/atoms/ListLoadingItem/list-loading-item.component.tsx +17 -17
- package/templates/apps/mobile/src/components/atoms/Modal/modal.component.tsx +5 -4
- package/templates/apps/mobile/src/components/atoms/ScreenLoader/screen-loader.component.tsx +5 -4
- package/templates/apps/mobile/src/components/atoms/Skeleton/skeleton.component.tsx +2 -2
- package/templates/apps/mobile/src/components/atoms/TextInput/text-input.component.tsx +5 -5
- package/templates/apps/mobile/src/components/atoms/Typography/index.ts +1 -0
- package/templates/apps/mobile/src/components/atoms/{Text/text.component.tsx → Typography/typography.component.tsx} +1 -1
- package/templates/apps/mobile/src/components/atoms/index.ts +2 -1
- package/templates/apps/mobile/src/components/molecules/BackButton/back-button.component.tsx +4 -4
- package/templates/apps/mobile/src/components/molecules/BottomActionsContainer/BottomActionsContainer.component.tsx +1 -4
- package/templates/apps/mobile/src/components/molecules/ScreenContainer/screen-container.component.tsx +11 -9
- package/templates/apps/mobile/src/components/molecules/ScreenHeader/screen-header.component.tsx +13 -19
- package/templates/apps/mobile/src/components/molecules/StorageManager/StorageManager.component.tsx +1 -3
- package/templates/apps/mobile/src/hooks/index.ts +2 -1
- package/templates/apps/mobile/src/hooks/useToggleDarkMode.hook.tsx +9 -0
- package/templates/apps/mobile/src/routes/index.tsx +3 -3
- package/templates/apps/mobile/src/routes/privateRoutes.tsx +10 -7
- package/templates/apps/mobile/src/routes/publicRoutes.tsx +12 -9
- package/templates/apps/mobile/src/routes/screen-options.ts +1 -6
- package/templates/apps/mobile/src/routes/screens.enum.ts +1 -1
- package/templates/apps/mobile/src/screens/HomeScreen/home.screen.tsx +2 -2
- package/templates/apps/mobile/src/screens/LandingScreen/landing.screen.tsx +37 -0
- package/templates/apps/mobile/src/types/component.type.ts +1 -6
- package/templates/apps/mobile/src/utils/axios.util.ts +10 -0
- package/templates/apps/mobile/src/utils/index.ts +4 -0
- package/templates/apps/mobile/src/utils/log.util.ts +40 -0
- package/templates/apps/mobile/src/utils/route.util.ts +48 -0
- package/templates/apps/mobile/test-setup.ts +1 -0
- package/templates/apps/mobile/tsconfig.spec.json +20 -0
- package/templates/apps/mobile/src/components/atoms/Button/outlined-button.component.tsx +0 -59
- package/templates/apps/mobile/src/components/atoms/Text/index.ts +0 -1
- package/templates/apps/mobile/src/screens/LoginScreen/login.screen.tsx +0 -13
package/templates/apps/mobile/src/components/atoms/ListLoadingItem/list-loading-item.component.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
2
|
|
|
4
3
|
import { tw } from '../../../tailwind';
|
|
5
4
|
import { DefaultComponentProps } from '../../../types';
|
|
5
|
+
import { Box } from '../Box';
|
|
6
6
|
import { Skeleton } from '../Skeleton';
|
|
7
7
|
|
|
8
8
|
type Props = DefaultComponentProps & {
|
|
@@ -13,19 +13,19 @@ export function ListLoadingItemComponent(props: Props) {
|
|
|
13
13
|
const { isLoading, style } = props;
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
17
|
-
<
|
|
16
|
+
<Box style={[style]}>
|
|
17
|
+
<Box style={[tw`gap-2`, style]}>
|
|
18
18
|
<Skeleton isLoading={isLoading}>
|
|
19
|
-
{isLoading && <
|
|
19
|
+
{isLoading && <Box style={tw`h-[100px] w-full`} />}
|
|
20
20
|
</Skeleton>
|
|
21
21
|
<Skeleton isLoading={isLoading}>
|
|
22
|
-
{isLoading && <
|
|
22
|
+
{isLoading && <Box style={tw`h-[100px] w-full`} />}
|
|
23
23
|
</Skeleton>
|
|
24
24
|
<Skeleton isLoading={isLoading}>
|
|
25
|
-
{isLoading && <
|
|
25
|
+
{isLoading && <Box style={tw`h-[100px] w-full`} />}
|
|
26
26
|
</Skeleton>
|
|
27
|
-
</
|
|
28
|
-
</
|
|
27
|
+
</Box>
|
|
28
|
+
</Box>
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -33,24 +33,24 @@ export function ListLoadingHorizontalItemComponent(props: Props) {
|
|
|
33
33
|
const { isLoading, style } = props;
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<
|
|
37
|
-
<
|
|
36
|
+
<Box style={[style]}>
|
|
37
|
+
<Box style={[tw`flex-row gap-2`, style]}>
|
|
38
38
|
<Skeleton isLoading={isLoading}>
|
|
39
|
-
{isLoading && <
|
|
39
|
+
{isLoading && <Box style={tw`h-[200px] w-[100px]`} />}
|
|
40
40
|
</Skeleton>
|
|
41
41
|
<Skeleton isLoading={isLoading}>
|
|
42
|
-
{isLoading && <
|
|
42
|
+
{isLoading && <Box style={tw`h-[200px] w-[100px]`} />}
|
|
43
43
|
</Skeleton>
|
|
44
44
|
<Skeleton isLoading={isLoading}>
|
|
45
|
-
{isLoading && <
|
|
45
|
+
{isLoading && <Box style={tw`h-[200px] w-[100px]`} />}
|
|
46
46
|
</Skeleton>
|
|
47
47
|
<Skeleton isLoading={isLoading}>
|
|
48
|
-
{isLoading && <
|
|
48
|
+
{isLoading && <Box style={tw`h-[200px] w-[100px]`} />}
|
|
49
49
|
</Skeleton>
|
|
50
50
|
<Skeleton isLoading={isLoading}>
|
|
51
|
-
{isLoading && <
|
|
51
|
+
{isLoading && <Box style={tw`h-[200px] w-[100px]`} />}
|
|
52
52
|
</Skeleton>
|
|
53
|
-
</
|
|
54
|
-
</
|
|
53
|
+
</Box>
|
|
54
|
+
</Box>
|
|
55
55
|
);
|
|
56
56
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-magic-numbers */
|
|
2
2
|
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
3
|
-
import React, {
|
|
4
|
-
import { Keyboard, ModalBaseProps, StyleProp,
|
|
3
|
+
import React, { useCallback, useState } from 'react';
|
|
4
|
+
import { Keyboard, ModalBaseProps, StyleProp, ViewStyle } from 'react-native';
|
|
5
5
|
import RNModal from 'react-native-modal';
|
|
6
6
|
|
|
7
7
|
import { tw } from '../../../tailwind';
|
|
8
8
|
import { DefaultComponentProps } from '../../../types';
|
|
9
|
+
import { Box } from '../Box';
|
|
9
10
|
|
|
10
11
|
export type ModalProps = DefaultComponentProps &
|
|
11
12
|
ModalBaseProps & {
|
|
12
|
-
children?: ReactNode;
|
|
13
|
+
children?: React.ReactNode;
|
|
13
14
|
containerStyle?: StyleProp<ViewStyle>;
|
|
14
15
|
isVisible: boolean;
|
|
15
16
|
onBackdropPress?: () => void;
|
|
@@ -31,7 +32,7 @@ export function Modal(props: ModalProps) {
|
|
|
31
32
|
onBackdropPress={onBackdropPress}
|
|
32
33
|
>
|
|
33
34
|
<BottomSheetModalProvider>
|
|
34
|
-
<
|
|
35
|
+
<Box style={[tw`px-4`, containerStyle]}>{children}</Box>
|
|
35
36
|
</BottomSheetModalProvider>
|
|
36
37
|
</RNModal>
|
|
37
38
|
);
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ActivityIndicator
|
|
2
|
+
import { ActivityIndicator } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { colors, tw } from '../../../tailwind';
|
|
5
5
|
import { DefaultComponentProps } from '../../../types/component.type';
|
|
6
|
+
import { Box } from '../Box';
|
|
6
7
|
|
|
7
8
|
type Props = DefaultComponentProps;
|
|
8
9
|
|
|
9
|
-
export function ScreenLoader(props: Props)
|
|
10
|
+
export function ScreenLoader(props: Props) {
|
|
10
11
|
const { style } = props;
|
|
11
12
|
|
|
12
13
|
return (
|
|
13
|
-
<
|
|
14
|
+
<Box style={[tw`h-full w-full items-center justify-center bg-gray-50 p-8`, style]}>
|
|
14
15
|
<ActivityIndicator color={colors.primary[400]} />
|
|
15
|
-
</
|
|
16
|
+
</Box>
|
|
16
17
|
);
|
|
17
18
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
2
|
import Animated, {
|
|
4
3
|
useAnimatedStyle,
|
|
5
4
|
useSharedValue,
|
|
@@ -8,6 +7,7 @@ import Animated, {
|
|
|
8
7
|
} from 'react-native-reanimated';
|
|
9
8
|
|
|
10
9
|
import { tw } from '../../../tailwind';
|
|
10
|
+
import { Box } from '../Box';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
children: React.ReactNode;
|
|
@@ -36,7 +36,7 @@ export function Skeleton(props: Props) {
|
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<Animated.View style={[tw`rounded-lg bg-gray-200`, animatedStyle]}>
|
|
39
|
-
<
|
|
39
|
+
<Box style={tw`opacity-0`}>{children}</Box>
|
|
40
40
|
</Animated.View>
|
|
41
41
|
);
|
|
42
42
|
}
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
TextInputProps as RNTextInputProps,
|
|
5
5
|
StyleProp,
|
|
6
6
|
TextStyle,
|
|
7
|
-
View,
|
|
8
7
|
} from 'react-native';
|
|
9
8
|
|
|
10
9
|
import {
|
|
@@ -14,7 +13,8 @@ import {
|
|
|
14
13
|
disabledInputStyle,
|
|
15
14
|
focusedInputStyle,
|
|
16
15
|
} from '../../../tailwind';
|
|
17
|
-
import {
|
|
16
|
+
import { DefaultComponentProps } from '../../../types';
|
|
17
|
+
import { Box } from '../Box';
|
|
18
18
|
|
|
19
19
|
import { DefaultNameInputProps, DefaultTextAreaInputProps } from './constants';
|
|
20
20
|
|
|
@@ -29,7 +29,7 @@ export function getTextInputHeightAdjustment(numberOfNewLines: number) {
|
|
|
29
29
|
return TEXT_INPUT_MIN_HEIGHT + (numberOfNewLines - 2) * TEXT_INPUT_LINE_HEIGHT;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export type TextInputProps =
|
|
32
|
+
export type TextInputProps = DefaultComponentProps &
|
|
33
33
|
RNTextInputProps & {
|
|
34
34
|
textInputRef?: React.RefObject<RNTextInput>;
|
|
35
35
|
textStyle?: StyleProp<TextStyle>;
|
|
@@ -62,7 +62,7 @@ export function TextInput(props: TextInputProps) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
return (
|
|
65
|
-
<
|
|
65
|
+
<Box
|
|
66
66
|
style={[
|
|
67
67
|
defaultInputContainerStyle,
|
|
68
68
|
focusedInputStyle(isFocused),
|
|
@@ -85,7 +85,7 @@ export function TextInput(props: TextInputProps) {
|
|
|
85
85
|
onFocus={handleOnFocus}
|
|
86
86
|
{...extraProps}
|
|
87
87
|
/>
|
|
88
|
-
</
|
|
88
|
+
</Box>
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './typography.component';
|
|
@@ -7,7 +7,7 @@ type Props = TextProps & {
|
|
|
7
7
|
numberOfLines?: number;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export function
|
|
10
|
+
export function Typography(props: Props): JSX.Element {
|
|
11
11
|
const { numberOfLines = 0, style, ...extraProps } = props;
|
|
12
12
|
|
|
13
13
|
const shouldTruncateTextProps: TextProps =
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './BottomSheet';
|
|
2
|
+
export * from './Box';
|
|
2
3
|
export * from './Button';
|
|
3
4
|
export * from './Divider';
|
|
4
5
|
export * from './InputLayout';
|
|
@@ -6,5 +7,5 @@ export * from './ListLoadingItem';
|
|
|
6
7
|
export * from './Modal';
|
|
7
8
|
export * from './ScreenLoader';
|
|
8
9
|
export * from './Skeleton';
|
|
9
|
-
export * from './Text';
|
|
10
10
|
export * from './TextInput';
|
|
11
|
+
export * from './Typography';
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
PressableProps,
|
|
7
7
|
StyleProp,
|
|
8
8
|
TouchableOpacity,
|
|
9
|
-
View,
|
|
10
9
|
ViewStyle,
|
|
11
10
|
} from 'react-native';
|
|
12
11
|
|
|
@@ -15,6 +14,7 @@ import { ArrowLeftIcon } from '../../../icons';
|
|
|
15
14
|
import { Screens } from '../../../routes';
|
|
16
15
|
import { tw } from '../../../tailwind';
|
|
17
16
|
import { DefaultComponentProps } from '../../../types/component.type';
|
|
17
|
+
import { Box } from '../../atoms';
|
|
18
18
|
|
|
19
19
|
type Props = DefaultComponentProps &
|
|
20
20
|
PressableProps & {
|
|
@@ -24,7 +24,7 @@ type Props = DefaultComponentProps &
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const ACTIVE_OPACITY = 0.5;
|
|
27
|
-
export function BackButton(props: Props)
|
|
27
|
+
export function BackButton(props: Props) {
|
|
28
28
|
const { fallbackRoute, onPress, style } = props;
|
|
29
29
|
const navigation = useNavigation<ParamListBase>();
|
|
30
30
|
|
|
@@ -50,9 +50,9 @@ export function BackButton(props: Props): JSX.Element {
|
|
|
50
50
|
style={[tw`h-[48px] w-[48px]`, style]}
|
|
51
51
|
onPress={handleOnPress}
|
|
52
52
|
>
|
|
53
|
-
<
|
|
53
|
+
<Box style={[tw`flex-1 items-center justify-center rounded-full`, style]}>
|
|
54
54
|
<ArrowLeftIcon style={tw`text-gray-950`} />
|
|
55
|
-
</
|
|
55
|
+
</Box>
|
|
56
56
|
</TouchableOpacity>
|
|
57
57
|
);
|
|
58
58
|
}
|
|
@@ -16,10 +16,7 @@ export function BottomActionsContainer(props: Props) {
|
|
|
16
16
|
return (
|
|
17
17
|
<SafeAreaView
|
|
18
18
|
edges={['left', 'right', 'bottom']}
|
|
19
|
-
style={[
|
|
20
|
-
tw`border-geyser-200 absolute bottom-0 left-0 right-0 flex flex-col gap-y-2 border-b-0 border-t bg-gray-50 p-4`,
|
|
21
|
-
style,
|
|
22
|
-
]}
|
|
19
|
+
style={[tw`absolute bottom-0 left-0 right-0`, style]}
|
|
23
20
|
{...rest}
|
|
24
21
|
>
|
|
25
22
|
{children}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
Platform,
|
|
7
7
|
StatusBar,
|
|
8
8
|
StyleProp,
|
|
9
|
-
View,
|
|
10
9
|
ViewStyle,
|
|
11
10
|
} from 'react-native';
|
|
12
11
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
@@ -15,8 +14,10 @@ import { Edge, SafeAreaProviderProps, SafeAreaView } from 'react-native-safe-are
|
|
|
15
14
|
|
|
16
15
|
import CONFIG from '../../../config';
|
|
17
16
|
import { tw } from '../../../tailwind';
|
|
17
|
+
import { Box } from '../../atoms';
|
|
18
18
|
|
|
19
19
|
type Props = SafeAreaProviderProps & {
|
|
20
|
+
scrollViewRef?: React.RefObject<KeyboardAwareScrollView>;
|
|
20
21
|
containerStyle?: StyleProp<ViewStyle>;
|
|
21
22
|
excludedEdges?: Edge[];
|
|
22
23
|
extraBottomPadding?: number;
|
|
@@ -28,21 +29,20 @@ type Props = SafeAreaProviderProps & {
|
|
|
28
29
|
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
const defaultStyle = tw
|
|
32
|
-
paddingTop: StatusBar.currentHeight ? StatusBar.currentHeight - 1 : 0,
|
|
33
|
-
});
|
|
32
|
+
const defaultStyle = tw`grow`;
|
|
34
33
|
|
|
35
34
|
const safeAreaViewEdges: Edge[] = Platform.select({
|
|
36
|
-
android: ['left', 'right', 'bottom'],
|
|
35
|
+
android: ['top', 'left', 'right', 'bottom'],
|
|
37
36
|
default: [],
|
|
38
|
-
ios: ['
|
|
37
|
+
ios: ['top', 'left', 'right', 'bottom'],
|
|
39
38
|
});
|
|
40
39
|
|
|
41
40
|
const AnimatedKeyboardAwareScrollView = Animated.createAnimatedComponent(KeyboardAwareScrollView);
|
|
42
41
|
|
|
43
|
-
export function ScreenContainer(props: Props)
|
|
42
|
+
export function ScreenContainer(props: Props) {
|
|
44
43
|
const {
|
|
45
44
|
children,
|
|
45
|
+
scrollViewRef,
|
|
46
46
|
containerStyle,
|
|
47
47
|
excludedEdges = [],
|
|
48
48
|
extraBottomPadding = 0,
|
|
@@ -81,10 +81,12 @@ export function ScreenContainer(props: Props): JSX.Element {
|
|
|
81
81
|
];
|
|
82
82
|
|
|
83
83
|
return (
|
|
84
|
-
<SafeAreaView edges={edges} style={[tw`flex-1 bg-gray-50`, style]}>
|
|
84
|
+
<SafeAreaView edges={edges} style={[tw`flex-1 bg-gray-50 dark:bg-gray-900`, style]}>
|
|
85
85
|
{hasScroll ? (
|
|
86
86
|
<AnimatedKeyboardAwareScrollView
|
|
87
|
+
scrollViewRef={scrollViewRef}
|
|
87
88
|
contentContainerStyle={defaultContainerStyle}
|
|
89
|
+
enableResetScrollToCoords={false}
|
|
88
90
|
keyboardShouldPersistTaps="handled"
|
|
89
91
|
refreshControl={refreshControl}
|
|
90
92
|
scrollEventThrottle={16}
|
|
@@ -93,7 +95,7 @@ export function ScreenContainer(props: Props): JSX.Element {
|
|
|
93
95
|
{children}
|
|
94
96
|
</AnimatedKeyboardAwareScrollView>
|
|
95
97
|
) : (
|
|
96
|
-
<
|
|
98
|
+
<Box style={defaultContainerStyle}>{children}</Box>
|
|
97
99
|
)}
|
|
98
100
|
</SafeAreaView>
|
|
99
101
|
);
|
package/templates/apps/mobile/src/components/molecules/ScreenHeader/screen-header.component.tsx
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { StyleProp, TouchableOpacity,
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, TouchableOpacity, ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { GearIcon } from '../../../icons';
|
|
5
5
|
import { tw } from '../../../tailwind';
|
|
6
6
|
import { DefaultComponentProps } from '../../../types/component.type';
|
|
7
|
-
import {
|
|
7
|
+
import { Box } from '../../atoms';
|
|
8
|
+
import { Typography } from '../../atoms/Typography';
|
|
8
9
|
import { BackButton } from '../BackButton';
|
|
9
10
|
|
|
10
11
|
type Props = DefaultComponentProps & {
|
|
11
12
|
hasBackButton?: boolean;
|
|
12
|
-
extraActionComponent?: ReactNode;
|
|
13
|
-
shouldShowBorder?: boolean;
|
|
13
|
+
extraActionComponent?: React.ReactNode;
|
|
14
14
|
title: string;
|
|
15
15
|
titleStyle?: StyleProp<ViewStyle>;
|
|
16
16
|
onBackPress?: () => void;
|
|
@@ -24,7 +24,6 @@ export function ScreenHeader(props: Props) {
|
|
|
24
24
|
hasBackButton = true,
|
|
25
25
|
onBackPress,
|
|
26
26
|
onExtraActionPress,
|
|
27
|
-
shouldShowBorder = false,
|
|
28
27
|
style,
|
|
29
28
|
title,
|
|
30
29
|
titleStyle,
|
|
@@ -37,35 +36,30 @@ export function ScreenHeader(props: Props) {
|
|
|
37
36
|
style={tw`z-10 h-[48px] w-[48px]`}
|
|
38
37
|
onPress={onExtraActionPress}
|
|
39
38
|
>
|
|
40
|
-
<
|
|
39
|
+
<Box style={[tw`flex-1 items-center justify-center rounded-full`, style]}>
|
|
41
40
|
{extraActionComponent ? (
|
|
42
41
|
extraActionComponent
|
|
43
42
|
) : (
|
|
44
43
|
<GearIcon height={25} style={tw`text-black-950`} width={25} />
|
|
45
44
|
)}
|
|
46
|
-
</
|
|
45
|
+
</Box>
|
|
47
46
|
</TouchableOpacity>
|
|
48
47
|
);
|
|
49
48
|
|
|
50
49
|
return (
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
style={[
|
|
54
|
-
tw`flex-row items-center justify-between border border-transparent p-4 pt-2`,
|
|
55
|
-
shouldShowBorder && tw`elevation-2 -m-[5px]`,
|
|
56
|
-
]}
|
|
57
|
-
>
|
|
50
|
+
<Box style={[tw`h-[64px] border border-transparent`, style]}>
|
|
51
|
+
<Box style={[tw`flex-row items-center justify-between border border-transparent p-4 pt-2`]}>
|
|
58
52
|
{hasBackButton && <BackButton style={tw`z-10`} onPress={onBackPress} />}
|
|
59
|
-
<
|
|
53
|
+
<Typography
|
|
60
54
|
style={[
|
|
61
55
|
tw`text-primary-700 absolute inset-x-0 top-4 text-center text-xl font-medium`,
|
|
62
56
|
titleStyle,
|
|
63
57
|
]}
|
|
64
58
|
>
|
|
65
59
|
{title}
|
|
66
|
-
</
|
|
60
|
+
</Typography>
|
|
67
61
|
{extraActionComponentDisplay}
|
|
68
|
-
</
|
|
69
|
-
</
|
|
62
|
+
</Box>
|
|
63
|
+
</Box>
|
|
70
64
|
);
|
|
71
65
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './useAppState.hook';
|
|
2
1
|
export * from './useApplicationDimensions.hook';
|
|
2
|
+
export * from './useAppState.hook';
|
|
3
3
|
export * from './useDebounce.hook';
|
|
4
4
|
export * from './useGetLayoutHeight.hook';
|
|
5
5
|
export * from './useGetLayoutWidth.hook';
|
|
@@ -7,3 +7,4 @@ export * from './useNavigation.hook';
|
|
|
7
7
|
export * from './useShakeAnimation.hook';
|
|
8
8
|
export * from './useTextInputChangeFocus.hook';
|
|
9
9
|
export * from './useThrottle.hook';
|
|
10
|
+
export * from './useToggleDarkMode.hook';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DefaultTheme, NavigationContainer, Theme } from '@react-navigation/native';
|
|
2
|
-
import {
|
|
2
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
import { StatusBar } from 'react-native';
|
|
5
5
|
|
|
@@ -11,7 +11,7 @@ import PublicRoutes from './publicRoutes';
|
|
|
11
11
|
import { Routes } from './routes.enum';
|
|
12
12
|
import { screenOptions } from './screen-options';
|
|
13
13
|
|
|
14
|
-
const RootStack =
|
|
14
|
+
const RootStack = createNativeStackNavigator();
|
|
15
15
|
|
|
16
16
|
export const noAnimation = {
|
|
17
17
|
animationEnabled: false,
|
|
@@ -25,7 +25,7 @@ const navigationTheme: Theme = {
|
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export default function ApplicationRoutes()
|
|
28
|
+
export default function ApplicationRoutes() {
|
|
29
29
|
// const { isLoading } = useAuth();
|
|
30
30
|
// const isUserAuthenticated = useLocalStorageState((state) => !!state.accessToken);
|
|
31
31
|
const isUserAuthenticated = false;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
1
2
|
import { MaterialTopTabScreenProps } from '@react-navigation/material-top-tabs';
|
|
2
|
-
import {
|
|
3
|
+
import { createNativeStackNavigator, NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
|
|
5
6
|
import { HomeScreen } from '../screens/HomeScreen/home.screen';
|
|
@@ -7,13 +8,13 @@ import { HomeScreen } from '../screens/HomeScreen/home.screen';
|
|
|
7
8
|
import { screenOptions } from './screen-options';
|
|
8
9
|
import { Screens } from './screens.enum';
|
|
9
10
|
|
|
10
|
-
const PrivateStack =
|
|
11
|
+
const PrivateStack = createNativeStackNavigator<PrivateStackParams>();
|
|
11
12
|
|
|
12
13
|
export type PrivateStackParams = {
|
|
13
14
|
[Screens.HOME]: undefined;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
export type PrivateScreenProps<T extends keyof PrivateStackParams> =
|
|
17
|
+
export type PrivateScreenProps<T extends keyof PrivateStackParams> = NativeStackScreenProps<
|
|
17
18
|
PrivateStackParams,
|
|
18
19
|
T
|
|
19
20
|
>;
|
|
@@ -23,10 +24,12 @@ export type PrivateTabScreenProps<T extends keyof PrivateStackParams> = Material
|
|
|
23
24
|
T
|
|
24
25
|
>;
|
|
25
26
|
|
|
26
|
-
export default function PrivateRoutes()
|
|
27
|
+
export default function PrivateRoutes() {
|
|
27
28
|
return (
|
|
28
|
-
<
|
|
29
|
-
<PrivateStack.
|
|
30
|
-
|
|
29
|
+
<BottomSheetModalProvider>
|
|
30
|
+
<PrivateStack.Navigator initialRouteName={Screens.HOME} screenOptions={screenOptions}>
|
|
31
|
+
<PrivateStack.Screen component={HomeScreen} name={Screens.HOME} />
|
|
32
|
+
</PrivateStack.Navigator>
|
|
33
|
+
</BottomSheetModalProvider>
|
|
31
34
|
);
|
|
32
35
|
}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
2
|
+
import { createNativeStackNavigator, NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import { LandingScreen } from '../screens/LandingScreen/landing.screen';
|
|
5
6
|
|
|
6
7
|
import { screenOptions } from './screen-options';
|
|
7
8
|
import { Screens } from './screens.enum';
|
|
8
9
|
|
|
9
|
-
const PublicStack =
|
|
10
|
+
const PublicStack = createNativeStackNavigator<PublicStackParams>();
|
|
10
11
|
|
|
11
12
|
export type PublicStackParams = {
|
|
12
|
-
[Screens.
|
|
13
|
+
[Screens.LANDING]: undefined;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
export type PublicScreenProps<T extends keyof PublicStackParams> =
|
|
16
|
+
export type PublicScreenProps<T extends keyof PublicStackParams> = NativeStackScreenProps<
|
|
16
17
|
PublicStackParams,
|
|
17
18
|
T
|
|
18
19
|
>;
|
|
19
20
|
|
|
20
|
-
export default function PublicRoutes()
|
|
21
|
+
export default function PublicRoutes() {
|
|
21
22
|
return (
|
|
22
|
-
<
|
|
23
|
-
<PublicStack.
|
|
24
|
-
|
|
23
|
+
<BottomSheetModalProvider>
|
|
24
|
+
<PublicStack.Navigator initialRouteName={Screens.LANDING} screenOptions={screenOptions}>
|
|
25
|
+
<PublicStack.Screen component={LandingScreen} name={Screens.LANDING} />
|
|
26
|
+
</PublicStack.Navigator>
|
|
27
|
+
</BottomSheetModalProvider>
|
|
25
28
|
);
|
|
26
29
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { ScreenContainer,
|
|
3
|
+
import { ScreenContainer, Typography } from '../../components';
|
|
4
4
|
import { PrivateScreenProps, Screens } from '../../routes';
|
|
5
5
|
|
|
6
6
|
export function HomeScreen(props: PrivateScreenProps<Screens.HOME>) {
|
|
7
7
|
return (
|
|
8
8
|
<ScreenContainer>
|
|
9
|
-
<
|
|
9
|
+
<Typography>Home</Typography>
|
|
10
10
|
</ScreenContainer>
|
|
11
11
|
);
|
|
12
12
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BottomSheet,
|
|
5
|
+
Box,
|
|
6
|
+
Button,
|
|
7
|
+
OutlinedButton,
|
|
8
|
+
ScreenContainer,
|
|
9
|
+
ScreenHeader,
|
|
10
|
+
Typography,
|
|
11
|
+
useBottomSheet,
|
|
12
|
+
} from '../../components';
|
|
13
|
+
import { useToggleDarkMode } from '../../hooks';
|
|
14
|
+
import { PublicScreenProps, Screens } from '../../routes';
|
|
15
|
+
import { tw } from '../../tailwind';
|
|
16
|
+
|
|
17
|
+
export function LandingScreen(props: PublicScreenProps<Screens.LANDING>) {
|
|
18
|
+
const toggleDarkMode = useToggleDarkMode();
|
|
19
|
+
const { expandSheet, sheetRef } = useBottomSheet();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<ScreenContainer>
|
|
23
|
+
<ScreenHeader title="Landing" onExtraActionPress={toggleDarkMode} />
|
|
24
|
+
<Box style={tw`mx-4`}>
|
|
25
|
+
<Box row style={tw`gap-2`}>
|
|
26
|
+
<Button title="Show Bottom Sheet" onPress={expandSheet} />
|
|
27
|
+
<OutlinedButton title="Login" />
|
|
28
|
+
</Box>
|
|
29
|
+
</Box>
|
|
30
|
+
<BottomSheet sheetRef={sheetRef}>
|
|
31
|
+
<Box>
|
|
32
|
+
<Typography>Bottom Sheet</Typography>
|
|
33
|
+
</Box>
|
|
34
|
+
</BottomSheet>
|
|
35
|
+
</ScreenContainer>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { Atom, SetStateAction, WritableAtom } from 'jotai';
|
|
2
1
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
2
|
|
|
4
3
|
export type DefaultComponentProps = {
|
|
5
4
|
error?: string;
|
|
6
5
|
isDisabled?: boolean;
|
|
7
|
-
style?: StyleProp<ViewStyle>;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type DefaultInputComponentProps<T> = DefaultComponentProps & {
|
|
11
|
-
atom?: WritableAtom<T, [SetStateAction<T>], void> | Atom<T>;
|
|
12
6
|
isLoading?: boolean;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
13
8
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import axios, { HttpStatusCode } from 'axios';
|
|
3
|
+
|
|
4
|
+
export function isNetworkError(error: any) {
|
|
5
|
+
return axios.isAxiosError(error) && !error.response;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function isUnauthorizedError(error: any) {
|
|
9
|
+
return axios.isAxiosError(error) && error.response?.status === HttpStatusCode.Unauthorized;
|
|
10
|
+
}
|