@modhamanish/rn-mm-template 1.0.3 → 1.0.5
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/MMTemplate/.eslintrc.js +95 -1
- package/MMTemplate/.husky/pre-commit +2 -0
- package/MMTemplate/.prettierrc.js +2 -0
- package/MMTemplate/App.tsx +27 -21
- package/MMTemplate/README.md +117 -23
- package/MMTemplate/__tests__/App.test.tsx +5 -3
- package/MMTemplate/babel.config.js +24 -1
- package/MMTemplate/index.js +1 -0
- package/MMTemplate/package.json +24 -4
- package/MMTemplate/src/components/AnimationView.tsx +54 -69
- package/MMTemplate/src/components/AppText.tsx +7 -4
- package/MMTemplate/src/components/CustomAlert.tsx +203 -0
- package/MMTemplate/src/components/CustomToast.tsx +2 -1
- package/MMTemplate/src/components/ErrorBoundaryFallback.tsx +127 -0
- package/MMTemplate/src/components/FeatureItem.tsx +8 -6
- package/MMTemplate/src/components/FullScreenContainer.tsx +9 -7
- package/MMTemplate/src/components/InfoCard.tsx +8 -6
- package/MMTemplate/src/components/LanguageSwitcher.tsx +8 -6
- package/MMTemplate/src/components/TextInput.tsx +25 -15
- package/MMTemplate/src/components/ThemeSwitcher.tsx +4 -3
- package/MMTemplate/src/context/AuthContext.tsx +5 -4
- package/MMTemplate/src/context/ThemeContext.tsx +10 -19
- package/MMTemplate/src/locales/en.json +4 -1
- package/MMTemplate/src/locales/hi.json +4 -1
- package/MMTemplate/src/navigation/AppNavigator.tsx +7 -8
- package/MMTemplate/src/navigation/AppStack.tsx +6 -6
- package/MMTemplate/src/navigation/AuthCheck.tsx +11 -10
- package/MMTemplate/src/navigation/AuthStack.tsx +6 -4
- package/MMTemplate/src/navigation/MainTab.tsx +19 -13
- package/MMTemplate/src/screens/AddNoteScreen.tsx +20 -14
- package/MMTemplate/src/screens/HomeScreen.tsx +21 -15
- package/MMTemplate/src/screens/LoginScreen.tsx +21 -18
- package/MMTemplate/src/screens/NoteScreen.tsx +18 -16
- package/MMTemplate/src/screens/ProfileScreen.tsx +16 -13
- package/MMTemplate/src/screens/SettingsScreen.tsx +14 -11
- package/MMTemplate/src/screens/WelcomeScreen.tsx +19 -13
- package/MMTemplate/src/services/axiosInstance.ts +7 -5
- package/MMTemplate/src/services/note.query.ts +7 -5
- package/MMTemplate/src/theme/{Colors.ts → colors.ts} +6 -0
- package/MMTemplate/src/types/components.types.ts +38 -0
- package/MMTemplate/src/types/navigation.types.ts +1 -1
- package/MMTemplate/src/utils/i18n.ts +8 -6
- package/MMTemplate/src/utils/navigationUtils.ts +2 -1
- package/MMTemplate/src/utils/storageHelper.ts +8 -8
- package/MMTemplate/src/utils/utilsHelper.ts +1 -0
- package/MMTemplate/tsconfig.json +27 -0
- package/README.md +37 -1
- package/package.json +1 -1
|
@@ -28,7 +28,10 @@
|
|
|
28
28
|
"creating": "Creating...",
|
|
29
29
|
"noteCreated": "Note created successfully",
|
|
30
30
|
"titleRequired": "Title is required",
|
|
31
|
-
"descriptionRequired": "Description is required"
|
|
31
|
+
"descriptionRequired": "Description is required",
|
|
32
|
+
"errorOccurred": "An error occurred",
|
|
33
|
+
"errorDescription": "Something went wrong. Please try again or contact support if the problem persists.",
|
|
34
|
+
"tryAgain": "Try Again"
|
|
32
35
|
},
|
|
33
36
|
"auth": {
|
|
34
37
|
"welcomeBack": "Welcome Back!",
|
|
@@ -28,7 +28,10 @@
|
|
|
28
28
|
"creating": "बनाया जा रहा है...",
|
|
29
29
|
"noteCreated": "नोट सफलतापूर्वक बनाया गया",
|
|
30
30
|
"titleRequired": "शीर्षक आवश्यक है",
|
|
31
|
-
"descriptionRequired": "विवरण आवश्यक है"
|
|
31
|
+
"descriptionRequired": "विवरण आवश्यक है",
|
|
32
|
+
"errorOccurred": "एक त्रुटि हुई",
|
|
33
|
+
"errorDescription": "कुछ गलत हो गया। कृपया पुन: प्रयास करें या समस्या बनी रहने पर सहायता टीम से संपर्क करें।",
|
|
34
|
+
"tryAgain": "पुन: प्रयास करें"
|
|
32
35
|
},
|
|
33
36
|
"auth": {
|
|
34
37
|
"welcomeBack": "वापसी पर स्वागत है!",
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
+
|
|
2
3
|
import { NavigationContainer } from '@react-navigation/native';
|
|
3
4
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
4
5
|
|
|
5
|
-
import { RootStackParamList } from '
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
import AuthStack from './AuthStack';
|
|
12
|
-
import AppStack from './AppStack';
|
|
6
|
+
import { RootStackParamList } from '@app-types/navigation.types';
|
|
7
|
+
import AppStack from '@navigation/AppStack';
|
|
8
|
+
import AuthCheck from '@navigation/AuthCheck';
|
|
9
|
+
import AuthStack from '@navigation/AuthStack';
|
|
10
|
+
import Routes from '@navigation/routes';
|
|
11
|
+
import { navigationRef } from '@utils/navigationUtils';
|
|
13
12
|
|
|
14
13
|
const Stack = createNativeStackNavigator<RootStackParamList>();
|
|
15
14
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
2
|
|
|
4
|
-
import
|
|
5
|
-
import { AppStackParamList } from '../types/navigation.types';
|
|
3
|
+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
6
4
|
|
|
5
|
+
import type { AppStackParamList } from '@app-types/navigation.types';
|
|
7
6
|
// Screens
|
|
8
|
-
import MainTab from '
|
|
9
|
-
import
|
|
10
|
-
import AddNoteScreen from '
|
|
7
|
+
import MainTab from '@navigation/MainTab';
|
|
8
|
+
import Routes from '@navigation/routes';
|
|
9
|
+
import AddNoteScreen from '@screens/AddNoteScreen';
|
|
10
|
+
import SettingsScreen from '@screens/SettingsScreen';
|
|
11
11
|
|
|
12
12
|
const Stack = createNativeStackNavigator<AppStackParamList>();
|
|
13
13
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
import React, { FC, useEffect, useMemo } from 'react';
|
|
1
2
|
import { StyleSheet, Image } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import Routes from '
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
|
|
4
|
+
import { Images } from '@assets/images';
|
|
5
|
+
import FullScreenContainer from '@components/FullScreenContainer';
|
|
6
|
+
import { useAuth } from '@context/AuthContext';
|
|
7
|
+
import { useTheme } from '@context/ThemeContext';
|
|
8
|
+
import Routes from '@navigation/routes';
|
|
9
|
+
import { ThemeType } from '@src/theme/colors';
|
|
10
|
+
import { resetAndNavigate } from '@utils/navigationUtils';
|
|
11
|
+
import { mobileScreenHeight, mobileScreenWidth } from '@utils/utilsHelper';
|
|
11
12
|
|
|
12
13
|
const AuthCheck: FC = () => {
|
|
13
14
|
const theme = useTheme();
|
|
14
15
|
const { isUserLoggedIn } = useAuth();
|
|
15
|
-
const styles = getStyles(theme);
|
|
16
|
+
const styles = useMemo(() => getStyles(theme), [theme]);
|
|
16
17
|
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
setTimeout(() => {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
+
|
|
2
3
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
3
|
-
|
|
4
|
-
import { AuthStackParamList } from '
|
|
5
|
-
import
|
|
6
|
-
import LoginScreen from '
|
|
4
|
+
|
|
5
|
+
import { AuthStackParamList } from '@app-types/navigation.types';
|
|
6
|
+
import Routes from '@navigation/routes';
|
|
7
|
+
import LoginScreen from '@screens/LoginScreen';
|
|
8
|
+
import WelcomeScreen from '@screens/WelcomeScreen';
|
|
7
9
|
|
|
8
10
|
const Stack = createNativeStackNavigator<AuthStackParamList>();
|
|
9
11
|
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
2
|
+
|
|
4
3
|
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
|
5
|
-
import
|
|
6
|
-
import { MainTabParamList } from '../types/navigation.types';
|
|
7
|
-
import { useTheme } from '../context/ThemeContext';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
8
5
|
|
|
6
|
+
import { MainTabParamList } from '@app-types/navigation.types';
|
|
7
|
+
import AppText from '@components/AppText';
|
|
8
|
+
import { useTheme } from '@context/ThemeContext';
|
|
9
|
+
import Routes from '@navigation/routes';
|
|
9
10
|
// Screens
|
|
10
|
-
import HomeScreen from '
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import HomeScreen from '@screens/HomeScreen';
|
|
12
|
+
import NoteScreen from '@screens/NoteScreen';
|
|
13
|
+
import ProfileScreen from '@screens/ProfileScreen';
|
|
14
|
+
import { hexWithOpacity } from '@src/utils/utilsHelper';
|
|
13
15
|
|
|
14
16
|
const BottomTab = createBottomTabNavigator<MainTabParamList>();
|
|
15
17
|
|
|
18
|
+
const HomeIcon = () => <AppText>🏠</AppText>;
|
|
19
|
+
const NoteIcon = () => <AppText>📝</AppText>;
|
|
20
|
+
const ProfileIcon = () => <AppText>👤</AppText>;
|
|
21
|
+
|
|
16
22
|
const MainTab: FC = () => {
|
|
17
23
|
const { t } = useTranslation();
|
|
18
24
|
const theme = useTheme();
|
|
@@ -24,10 +30,10 @@ const MainTab: FC = () => {
|
|
|
24
30
|
tabBarHideOnKeyboard: true,
|
|
25
31
|
tabBarStyle: {
|
|
26
32
|
backgroundColor: theme.colors.backgroundColor,
|
|
27
|
-
borderTopColor: theme.colors.textColor
|
|
33
|
+
borderTopColor: hexWithOpacity(theme.colors.textColor, 12),
|
|
28
34
|
},
|
|
29
35
|
tabBarActiveTintColor: theme.colors.primary,
|
|
30
|
-
tabBarInactiveTintColor: theme.colors.textColor
|
|
36
|
+
tabBarInactiveTintColor: hexWithOpacity(theme.colors.textColor, 50),
|
|
31
37
|
}}
|
|
32
38
|
>
|
|
33
39
|
<BottomTab.Screen
|
|
@@ -35,7 +41,7 @@ const MainTab: FC = () => {
|
|
|
35
41
|
component={HomeScreen}
|
|
36
42
|
options={{
|
|
37
43
|
tabBarLabel: t('common.home'),
|
|
38
|
-
tabBarIcon:
|
|
44
|
+
tabBarIcon: HomeIcon,
|
|
39
45
|
}}
|
|
40
46
|
/>
|
|
41
47
|
<BottomTab.Screen
|
|
@@ -43,7 +49,7 @@ const MainTab: FC = () => {
|
|
|
43
49
|
component={NoteScreen}
|
|
44
50
|
options={{
|
|
45
51
|
tabBarLabel: t('common.note'),
|
|
46
|
-
tabBarIcon:
|
|
52
|
+
tabBarIcon: NoteIcon,
|
|
47
53
|
}}
|
|
48
54
|
/>
|
|
49
55
|
<BottomTab.Screen
|
|
@@ -51,7 +57,7 @@ const MainTab: FC = () => {
|
|
|
51
57
|
component={ProfileScreen}
|
|
52
58
|
options={{
|
|
53
59
|
tabBarLabel: t('common.profile'),
|
|
54
|
-
tabBarIcon:
|
|
60
|
+
tabBarIcon: ProfileIcon,
|
|
55
61
|
}}
|
|
56
62
|
/>
|
|
57
63
|
</BottomTab.Navigator>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, useMemo } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
StyleSheet,
|
|
4
4
|
View,
|
|
@@ -6,22 +6,25 @@ import {
|
|
|
6
6
|
ActivityIndicator,
|
|
7
7
|
ScrollView,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
|
|
10
|
-
import { useTranslation } from 'react-i18next';
|
|
11
|
-
import { useTheme } from '../context/ThemeContext';
|
|
12
|
-
import { ThemeType } from '../theme/Colors';
|
|
13
|
-
import FullScreenContainer from '../components/FullScreenContainer';
|
|
14
|
-
import TextInput from '../components/TextInput';
|
|
15
|
-
import AnimationView from '../components/AnimationView';
|
|
16
|
-
import { useAddNoteMutation } from '../services/note.query';
|
|
17
|
-
import { goBack } from '../utils/navigationUtils';
|
|
9
|
+
|
|
18
10
|
import { useFormik } from 'formik';
|
|
19
|
-
import {
|
|
11
|
+
import { useTranslation } from 'react-i18next';
|
|
12
|
+
|
|
13
|
+
import AnimationView from '@components/AnimationView';
|
|
14
|
+
import AppText from '@components/AppText';
|
|
15
|
+
import FullScreenContainer from '@components/FullScreenContainer';
|
|
16
|
+
import TextInput from '@components/TextInput';
|
|
17
|
+
import { useTheme } from '@context/ThemeContext';
|
|
18
|
+
import { useAddNoteMutation } from '@services/note.query';
|
|
19
|
+
import { ThemeType } from '@src/theme/colors';
|
|
20
|
+
import { goBack } from '@utils/navigationUtils';
|
|
21
|
+
import { hexWithOpacity } from '@utils/utilsHelper';
|
|
22
|
+
import { NoteSchema } from '@utils/validationSchemas';
|
|
20
23
|
|
|
21
24
|
const AddNoteScreen: FC = () => {
|
|
22
25
|
const { t } = useTranslation();
|
|
23
26
|
const theme = useTheme();
|
|
24
|
-
const styles = getStyles(theme);
|
|
27
|
+
const styles = useMemo(() => getStyles(theme), [theme]);
|
|
25
28
|
|
|
26
29
|
const { mutate: addNote, isPending } = useAddNoteMutation();
|
|
27
30
|
|
|
@@ -50,7 +53,7 @@ const AddNoteScreen: FC = () => {
|
|
|
50
53
|
<AppText variant="h3" style={styles.headerTitle}>
|
|
51
54
|
{t('common.addNote')}
|
|
52
55
|
</AppText>
|
|
53
|
-
<View style={
|
|
56
|
+
<View style={styles.spacer} />
|
|
54
57
|
</View>
|
|
55
58
|
|
|
56
59
|
<ScrollView contentContainerStyle={styles.content}>
|
|
@@ -113,7 +116,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
113
116
|
paddingHorizontal: 16,
|
|
114
117
|
paddingVertical: 12,
|
|
115
118
|
borderBottomWidth: 1,
|
|
116
|
-
borderBottomColor: colors.textColor
|
|
119
|
+
borderBottomColor: hexWithOpacity(colors.textColor, 6),
|
|
117
120
|
},
|
|
118
121
|
backButton: {
|
|
119
122
|
width: 40,
|
|
@@ -152,4 +155,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
152
155
|
saveButtonText: {
|
|
153
156
|
color: colors.white,
|
|
154
157
|
},
|
|
158
|
+
spacer: {
|
|
159
|
+
width: 40,
|
|
160
|
+
},
|
|
155
161
|
});
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
+
import React, { FC, useMemo } from 'react';
|
|
1
2
|
import { Image, StyleSheet, View, ScrollView } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import React, { FC } from 'react';
|
|
3
|
+
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
5
|
+
|
|
6
|
+
import { Images } from '@assets/images';
|
|
7
|
+
import AnimationView from '@components/AnimationView';
|
|
8
|
+
import AppText from '@components/AppText';
|
|
9
|
+
import FeatureItem from '@components/FeatureItem';
|
|
10
|
+
import FullScreenContainer from '@components/FullScreenContainer';
|
|
11
|
+
import InfoCard from '@components/InfoCard';
|
|
12
|
+
import { useTheme } from '@context/ThemeContext';
|
|
13
|
+
import { ThemeType } from '@src/theme/colors';
|
|
14
|
+
import {
|
|
15
|
+
hexWithOpacity,
|
|
16
|
+
mobileScreenHeight,
|
|
17
|
+
mobileScreenWidth,
|
|
18
|
+
} from '@utils/utilsHelper';
|
|
13
19
|
|
|
14
20
|
const HomeScreen: FC = () => {
|
|
15
21
|
const { t } = useTranslation();
|
|
16
22
|
const theme = useTheme();
|
|
17
|
-
const styles = getStyles(theme);
|
|
23
|
+
const styles = useMemo(() => getStyles(theme), [theme]);
|
|
18
24
|
|
|
19
25
|
return (
|
|
20
26
|
<FullScreenContainer style={styles.container} barStyle="light-content">
|
|
@@ -282,7 +288,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
282
288
|
marginBottom: 8,
|
|
283
289
|
},
|
|
284
290
|
subtitle: {
|
|
285
|
-
color: colors.textColor
|
|
291
|
+
color: hexWithOpacity(colors.textColor, 80),
|
|
286
292
|
textAlign: 'center',
|
|
287
293
|
},
|
|
288
294
|
cardText: {
|
|
@@ -291,7 +297,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
291
297
|
marginBottom: 8,
|
|
292
298
|
},
|
|
293
299
|
codeBlock: {
|
|
294
|
-
backgroundColor: colors.textColor
|
|
300
|
+
backgroundColor: hexWithOpacity(colors.textColor, 6),
|
|
295
301
|
padding: 12,
|
|
296
302
|
borderRadius: 8,
|
|
297
303
|
marginBottom: 8,
|
|
@@ -311,13 +317,13 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
311
317
|
marginTop: 24,
|
|
312
318
|
paddingTop: 24,
|
|
313
319
|
borderTopWidth: 1,
|
|
314
|
-
borderTopColor: colors.textColor
|
|
320
|
+
borderTopColor: hexWithOpacity(colors.textColor, 12),
|
|
315
321
|
},
|
|
316
322
|
footerText: {
|
|
317
323
|
color: colors.primary,
|
|
318
324
|
marginBottom: 4,
|
|
319
325
|
},
|
|
320
326
|
footerSubtext: {
|
|
321
|
-
color: colors.textColor
|
|
327
|
+
color: hexWithOpacity(colors.textColor, 80),
|
|
322
328
|
},
|
|
323
329
|
});
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, useMemo } from 'react';
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet, ScrollView } from 'react-native';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { useFormik } from 'formik';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { useTheme } from '../context/ThemeContext';
|
|
7
|
-
import { ThemeType } from '../theme/Colors';
|
|
8
|
-
import FullScreenContainer from '../components/FullScreenContainer';
|
|
9
|
-
import TextInput from '../components/TextInput';
|
|
10
|
-
import AnimationView from '../components/AnimationView';
|
|
11
|
-
import { resetAndNavigate } from '../utils/navigationUtils';
|
|
12
|
-
import Routes from '../navigation/routes';
|
|
13
|
-
import { LoginSchema } from '../utils/validationSchemas';
|
|
14
|
-
import { userMockData } from '../mock';
|
|
15
6
|
import Toast from 'react-native-toast-message';
|
|
16
|
-
|
|
7
|
+
|
|
8
|
+
import AnimationView from '@components/AnimationView';
|
|
9
|
+
import AppText from '@components/AppText';
|
|
10
|
+
import FullScreenContainer from '@components/FullScreenContainer';
|
|
11
|
+
import TextInput from '@components/TextInput';
|
|
12
|
+
import { useAuth } from '@context/AuthContext';
|
|
13
|
+
import { useTheme } from '@context/ThemeContext';
|
|
14
|
+
import { userMockData } from '@mock';
|
|
15
|
+
import Routes from '@navigation/routes';
|
|
16
|
+
import { ThemeType } from '@src/theme/colors';
|
|
17
|
+
import { resetAndNavigate } from '@utils/navigationUtils';
|
|
18
|
+
import { hexWithOpacity } from '@utils/utilsHelper';
|
|
19
|
+
import { LoginSchema } from '@utils/validationSchemas';
|
|
17
20
|
|
|
18
21
|
const LoginScreen: FC = () => {
|
|
19
22
|
const { t } = useTranslation();
|
|
20
23
|
const theme = useTheme();
|
|
21
24
|
const { updateUser } = useAuth();
|
|
22
|
-
const styles = getStyles(theme);
|
|
25
|
+
const styles = useMemo(() => getStyles(theme), [theme]);
|
|
23
26
|
|
|
24
27
|
const formik = useFormik({
|
|
25
28
|
initialValues: {
|
|
@@ -183,17 +186,17 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
183
186
|
marginBottom: 8,
|
|
184
187
|
},
|
|
185
188
|
subtitle: {
|
|
186
|
-
color: colors.textColor
|
|
189
|
+
color: hexWithOpacity(colors.textColor, 80),
|
|
187
190
|
},
|
|
188
191
|
formContainer: {
|
|
189
192
|
width: '100%',
|
|
190
193
|
},
|
|
191
194
|
hintBanner: {
|
|
192
|
-
backgroundColor: colors.primary
|
|
195
|
+
backgroundColor: hexWithOpacity(colors.primary, 6),
|
|
193
196
|
padding: 16,
|
|
194
197
|
borderRadius: 12,
|
|
195
198
|
borderWidth: 1,
|
|
196
|
-
borderColor: colors.primary
|
|
199
|
+
borderColor: hexWithOpacity(colors.primary, 18),
|
|
197
200
|
marginBottom: 24,
|
|
198
201
|
},
|
|
199
202
|
hintTitle: {
|
|
@@ -208,7 +211,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
208
211
|
color: colors.textColor,
|
|
209
212
|
},
|
|
210
213
|
hintValue: {
|
|
211
|
-
color: colors.textColor
|
|
214
|
+
color: hexWithOpacity(colors.textColor, 80),
|
|
212
215
|
},
|
|
213
216
|
forgotPassword: {
|
|
214
217
|
alignSelf: 'flex-end',
|
|
@@ -233,7 +236,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
233
236
|
alignItems: 'center',
|
|
234
237
|
},
|
|
235
238
|
signupText: {
|
|
236
|
-
color: colors.textColor
|
|
239
|
+
color: hexWithOpacity(colors.textColor, 80),
|
|
237
240
|
},
|
|
238
241
|
signupLink: {
|
|
239
242
|
color: colors.primary,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React, { FC, useMemo } from 'react';
|
|
1
2
|
import {
|
|
2
3
|
StyleSheet,
|
|
3
4
|
FlatList,
|
|
@@ -6,23 +7,24 @@ import {
|
|
|
6
7
|
ActivityIndicator,
|
|
7
8
|
RefreshControl,
|
|
8
9
|
} from 'react-native';
|
|
9
|
-
|
|
10
|
-
import React, { FC, useMemo } from 'react';
|
|
11
|
-
import FullScreenContainer from '../components/FullScreenContainer';
|
|
12
|
-
import { useTheme } from '../context/ThemeContext';
|
|
10
|
+
|
|
13
11
|
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { ThemeType } from '../theme/Colors';
|
|
15
|
-
import { useGetNotesQuery } from '../services/note.query';
|
|
16
|
-
import { Note } from '../types/services.types';
|
|
17
|
-
import AnimationView from '../components/AnimationView';
|
|
18
12
|
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
13
|
+
import { Note } from '@app-types/services.types';
|
|
14
|
+
import AnimationView from '@components/AnimationView';
|
|
15
|
+
import AppText from '@components/AppText';
|
|
16
|
+
import FullScreenContainer from '@components/FullScreenContainer';
|
|
17
|
+
import { useTheme } from '@context/ThemeContext';
|
|
18
|
+
import Routes from '@navigation/routes';
|
|
19
|
+
import { useGetNotesQuery } from '@services/note.query';
|
|
20
|
+
import { ThemeType } from '@src/theme/colors';
|
|
21
|
+
import { navigate } from '@utils/navigationUtils';
|
|
22
|
+
import { hexWithOpacity } from '@utils/utilsHelper';
|
|
21
23
|
|
|
22
24
|
const NoteScreen: FC = () => {
|
|
23
25
|
const { t } = useTranslation();
|
|
24
26
|
const theme = useTheme();
|
|
25
|
-
const styles = getStyles(theme);
|
|
27
|
+
const styles = useMemo(() => getStyles(theme), [theme]);
|
|
26
28
|
|
|
27
29
|
const { data: notes, isLoading, refetch, isRefetching } = useGetNotesQuery();
|
|
28
30
|
|
|
@@ -156,7 +158,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
156
158
|
letterSpacing: -0.5,
|
|
157
159
|
},
|
|
158
160
|
headerSubtitle: {
|
|
159
|
-
color: colors.textColor
|
|
161
|
+
color: hexWithOpacity(colors.textColor, 50),
|
|
160
162
|
marginTop: 4,
|
|
161
163
|
},
|
|
162
164
|
noteCard: {
|
|
@@ -165,7 +167,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
165
167
|
padding: 16,
|
|
166
168
|
marginBottom: 16,
|
|
167
169
|
borderWidth: 1,
|
|
168
|
-
borderColor: colors.textColor
|
|
170
|
+
borderColor: hexWithOpacity(colors.textColor, 8),
|
|
169
171
|
shadowColor: colors.black,
|
|
170
172
|
shadowOffset: { width: 0, height: 2 },
|
|
171
173
|
shadowOpacity: 0.05,
|
|
@@ -184,7 +186,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
184
186
|
marginRight: 8,
|
|
185
187
|
},
|
|
186
188
|
noteTag: {
|
|
187
|
-
backgroundColor: colors.primary
|
|
189
|
+
backgroundColor: hexWithOpacity(colors.primary, 8),
|
|
188
190
|
paddingHorizontal: 8,
|
|
189
191
|
paddingVertical: 4,
|
|
190
192
|
borderRadius: 8,
|
|
@@ -194,7 +196,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
194
196
|
textTransform: 'uppercase',
|
|
195
197
|
},
|
|
196
198
|
noteContent: {
|
|
197
|
-
color: colors.textColor
|
|
199
|
+
color: hexWithOpacity(colors.textColor, 70),
|
|
198
200
|
lineHeight: 20,
|
|
199
201
|
},
|
|
200
202
|
emptyContainer: {
|
|
@@ -207,7 +209,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
207
209
|
marginBottom: 16,
|
|
208
210
|
},
|
|
209
211
|
emptyText: {
|
|
210
|
-
color: colors.textColor
|
|
212
|
+
color: hexWithOpacity(colors.textColor, 50),
|
|
211
213
|
marginBottom: 24,
|
|
212
214
|
},
|
|
213
215
|
addNoteButtonSmall: {
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, useMemo } from 'react';
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet, Alert } from 'react-native';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import Routes from '
|
|
5
|
+
|
|
6
|
+
import AnimationView from '@components/AnimationView';
|
|
7
|
+
import AppText from '@components/AppText';
|
|
8
|
+
import FullScreenContainer from '@components/FullScreenContainer';
|
|
9
|
+
import InfoCard from '@components/InfoCard';
|
|
10
|
+
import { useAuth } from '@context/AuthContext';
|
|
11
|
+
import { useTheme } from '@context/ThemeContext';
|
|
12
|
+
import Routes from '@navigation/routes';
|
|
13
|
+
import { ThemeType } from '@src/theme/colors';
|
|
14
|
+
import { navigate } from '@utils/navigationUtils';
|
|
15
|
+
import { hexWithOpacity } from '@utils/utilsHelper';
|
|
13
16
|
|
|
14
17
|
const ProfileScreen: FC = () => {
|
|
15
18
|
const { t } = useTranslation();
|
|
16
19
|
const theme = useTheme();
|
|
17
|
-
const styles = getStyles(theme);
|
|
20
|
+
const styles = useMemo(() => getStyles(theme), [theme]);
|
|
18
21
|
const { user, handleLogout } = useAuth();
|
|
19
22
|
|
|
20
23
|
const confirmLogout = () => {
|
|
@@ -133,7 +136,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
133
136
|
marginBottom: 4,
|
|
134
137
|
},
|
|
135
138
|
email: {
|
|
136
|
-
color: colors.textColor
|
|
139
|
+
color: hexWithOpacity(colors.textColor, 80),
|
|
137
140
|
},
|
|
138
141
|
infoRow: {
|
|
139
142
|
flexDirection: 'row',
|
|
@@ -145,7 +148,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
145
148
|
color: colors.textColor,
|
|
146
149
|
},
|
|
147
150
|
infoValue: {
|
|
148
|
-
color: colors.textColor
|
|
151
|
+
color: hexWithOpacity(colors.textColor, 80),
|
|
149
152
|
},
|
|
150
153
|
logoutButton: {
|
|
151
154
|
backgroundColor: colors.primary,
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, useMemo } from 'react';
|
|
2
2
|
import { View, StyleSheet, ScrollView } from 'react-native';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import LanguageSwitcher from '
|
|
10
|
-
import ThemeSwitcher from '
|
|
5
|
+
|
|
6
|
+
import AnimationView from '@components/AnimationView';
|
|
7
|
+
import AppText from '@components/AppText';
|
|
8
|
+
import FullScreenContainer from '@components/FullScreenContainer';
|
|
9
|
+
import LanguageSwitcher from '@components/LanguageSwitcher';
|
|
10
|
+
import ThemeSwitcher from '@components/ThemeSwitcher';
|
|
11
|
+
import { useTheme } from '@context/ThemeContext';
|
|
12
|
+
import { ThemeType } from '@src/theme/colors';
|
|
13
|
+
import { hexWithOpacity } from '@utils/utilsHelper';
|
|
11
14
|
|
|
12
15
|
const SettingsScreen: FC = () => {
|
|
13
16
|
const { t } = useTranslation();
|
|
14
17
|
const theme = useTheme();
|
|
15
|
-
const styles = getStyles(theme);
|
|
18
|
+
const styles = useMemo(() => getStyles(theme), [theme]);
|
|
16
19
|
|
|
17
20
|
return (
|
|
18
21
|
<FullScreenContainer style={styles.container} barStyle="light-content">
|
|
@@ -81,7 +84,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
81
84
|
marginBottom: 8,
|
|
82
85
|
},
|
|
83
86
|
subtitle: {
|
|
84
|
-
color: colors.textColor
|
|
87
|
+
color: hexWithOpacity(colors.textColor, 80),
|
|
85
88
|
},
|
|
86
89
|
section: {
|
|
87
90
|
marginBottom: 32,
|
|
@@ -91,7 +94,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
91
94
|
marginBottom: 8,
|
|
92
95
|
},
|
|
93
96
|
sectionDescription: {
|
|
94
|
-
color: colors.textColor
|
|
97
|
+
color: hexWithOpacity(colors.textColor, 80),
|
|
95
98
|
marginBottom: 16,
|
|
96
99
|
},
|
|
97
100
|
});
|