nx-react-native-cli 1.0.17 → 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 +13 -13
- package/package.json +1 -1
- package/templates/.eslintrc.json +1 -0
- package/templates/.nvmrc +1 -1
- package/templates/apps/mobile/android/app/build.gradle +1 -1
- package/templates/apps/mobile/android/app/proguard-rules.pro +20 -0
- package/templates/apps/mobile/package.json +3 -1
- 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 +0 -1
- 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/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
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
-
}
|