@modhamanish/rn-mm-template 1.0.4 → 1.1.0
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 +76 -35
- package/MMTemplate/__tests__/App.test.tsx +5 -3
- package/MMTemplate/babel.config.js +24 -1
- package/MMTemplate/index.js +1 -0
- package/MMTemplate/lint_errors.txt +7 -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 +3 -1
- package/package.json +4 -1
- package/release.js +75 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
TextInput as RNTextInput,
|
|
4
4
|
TextInputProps,
|
|
@@ -7,7 +7,11 @@ import {
|
|
|
7
7
|
StyleProp,
|
|
8
8
|
TextStyle,
|
|
9
9
|
ViewStyle,
|
|
10
|
+
LayoutChangeEvent,
|
|
11
|
+
FocusEvent,
|
|
12
|
+
BlurEvent,
|
|
10
13
|
} from 'react-native';
|
|
14
|
+
|
|
11
15
|
import Animated, {
|
|
12
16
|
useSharedValue,
|
|
13
17
|
useAnimatedStyle,
|
|
@@ -15,9 +19,11 @@ import Animated, {
|
|
|
15
19
|
interpolate,
|
|
16
20
|
Extrapolate,
|
|
17
21
|
} from 'react-native-reanimated';
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
22
|
+
|
|
23
|
+
import AppText from '@components/AppText';
|
|
24
|
+
import { useTheme } from '@context/ThemeContext';
|
|
25
|
+
import { ThemeType } from '@src/theme/colors';
|
|
26
|
+
import { hexWithOpacity } from '@utils/utilsHelper';
|
|
21
27
|
|
|
22
28
|
interface CustomTextInputProps extends TextInputProps {
|
|
23
29
|
label?: string;
|
|
@@ -59,7 +65,7 @@ const TextInput: React.FC<CustomTextInputProps> = ({
|
|
|
59
65
|
...props
|
|
60
66
|
}) => {
|
|
61
67
|
const theme = useTheme();
|
|
62
|
-
const styles = getStyles(theme);
|
|
68
|
+
const styles = useMemo(() => getStyles(theme), [theme]);
|
|
63
69
|
const [isFocused, setIsFocused] = useState(false);
|
|
64
70
|
const [leftWidth, setLeftWidth] = useState(0);
|
|
65
71
|
|
|
@@ -115,21 +121,25 @@ const TextInput: React.FC<CustomTextInputProps> = ({
|
|
|
115
121
|
? hasError
|
|
116
122
|
? theme.colors.primary
|
|
117
123
|
: theme.colors.primary
|
|
118
|
-
: theme.colors.textColor
|
|
124
|
+
: hexWithOpacity(theme.colors.textColor, 50),
|
|
119
125
|
};
|
|
120
126
|
});
|
|
121
127
|
|
|
122
|
-
const handleFocus = (e:
|
|
128
|
+
const handleFocus = (e: FocusEvent) => {
|
|
123
129
|
setIsFocused(true);
|
|
124
|
-
onFocus
|
|
130
|
+
if (onFocus) {
|
|
131
|
+
onFocus(e);
|
|
132
|
+
}
|
|
125
133
|
};
|
|
126
134
|
|
|
127
|
-
const handleBlur = (e:
|
|
135
|
+
const handleBlur = (e: BlurEvent) => {
|
|
128
136
|
setIsFocused(false);
|
|
129
|
-
onBlur
|
|
137
|
+
if (onBlur) {
|
|
138
|
+
onBlur(e);
|
|
139
|
+
}
|
|
130
140
|
};
|
|
131
141
|
|
|
132
|
-
const onLeftLayout = (event:
|
|
142
|
+
const onLeftLayout = (event: LayoutChangeEvent) => {
|
|
133
143
|
setLeftWidth(event.nativeEvent.layout.width);
|
|
134
144
|
};
|
|
135
145
|
|
|
@@ -171,7 +181,7 @@ const TextInput: React.FC<CustomTextInputProps> = ({
|
|
|
171
181
|
<RNTextInput
|
|
172
182
|
style={[styles.input, style]}
|
|
173
183
|
placeholder={showPlaceholder ? placeholder : ''}
|
|
174
|
-
placeholderTextColor={theme.colors.textColor
|
|
184
|
+
placeholderTextColor={hexWithOpacity(theme.colors.textColor, 37)}
|
|
175
185
|
onFocus={handleFocus}
|
|
176
186
|
onBlur={handleBlur}
|
|
177
187
|
value={value}
|
|
@@ -213,7 +223,7 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
213
223
|
alignItems: 'center',
|
|
214
224
|
backgroundColor: colors.backgroundColor,
|
|
215
225
|
borderWidth: 1,
|
|
216
|
-
borderColor: colors.textColor
|
|
226
|
+
borderColor: hexWithOpacity(colors.textColor, 18),
|
|
217
227
|
borderRadius: 12,
|
|
218
228
|
paddingHorizontal: 12,
|
|
219
229
|
minHeight: 56,
|
|
@@ -251,11 +261,11 @@ const getStyles = ({ colors }: ThemeType) =>
|
|
|
251
261
|
},
|
|
252
262
|
prefix: {
|
|
253
263
|
marginRight: 4,
|
|
254
|
-
color: colors.textColor
|
|
264
|
+
color: hexWithOpacity(colors.textColor, 50),
|
|
255
265
|
},
|
|
256
266
|
suffix: {
|
|
257
267
|
marginLeft: 4,
|
|
258
|
-
color: colors.textColor
|
|
268
|
+
color: hexWithOpacity(colors.textColor, 50),
|
|
259
269
|
},
|
|
260
270
|
errorText: {
|
|
261
271
|
color: colors.primary,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
3
|
+
|
|
4
|
+
import AppText from '@components/AppText';
|
|
5
|
+
import { useTheme } from '@context/ThemeContext';
|
|
6
|
+
import { ThemeType } from '@src/theme/colors';
|
|
6
7
|
|
|
7
8
|
const ThemeSwitcher = () => {
|
|
8
9
|
const { colors, currentTheme, toggleTheme } = useTheme();
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { userMockData } from '../mock';
|
|
2
|
-
import Routes from '../navigation/routes';
|
|
3
|
-
import { resetAndNavigate } from '../utils/navigationUtils';
|
|
4
|
-
import StorageHelper from '../utils/storageHelper';
|
|
5
1
|
import {
|
|
6
2
|
createContext,
|
|
7
3
|
FC,
|
|
@@ -12,6 +8,11 @@ import {
|
|
|
12
8
|
useState,
|
|
13
9
|
} from 'react';
|
|
14
10
|
|
|
11
|
+
import { userMockData } from '@mock';
|
|
12
|
+
import Routes from '@navigation/routes';
|
|
13
|
+
import { resetAndNavigate } from '@utils/navigationUtils';
|
|
14
|
+
import StorageHelper from '@utils/storageHelper';
|
|
15
|
+
|
|
15
16
|
type UserType = typeof userMockData;
|
|
16
17
|
|
|
17
18
|
type AuthContextType = {
|
|
@@ -4,12 +4,13 @@ import {
|
|
|
4
4
|
ReactNode,
|
|
5
5
|
useCallback,
|
|
6
6
|
useContext,
|
|
7
|
-
useEffect,
|
|
8
7
|
useState,
|
|
9
8
|
} from 'react';
|
|
10
|
-
|
|
9
|
+
|
|
11
10
|
import { EdgeInsets, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
import { darkTheme, lightTheme, ThemeType } from '@src/theme/colors';
|
|
13
|
+
import storageHelper from '@utils/storageHelper';
|
|
13
14
|
|
|
14
15
|
export type ThemeContextType = {
|
|
15
16
|
colors: ThemeType['colors'];
|
|
@@ -26,24 +27,14 @@ type ThemeProviderProps = {
|
|
|
26
27
|
|
|
27
28
|
export const ThemeProvider: FC<ThemeProviderProps> = ({ children }) => {
|
|
28
29
|
const safeAreaInsets = useSafeAreaInsets();
|
|
29
|
-
const [currentTheme, setCurrentTheme] =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
lightTheme.colors,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
30
|
+
const [currentTheme, setCurrentTheme] = useState<
|
|
31
|
+
ThemeContextType['currentTheme']
|
|
32
|
+
>(() => {
|
|
36
33
|
const theme = storageHelper.getItem(storageHelper.STORAGE_KEYS.THEME);
|
|
37
|
-
|
|
38
|
-
}
|
|
34
|
+
return theme === 'dark' ? 'dark' : 'light';
|
|
35
|
+
});
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
if (currentTheme === 'dark') {
|
|
42
|
-
setColors(darkTheme.colors);
|
|
43
|
-
} else {
|
|
44
|
-
setColors(lightTheme.colors);
|
|
45
|
-
}
|
|
46
|
-
}, [currentTheme]);
|
|
37
|
+
const colors = currentTheme === 'dark' ? darkTheme.colors : lightTheme.colors;
|
|
47
38
|
|
|
48
39
|
const toggleTheme = useCallback(() => {
|
|
49
40
|
setCurrentTheme(prev => {
|
|
@@ -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,
|