@fadyshawky/react-native-magic 1.0.8 → 1.0.9
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/.vscode/settings.json +7 -0
- package/package.json +1 -1
- package/template/App.tsx +30 -9
- package/template/package-lock.json +170 -123
- package/template/package.json +1 -0
- package/template/src/common/ImageResources.g.ts +3 -5
- package/template/src/common/components/Background.tsx +66 -28
- package/template/src/common/components/Cards.tsx +116 -0
- package/template/src/common/components/Container.tsx +145 -0
- package/template/src/common/components/FlatListWrapper.tsx +1 -0
- package/template/src/common/components/ImageCropPickerButton.tsx +1 -1
- package/template/src/common/components/OTPInput.tsx +107 -0
- package/template/src/common/components/PhotoTakingButton.tsx +1 -4
- package/template/src/common/components/PrimaryButton.tsx +171 -157
- package/template/src/common/components/RTLAwareText.tsx +42 -0
- package/template/src/common/components/RTLAwareView.tsx +179 -0
- package/template/src/common/components/RadioButton.tsx +1 -3
- package/template/src/common/components/RadioIcon.tsx +1 -2
- package/template/src/common/components/SearchBar.tsx +179 -0
- package/template/src/common/components/Separator.tsx +7 -4
- package/template/src/common/components/TouchablePlatform.tsx +1 -3
- package/template/src/common/components/TryAgain.tsx +3 -3
- package/template/src/common/helpers/inAppReviewHelper.ts +0 -1
- package/template/src/common/helpers/stringsHelpers.ts +10 -0
- package/template/src/common/hooks/useFlatListActions.ts +1 -1
- package/template/src/common/localization/LocalizationProvider.tsx +152 -0
- package/template/src/common/localization/README.md +488 -0
- package/template/src/common/localization/localization.ts +12 -0
- package/template/src/common/localization/translations/profileLocalization.ts +24 -0
- package/template/src/common/validations/errorValidations.ts +1 -6
- package/template/src/common/validations/examples/TextInputWithValidation.tsx +229 -0
- package/template/src/common/validations/index.ts +28 -0
- package/template/src/common/validations/regex.js +83 -0
- package/template/src/common/validations/regexValidator.ts +240 -0
- package/template/src/common/validations/validationConstants.ts +2 -2
- package/template/src/core/api/errorHandler.ts +39 -0
- package/template/src/core/api/responseHandlers.ts +1 -26
- package/template/src/core/api/serverHeaders.ts +13 -23
- package/template/src/core/store/app/appSlice.ts +1 -2
- package/template/src/core/theme/ThemeProvider.tsx +63 -0
- package/template/src/core/theme/colors.ts +31 -42
- package/template/src/core/theme/commonConsts.ts +1 -1
- package/template/src/core/theme/commonStyles.ts +267 -210
- package/template/src/core/theme/fonts.ts +17 -1
- package/template/src/core/theme/scaling.ts +101 -0
- package/template/src/core/theme/themes.ts +214 -0
- package/template/src/core/theme/types.ts +51 -0
- package/template/src/navigation/AuthStack.tsx +25 -30
- package/template/src/navigation/HeaderComponents.tsx +18 -58
- package/template/src/navigation/MainNavigation.tsx +5 -6
- package/template/src/navigation/MainStack.tsx +3 -28
- package/template/src/navigation/RootNavigation.tsx +1 -7
- package/template/src/navigation/TabBar.tsx +2 -2
- package/template/src/navigation/TopTabBar.tsx +1 -1
- package/template/src/screens/Login/Login.tsx +3 -3
- package/template/src/screens/home/components/CarouselSection.tsx +7 -8
- package/template/src/screens/home/components/FeaturedCarousel.tsx +5 -6
- package/template/src/screens/registration/RegistrationScreen.tsx +2 -2
- package/template/src/screens/resetPassword/ForgotPasswordScreen.tsx +2 -2
- package/template/src/utils/stringBuilder.js +25 -0
|
@@ -1 +1,17 @@
|
|
|
1
|
-
export const Fonts = {
|
|
1
|
+
export const Fonts = {
|
|
2
|
+
// Inter Variable Font
|
|
3
|
+
regular: 'Inter-VariableFont_opsz,wght',
|
|
4
|
+
italic: 'Inter-Italic-VariableFont_opsz,wght',
|
|
5
|
+
|
|
6
|
+
// Kanit Font
|
|
7
|
+
medium: 'Kanit-Medium',
|
|
8
|
+
|
|
9
|
+
// Font weights for Inter Variable Font
|
|
10
|
+
thin: 'Inter-Thin',
|
|
11
|
+
light: 'Inter-Light',
|
|
12
|
+
normal: 'Inter-Regular',
|
|
13
|
+
semiBold: 'Inter-SemiBold',
|
|
14
|
+
bold: 'Inter-Bold',
|
|
15
|
+
extraBold: 'Inter-ExtraBold',
|
|
16
|
+
black: 'Inter-Black',
|
|
17
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {Dimensions, PixelRatio, Platform} from 'react-native';
|
|
2
|
+
|
|
3
|
+
// Device dimensions
|
|
4
|
+
export const {width: SCREEN_WIDTH, height: SCREEN_HEIGHT} =
|
|
5
|
+
Dimensions.get('window');
|
|
6
|
+
|
|
7
|
+
// Base dimensions (based on design specifications)
|
|
8
|
+
const BASE_WIDTH = 720;
|
|
9
|
+
const BASE_HEIGHT = 1440;
|
|
10
|
+
|
|
11
|
+
// Scale factors with increased scaling
|
|
12
|
+
const wScale = (SCREEN_WIDTH / BASE_WIDTH) * 1.2; // Increased by 20%
|
|
13
|
+
const hScale = (SCREEN_HEIGHT / BASE_HEIGHT) * 1.2; // Increased by 20%
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Scales width based on device screen width
|
|
17
|
+
* @param size - Size to scale
|
|
18
|
+
* @returns Scaled size
|
|
19
|
+
*/
|
|
20
|
+
export const scaleWidth = (size: number): number => {
|
|
21
|
+
return PixelRatio.roundToNearestPixel(size * wScale);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Scales height based on device screen height
|
|
26
|
+
* @param size - Size to scale
|
|
27
|
+
* @returns Scaled size
|
|
28
|
+
*/
|
|
29
|
+
export const scaleHeight = (size: number): number => {
|
|
30
|
+
return PixelRatio.roundToNearestPixel(size * hScale);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Scales size proportionally based on screen width
|
|
35
|
+
* More suitable for general scaling of UI elements
|
|
36
|
+
* @param size - Size to scale
|
|
37
|
+
* @returns Scaled size
|
|
38
|
+
*/
|
|
39
|
+
export const scale = (size: number): number => {
|
|
40
|
+
const scaleFactor = Math.min(wScale, hScale) * 1.1; // Additional 10% increase
|
|
41
|
+
return PixelRatio.roundToNearestPixel(size * scaleFactor);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Scales font size based on device screen size
|
|
46
|
+
* Includes platform-specific adjustments with smaller reduction
|
|
47
|
+
* @param size - Font size to scale
|
|
48
|
+
* @returns Scaled font size
|
|
49
|
+
*/
|
|
50
|
+
export const scaleFontSize = (size: number): number => {
|
|
51
|
+
const scaledSize = scale(size);
|
|
52
|
+
if (Platform.OS === 'ios') {
|
|
53
|
+
return Math.round(PixelRatio.roundToNearestPixel(scaledSize));
|
|
54
|
+
}
|
|
55
|
+
return Math.round(PixelRatio.roundToNearestPixel(scaledSize)) - 1; // Reduced from -2 to -1
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Scales spacing/margin/padding based on screen width
|
|
60
|
+
* @param size - Size to scale
|
|
61
|
+
* @returns Scaled size
|
|
62
|
+
*/
|
|
63
|
+
export const scaleSpacing = (size: number): number => {
|
|
64
|
+
return PixelRatio.roundToNearestPixel(size * wScale * 1.1); // Additional 10% increase
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Scales border radius based on screen width
|
|
69
|
+
* @param size - Size to scale
|
|
70
|
+
* @returns Scaled size
|
|
71
|
+
*/
|
|
72
|
+
export const scaleBorderRadius = (size: number): number => {
|
|
73
|
+
return PixelRatio.roundToNearestPixel(size * Math.min(wScale * 1.1, 1.3)); // Increased max scale from 1.2 to 1.3
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns responsive value based on screen width breakpoints
|
|
78
|
+
* @param options - Object containing size values for different breakpoints
|
|
79
|
+
* @returns Appropriate value for current screen width
|
|
80
|
+
*/
|
|
81
|
+
export const responsiveSize = (options: {
|
|
82
|
+
small?: number;
|
|
83
|
+
medium?: number;
|
|
84
|
+
large?: number;
|
|
85
|
+
default: number;
|
|
86
|
+
}): number => {
|
|
87
|
+
if (SCREEN_WIDTH < 720 && options.small !== undefined) {
|
|
88
|
+
return options.small;
|
|
89
|
+
}
|
|
90
|
+
if (SCREEN_WIDTH > 1080 && options.large !== undefined) {
|
|
91
|
+
return options.large;
|
|
92
|
+
}
|
|
93
|
+
if (
|
|
94
|
+
options.medium !== undefined &&
|
|
95
|
+
SCREEN_WIDTH >= 720 &&
|
|
96
|
+
SCREEN_WIDTH <= 1080
|
|
97
|
+
) {
|
|
98
|
+
return options.medium;
|
|
99
|
+
}
|
|
100
|
+
return options.default;
|
|
101
|
+
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import {SearchBar} from 'react-native-screens';
|
|
2
|
+
import {BlackColors, WhiteColors} from './colors';
|
|
3
|
+
import {FontSizes} from './commonSizes';
|
|
4
|
+
import {Fonts} from './fonts';
|
|
5
|
+
import {Theme} from './types';
|
|
6
|
+
import {TextStyle} from 'react-native';
|
|
7
|
+
|
|
8
|
+
const spacing = {
|
|
9
|
+
xs: 4,
|
|
10
|
+
sm: 8,
|
|
11
|
+
md: 16,
|
|
12
|
+
lg: 24,
|
|
13
|
+
xl: 32,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const borderRadius = {
|
|
17
|
+
xs: 4,
|
|
18
|
+
sm: 8,
|
|
19
|
+
md: 12,
|
|
20
|
+
lg: 16,
|
|
21
|
+
xl: 24,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const commonTextStyles = {
|
|
25
|
+
header1: {
|
|
26
|
+
fontFamily: Fonts.medium,
|
|
27
|
+
fontSize: FontSizes.header1,
|
|
28
|
+
},
|
|
29
|
+
header2: {
|
|
30
|
+
fontFamily: Fonts.normal,
|
|
31
|
+
fontSize: FontSizes.header2,
|
|
32
|
+
},
|
|
33
|
+
balanceTitle: {
|
|
34
|
+
fontFamily: Fonts.semiBold,
|
|
35
|
+
fontSize: FontSizes.body2,
|
|
36
|
+
textAlign: 'center',
|
|
37
|
+
},
|
|
38
|
+
balanceAmount: {
|
|
39
|
+
fontFamily: Fonts.normal,
|
|
40
|
+
fontSize: FontSizes.header2,
|
|
41
|
+
textAlign: 'center',
|
|
42
|
+
},
|
|
43
|
+
balanceLabel: {
|
|
44
|
+
fontFamily: Fonts.light,
|
|
45
|
+
fontSize: FontSizes.balanceLabel,
|
|
46
|
+
},
|
|
47
|
+
body1: {
|
|
48
|
+
fontFamily: Fonts.light,
|
|
49
|
+
fontSize: FontSizes.body1,
|
|
50
|
+
},
|
|
51
|
+
body2: {
|
|
52
|
+
fontFamily: Fonts.regular,
|
|
53
|
+
fontSize: FontSizes.body2,
|
|
54
|
+
},
|
|
55
|
+
button: {
|
|
56
|
+
fontFamily: Fonts.regular,
|
|
57
|
+
fontSize: FontSizes.button,
|
|
58
|
+
},
|
|
59
|
+
cards: {
|
|
60
|
+
fontFamily: Fonts.semiBold,
|
|
61
|
+
fontSize: FontSizes.card,
|
|
62
|
+
},
|
|
63
|
+
SearchBar: {
|
|
64
|
+
fontFamily: Fonts.light,
|
|
65
|
+
fontSize: FontSizes.searchBar,
|
|
66
|
+
},
|
|
67
|
+
label: {
|
|
68
|
+
fontFamily: Fonts.light,
|
|
69
|
+
fontSize: FontSizes.label,
|
|
70
|
+
},
|
|
71
|
+
hyperlink: {
|
|
72
|
+
fontFamily: Fonts.light,
|
|
73
|
+
fontSize: FontSizes.hyperlink,
|
|
74
|
+
textDecorationStyle: 'solid',
|
|
75
|
+
textDecorationLine: 'underline',
|
|
76
|
+
textDecorationColor: WhiteColors.indigoBlue,
|
|
77
|
+
} as TextStyle,
|
|
78
|
+
navBar: {
|
|
79
|
+
fontFamily: Fonts.normal,
|
|
80
|
+
fontSize: FontSizes.navBar,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const lightTheme: Theme = {
|
|
85
|
+
mode: 'light',
|
|
86
|
+
colors: {
|
|
87
|
+
...WhiteColors,
|
|
88
|
+
},
|
|
89
|
+
text: {
|
|
90
|
+
...commonTextStyles,
|
|
91
|
+
header1: {
|
|
92
|
+
...commonTextStyles.header1,
|
|
93
|
+
color: WhiteColors.black,
|
|
94
|
+
},
|
|
95
|
+
balanceTitle: {
|
|
96
|
+
...commonTextStyles.balanceTitle,
|
|
97
|
+
color: WhiteColors.indigoBlue,
|
|
98
|
+
textAlign: 'center',
|
|
99
|
+
},
|
|
100
|
+
balanceAmount: {
|
|
101
|
+
...commonTextStyles.balanceAmount,
|
|
102
|
+
color: WhiteColors.indigoBlue,
|
|
103
|
+
textAlign: 'center',
|
|
104
|
+
},
|
|
105
|
+
balanceLabel: {
|
|
106
|
+
...commonTextStyles.balanceLabel,
|
|
107
|
+
color: WhiteColors.indigoBlue,
|
|
108
|
+
},
|
|
109
|
+
header2: {
|
|
110
|
+
...commonTextStyles.header2,
|
|
111
|
+
color: WhiteColors.black,
|
|
112
|
+
},
|
|
113
|
+
body1: {
|
|
114
|
+
...commonTextStyles.body1,
|
|
115
|
+
color: WhiteColors.black,
|
|
116
|
+
},
|
|
117
|
+
body2: {
|
|
118
|
+
...commonTextStyles.body2,
|
|
119
|
+
color: WhiteColors.black,
|
|
120
|
+
},
|
|
121
|
+
button: {
|
|
122
|
+
...commonTextStyles.button,
|
|
123
|
+
color: WhiteColors.white,
|
|
124
|
+
},
|
|
125
|
+
cards: {
|
|
126
|
+
...commonTextStyles.cards,
|
|
127
|
+
color: WhiteColors.black,
|
|
128
|
+
},
|
|
129
|
+
SearchBar: {
|
|
130
|
+
...commonTextStyles.SearchBar,
|
|
131
|
+
color: WhiteColors.black,
|
|
132
|
+
},
|
|
133
|
+
label: {
|
|
134
|
+
...commonTextStyles.label,
|
|
135
|
+
color: WhiteColors.black,
|
|
136
|
+
},
|
|
137
|
+
hyperlink: {
|
|
138
|
+
...commonTextStyles.hyperlink,
|
|
139
|
+
color: WhiteColors.indigoBlue,
|
|
140
|
+
},
|
|
141
|
+
navBar: {
|
|
142
|
+
...commonTextStyles.navBar,
|
|
143
|
+
color: WhiteColors.white,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
spacing,
|
|
147
|
+
borderRadius,
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const darkTheme: Theme = {
|
|
151
|
+
mode: 'dark',
|
|
152
|
+
colors: {
|
|
153
|
+
...BlackColors,
|
|
154
|
+
},
|
|
155
|
+
text: {
|
|
156
|
+
...commonTextStyles,
|
|
157
|
+
header1: {
|
|
158
|
+
...commonTextStyles.header1,
|
|
159
|
+
color: BlackColors.mutedLavender,
|
|
160
|
+
},
|
|
161
|
+
header2: {
|
|
162
|
+
...commonTextStyles.header2,
|
|
163
|
+
color: BlackColors.mutedLavender,
|
|
164
|
+
},
|
|
165
|
+
balanceTitle: {
|
|
166
|
+
...commonTextStyles.balanceTitle,
|
|
167
|
+
color: BlackColors.mutedLavender,
|
|
168
|
+
textAlign: 'center',
|
|
169
|
+
},
|
|
170
|
+
balanceAmount: {
|
|
171
|
+
...commonTextStyles.balanceAmount,
|
|
172
|
+
color: BlackColors.mutedLavender,
|
|
173
|
+
textAlign: 'center',
|
|
174
|
+
},
|
|
175
|
+
balanceLabel: {
|
|
176
|
+
...commonTextStyles.balanceLabel,
|
|
177
|
+
color: BlackColors.mutedLavender,
|
|
178
|
+
},
|
|
179
|
+
body1: {
|
|
180
|
+
...commonTextStyles.body1,
|
|
181
|
+
color: BlackColors.mutedLavender,
|
|
182
|
+
},
|
|
183
|
+
body2: {
|
|
184
|
+
...commonTextStyles.body2,
|
|
185
|
+
color: BlackColors.mutedLavender,
|
|
186
|
+
},
|
|
187
|
+
button: {
|
|
188
|
+
...commonTextStyles.button,
|
|
189
|
+
color: BlackColors.white,
|
|
190
|
+
},
|
|
191
|
+
cards: {
|
|
192
|
+
...commonTextStyles.cards,
|
|
193
|
+
color: BlackColors.white,
|
|
194
|
+
},
|
|
195
|
+
SearchBar: {
|
|
196
|
+
...commonTextStyles.SearchBar,
|
|
197
|
+
color: BlackColors.mutedLavender,
|
|
198
|
+
},
|
|
199
|
+
label: {
|
|
200
|
+
...commonTextStyles.label,
|
|
201
|
+
color: BlackColors.black,
|
|
202
|
+
},
|
|
203
|
+
hyperlink: {
|
|
204
|
+
...commonTextStyles.hyperlink,
|
|
205
|
+
color: BlackColors.mutedLavender,
|
|
206
|
+
},
|
|
207
|
+
navBar: {
|
|
208
|
+
...commonTextStyles.navBar,
|
|
209
|
+
color: BlackColors.white,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
spacing,
|
|
213
|
+
borderRadius,
|
|
214
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {TextStyle} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type ThemeMode = 'light' | 'dark';
|
|
4
|
+
|
|
5
|
+
export interface Theme {
|
|
6
|
+
mode: ThemeMode;
|
|
7
|
+
colors: {
|
|
8
|
+
indigoBlue: string;
|
|
9
|
+
mutedLavender: string;
|
|
10
|
+
tintColor: string;
|
|
11
|
+
mutedLavender30: string;
|
|
12
|
+
balanceBackground: string;
|
|
13
|
+
white: string;
|
|
14
|
+
backgroundOpacity: string;
|
|
15
|
+
black: string;
|
|
16
|
+
background: string;
|
|
17
|
+
surface: string;
|
|
18
|
+
card: string;
|
|
19
|
+
shadow: string;
|
|
20
|
+
red: string;
|
|
21
|
+
};
|
|
22
|
+
text: {
|
|
23
|
+
header1: TextStyle;
|
|
24
|
+
header2: TextStyle;
|
|
25
|
+
balanceTitle: TextStyle;
|
|
26
|
+
balanceAmount: TextStyle;
|
|
27
|
+
balanceLabel: TextStyle;
|
|
28
|
+
body1: TextStyle;
|
|
29
|
+
body2: TextStyle;
|
|
30
|
+
button: TextStyle;
|
|
31
|
+
cards: TextStyle;
|
|
32
|
+
SearchBar: TextStyle;
|
|
33
|
+
label: TextStyle;
|
|
34
|
+
hyperlink: TextStyle;
|
|
35
|
+
navBar: TextStyle;
|
|
36
|
+
};
|
|
37
|
+
spacing: {
|
|
38
|
+
xs: number;
|
|
39
|
+
sm: number;
|
|
40
|
+
md: number;
|
|
41
|
+
lg: number;
|
|
42
|
+
xl: number;
|
|
43
|
+
};
|
|
44
|
+
borderRadius: {
|
|
45
|
+
xs: number;
|
|
46
|
+
sm: number;
|
|
47
|
+
md: number;
|
|
48
|
+
lg: number;
|
|
49
|
+
xl: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -1,43 +1,38 @@
|
|
|
1
1
|
import {createNativeStackNavigator} from '@react-navigation/native-stack';
|
|
2
|
+
import {useTranslation} from '../common/localization/LocalizationProvider';
|
|
2
3
|
import {Login} from '../screens/Login/Login';
|
|
4
|
+
import {OTPScreen} from '../screens/OTP/OTPScreen';
|
|
3
5
|
import {Splash} from '../screens/splash/Splash';
|
|
4
|
-
import RegistrationScreen from '../screens/registration/RegistrationScreen';
|
|
5
|
-
import ForgotPasswordScreen from '../screens/resetPassword/ForgotPasswordScreen';
|
|
6
6
|
|
|
7
7
|
const Stack = createNativeStackNavigator();
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
component: Login,
|
|
20
|
-
options: {
|
|
21
|
-
headerShown: false,
|
|
9
|
+
export function AuthStack() {
|
|
10
|
+
const t = useTranslation();
|
|
11
|
+
|
|
12
|
+
const AuthScreens = [
|
|
13
|
+
{
|
|
14
|
+
id: 'Splash',
|
|
15
|
+
component: Splash,
|
|
16
|
+
options: {
|
|
17
|
+
headerShown: false,
|
|
18
|
+
},
|
|
22
19
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
{
|
|
21
|
+
id: 'Login',
|
|
22
|
+
component: Login,
|
|
23
|
+
options: {
|
|
24
|
+
headerShown: false,
|
|
25
|
+
},
|
|
29
26
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
{
|
|
28
|
+
id: 'OTP',
|
|
29
|
+
component: OTPScreen,
|
|
30
|
+
options: {
|
|
31
|
+
headerShown: false,
|
|
32
|
+
},
|
|
36
33
|
},
|
|
37
|
-
|
|
38
|
-
];
|
|
34
|
+
];
|
|
39
35
|
|
|
40
|
-
export function AuthStack() {
|
|
41
36
|
return (
|
|
42
37
|
<Stack.Navigator
|
|
43
38
|
initialRouteName="Login"
|
|
@@ -1,78 +1,33 @@
|
|
|
1
|
-
import {NativeStackNavigationProp} from '@react-navigation/native-stack';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import {StyleSheet, View} from 'react-native';
|
|
4
3
|
import {CommonSizes} from '../core/theme/commonSizes';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import {screenWidth} from '../core/theme/commonStyles';
|
|
5
|
+
import {scaleWidth} from '../core/theme/scaling';
|
|
7
6
|
|
|
8
|
-
export function
|
|
9
|
-
return (
|
|
10
|
-
<View style={styles.headerBase}>
|
|
11
|
-
<Text style={CommonStyles.h2_regular}>{title}</Text>
|
|
12
|
-
</View>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function HeaderBack({
|
|
17
|
-
title,
|
|
18
|
-
navigation,
|
|
19
|
-
}: {
|
|
20
|
-
title: string;
|
|
21
|
-
navigation: NativeStackNavigationProp<RootStackParamList>;
|
|
22
|
-
}) {
|
|
7
|
+
export function HeaderButton({onPress}: {onPress: () => void}) {
|
|
23
8
|
return (
|
|
24
9
|
<View style={styles.headerWithBack}>
|
|
25
|
-
<View style={styles.
|
|
26
|
-
|
|
27
|
-
</View>
|
|
28
|
-
<BackButton navigation={navigation} />
|
|
10
|
+
<View style={styles.logo} />
|
|
11
|
+
<View style={{width: 40}} />
|
|
29
12
|
</View>
|
|
30
13
|
);
|
|
31
14
|
}
|
|
32
15
|
|
|
33
|
-
export function WebViewHeader({
|
|
34
|
-
navigation,
|
|
35
|
-
}: {
|
|
36
|
-
navigation: NativeStackNavigationProp<RootStackParamList>;
|
|
37
|
-
}) {
|
|
38
|
-
return (
|
|
39
|
-
<View style={styles.webViewHeader}>
|
|
40
|
-
<BackButton navigation={navigation} />
|
|
41
|
-
</View>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function BackButton({
|
|
46
|
-
navigation,
|
|
47
|
-
}: {
|
|
48
|
-
navigation: NativeStackNavigationProp<RootStackParamList>;
|
|
49
|
-
}) {
|
|
50
|
-
return (
|
|
51
|
-
<TouchableOpacity
|
|
52
|
-
style={styles.backButton}
|
|
53
|
-
onPress={() => navigation.pop()}>
|
|
54
|
-
<Image style={styles.backIcon} source={0} />
|
|
55
|
-
</TouchableOpacity>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
16
|
const styles = StyleSheet.create({
|
|
60
17
|
headerBase: {
|
|
61
18
|
width: '100%',
|
|
62
|
-
height: 80,
|
|
63
19
|
backgroundColor: 'transparent',
|
|
64
20
|
justifyContent: 'flex-end',
|
|
65
21
|
alignItems: 'center',
|
|
66
|
-
marginBottom: 25,
|
|
67
22
|
},
|
|
68
23
|
headerWithBack: {
|
|
69
|
-
width:
|
|
24
|
+
width: screenWidth,
|
|
70
25
|
height: 80,
|
|
71
26
|
backgroundColor: 'transparent',
|
|
72
|
-
justifyContent: '
|
|
27
|
+
justifyContent: 'space-between',
|
|
73
28
|
alignItems: 'center',
|
|
74
|
-
paddingHorizontal: CommonSizes.spacing.large,
|
|
75
29
|
flexDirection: 'row',
|
|
30
|
+
paddingHorizontal: scaleWidth(16),
|
|
76
31
|
},
|
|
77
32
|
webViewHeader: {
|
|
78
33
|
width: '100%',
|
|
@@ -90,13 +45,18 @@ const styles = StyleSheet.create({
|
|
|
90
45
|
zIndex: 0,
|
|
91
46
|
},
|
|
92
47
|
backButton: {
|
|
93
|
-
width:
|
|
48
|
+
width: 40,
|
|
94
49
|
height: 40,
|
|
95
|
-
justifyContent: 'flex-end',
|
|
96
50
|
},
|
|
97
51
|
backIcon: {
|
|
98
|
-
width:
|
|
99
|
-
height:
|
|
52
|
+
width: 40,
|
|
53
|
+
height: 40,
|
|
100
54
|
resizeMode: 'contain',
|
|
55
|
+
alignSelf: 'flex-start',
|
|
56
|
+
},
|
|
57
|
+
logo: {
|
|
58
|
+
width: '50%',
|
|
59
|
+
// height: 66,
|
|
60
|
+
resizeMode: 'center',
|
|
101
61
|
},
|
|
102
62
|
});
|
|
@@ -4,11 +4,10 @@ import {DefaultTheme, NavigationContainer} from '@react-navigation/native';
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import {useRef} from 'react';
|
|
6
6
|
import {useAppSelector} from '../core/store/reduxHelpers';
|
|
7
|
+
import {Colors} from '../core/theme/colors';
|
|
7
8
|
import {AuthStack} from './AuthStack';
|
|
8
9
|
import {AppMainNavigator} from './MainStack';
|
|
9
10
|
import {navigationRef} from './RootNavigation';
|
|
10
|
-
import {NewColors} from '../core/theme/colors';
|
|
11
|
-
import {Fonts} from '../core/theme/fonts';
|
|
12
11
|
|
|
13
12
|
function AppNavigator() {
|
|
14
13
|
const routeNameRef = useRef<string | undefined>(undefined);
|
|
@@ -17,20 +16,20 @@ function AppNavigator() {
|
|
|
17
16
|
return (
|
|
18
17
|
<NavigationContainer
|
|
19
18
|
ref={navigationRef}
|
|
19
|
+
onReady={() => {
|
|
20
|
+
routeNameRef.current = navigationRef.current?.getCurrentRoute()?.name;
|
|
21
|
+
}}
|
|
20
22
|
theme={{
|
|
21
23
|
dark: false,
|
|
22
24
|
colors: {
|
|
23
25
|
primary: '#000',
|
|
24
|
-
background:
|
|
26
|
+
background: Colors.background,
|
|
25
27
|
card: '#fff',
|
|
26
28
|
text: '#000',
|
|
27
29
|
border: '#000',
|
|
28
30
|
notification: '#ff0000',
|
|
29
31
|
},
|
|
30
32
|
fonts: DefaultTheme.fonts,
|
|
31
|
-
}}
|
|
32
|
-
onReady={() => {
|
|
33
|
-
routeNameRef.current = navigationRef.current?.getCurrentRoute()?.name;
|
|
34
33
|
}}>
|
|
35
34
|
{!accessToken ? <AuthStack /> : <AppMainNavigator />}
|
|
36
35
|
</NavigationContainer>
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
|
|
2
|
-
import {
|
|
3
|
-
createNativeStackNavigator,
|
|
4
|
-
NativeStackHeaderProps,
|
|
5
|
-
NativeStackNavigationProp,
|
|
6
|
-
} from '@react-navigation/native-stack';
|
|
2
|
+
import {createNativeStackNavigator} from '@react-navigation/native-stack';
|
|
7
3
|
import React from 'react';
|
|
8
|
-
import {
|
|
9
|
-
import {Main} from '../screens/main/Main';
|
|
4
|
+
import {HomeScreen} from '../screens/home/HomeScreen';
|
|
10
5
|
import {Profile} from '../screens/profile/Profile';
|
|
11
6
|
import {Settings} from '../screens/Settings/Settings';
|
|
12
|
-
import {Header, HeaderBack} from './HeaderComponents';
|
|
13
7
|
import {TabBar} from './TabBar';
|
|
14
|
-
import {RootStackParamList} from './types';
|
|
15
|
-
import {HomeScreen} from '../screens/home/HomeScreen';
|
|
16
8
|
|
|
17
9
|
const MainScreens = [
|
|
18
10
|
{
|
|
@@ -20,9 +12,6 @@ const MainScreens = [
|
|
|
20
12
|
component: HomeScreen,
|
|
21
13
|
options: {
|
|
22
14
|
tabBarLabel: 'Profile',
|
|
23
|
-
header: () => {
|
|
24
|
-
return <Header title={localization.home.home} />;
|
|
25
|
-
},
|
|
26
15
|
},
|
|
27
16
|
},
|
|
28
17
|
{
|
|
@@ -30,9 +19,6 @@ const MainScreens = [
|
|
|
30
19
|
component: Profile,
|
|
31
20
|
options: {
|
|
32
21
|
tabBarLabel: 'Profile',
|
|
33
|
-
header: () => {
|
|
34
|
-
return <Header title={localization.profile.studentProfile} />;
|
|
35
|
-
},
|
|
36
22
|
},
|
|
37
23
|
},
|
|
38
24
|
];
|
|
@@ -48,18 +34,7 @@ const AppStack = [
|
|
|
48
34
|
{
|
|
49
35
|
id: 'Settings',
|
|
50
36
|
component: Settings,
|
|
51
|
-
options: {
|
|
52
|
-
header: (props: NativeStackHeaderProps) => {
|
|
53
|
-
return (
|
|
54
|
-
<HeaderBack
|
|
55
|
-
title={'Settings'}
|
|
56
|
-
navigation={
|
|
57
|
-
props.navigation as NativeStackNavigationProp<RootStackParamList>
|
|
58
|
-
}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
},
|
|
62
|
-
},
|
|
37
|
+
options: {},
|
|
63
38
|
},
|
|
64
39
|
];
|
|
65
40
|
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import {createNavigationContainerRef} from '@react-navigation/native';
|
|
2
2
|
import {CommonActions} from '@react-navigation/native';
|
|
3
|
-
|
|
4
|
-
type RootStackParamList = {
|
|
5
|
-
Home: undefined;
|
|
6
|
-
// Add other screens here
|
|
7
|
-
Profile: {userId: string};
|
|
8
|
-
Settings: undefined;
|
|
9
|
-
};
|
|
3
|
+
import {RootStackParamList} from './types';
|
|
10
4
|
|
|
11
5
|
export const navigationRef = createNavigationContainerRef<RootStackParamList>();
|
|
12
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {View, Text, TouchableOpacity, Image, StyleSheet} from 'react-native';
|
|
3
3
|
import {CommonStyles} from '../core/theme/commonStyles';
|
|
4
|
-
import {Colors
|
|
4
|
+
import {Colors} from '../core/theme/colors';
|
|
5
5
|
import {
|
|
6
6
|
BottomTabBarProps,
|
|
7
7
|
BottomTabNavigationOptions,
|
|
@@ -89,6 +89,6 @@ const styles = StyleSheet.create({
|
|
|
89
89
|
color: Colors.gray,
|
|
90
90
|
},
|
|
91
91
|
labelFocused: {
|
|
92
|
-
color:
|
|
92
|
+
color: Colors.blueNormalActive,
|
|
93
93
|
},
|
|
94
94
|
});
|