@fadyshawky/react-native-magic 1.0.7 → 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.
Files changed (66) hide show
  1. package/.vscode/settings.json +7 -0
  2. package/CHANGELOG.md +9 -0
  3. package/package.json +1 -1
  4. package/template/App.tsx +30 -9
  5. package/template/package-lock.json +170 -123
  6. package/template/package.json +1 -0
  7. package/template/src/common/ImageResources.g.ts +3 -5
  8. package/template/src/common/components/Background.tsx +66 -28
  9. package/template/src/common/components/Cards.tsx +116 -0
  10. package/template/src/common/components/Container.tsx +145 -0
  11. package/template/src/common/components/FlatListWrapper.tsx +1 -0
  12. package/template/src/common/components/ImageCropPickerButton.tsx +1 -1
  13. package/template/src/common/components/OTPInput.tsx +107 -0
  14. package/template/src/common/components/PhotoTakingButton.tsx +1 -4
  15. package/template/src/common/components/PrimaryButton.tsx +171 -157
  16. package/template/src/common/components/RTLAwareText.tsx +42 -0
  17. package/template/src/common/components/RTLAwareView.tsx +179 -0
  18. package/template/src/common/components/RadioButton.tsx +1 -3
  19. package/template/src/common/components/RadioIcon.tsx +1 -2
  20. package/template/src/common/components/SearchBar.tsx +179 -0
  21. package/template/src/common/components/Separator.tsx +7 -4
  22. package/template/src/common/components/TouchablePlatform.tsx +1 -3
  23. package/template/src/common/components/TryAgain.tsx +3 -3
  24. package/template/src/common/helpers/inAppReviewHelper.ts +0 -1
  25. package/template/src/common/helpers/stringsHelpers.ts +10 -0
  26. package/template/src/common/hooks/useFlatListActions.ts +1 -1
  27. package/template/src/common/localization/LocalizationProvider.tsx +152 -0
  28. package/template/src/common/localization/README.md +488 -0
  29. package/template/src/common/localization/localization.ts +12 -0
  30. package/template/src/common/localization/translations/homeLocalization.ts +1 -0
  31. package/template/src/common/localization/translations/profileLocalization.ts +24 -0
  32. package/template/src/common/validations/errorValidations.ts +1 -6
  33. package/template/src/common/validations/examples/TextInputWithValidation.tsx +229 -0
  34. package/template/src/common/validations/index.ts +28 -0
  35. package/template/src/common/validations/regex.js +83 -0
  36. package/template/src/common/validations/regexValidator.ts +240 -0
  37. package/template/src/common/validations/validationConstants.ts +2 -2
  38. package/template/src/core/api/errorHandler.ts +39 -0
  39. package/template/src/core/api/responseHandlers.ts +1 -26
  40. package/template/src/core/api/serverHeaders.ts +13 -23
  41. package/template/src/core/store/app/appSlice.ts +1 -2
  42. package/template/src/core/store/user/userSlice.ts +1 -0
  43. package/template/src/core/theme/ThemeProvider.tsx +63 -0
  44. package/template/src/core/theme/colors.ts +31 -42
  45. package/template/src/core/theme/commonConsts.ts +1 -1
  46. package/template/src/core/theme/commonStyles.ts +267 -210
  47. package/template/src/core/theme/fonts.ts +17 -1
  48. package/template/src/core/theme/scaling.ts +101 -0
  49. package/template/src/core/theme/themes.ts +214 -0
  50. package/template/src/core/theme/types.ts +51 -0
  51. package/template/src/navigation/AuthStack.tsx +25 -30
  52. package/template/src/navigation/HeaderComponents.tsx +18 -58
  53. package/template/src/navigation/MainNavigation.tsx +5 -6
  54. package/template/src/navigation/MainStack.tsx +6 -27
  55. package/template/src/navigation/RootNavigation.tsx +1 -7
  56. package/template/src/navigation/TabBar.tsx +2 -2
  57. package/template/src/navigation/TopTabBar.tsx +1 -1
  58. package/template/src/screens/Login/Login.tsx +3 -3
  59. package/template/src/screens/home/HomeScreen.tsx +107 -0
  60. package/template/src/screens/home/components/CarouselSection.tsx +79 -0
  61. package/template/src/screens/home/components/FeaturedCarousel.tsx +128 -0
  62. package/template/src/screens/home/hooks/useHomeData.ts +60 -0
  63. package/template/src/screens/home/types.ts +7 -0
  64. package/template/src/screens/registration/RegistrationScreen.tsx +2 -2
  65. package/template/src/screens/resetPassword/ForgotPasswordScreen.tsx +2 -2
  66. package/template/src/utils/stringBuilder.js +25 -0
@@ -5,224 +5,281 @@ import {
5
5
  TextStyle,
6
6
  ViewStyle,
7
7
  } from 'react-native';
8
- import {Colors} from './colors';
9
- import {CommonSizes} from './commonSizes';
8
+ import {Theme} from './types';
9
+ import {FontSizes, LineHeight, Spacing} from './commonSizes';
10
10
  import {Fonts} from './fonts';
11
11
 
12
12
  export const screenComponentWidth = Dimensions.get('screen').width - 60;
13
13
  export const screenWidth = Dimensions.get('screen').width;
14
14
  export const screenHeight = Dimensions.get('screen').height;
15
+
15
16
  export function justifyWidth(componentWidth: number) {
16
17
  return (componentWidth / 2048) * screenWidth;
17
18
  }
18
- export function justifyHeight(componentHeigght: number) {
19
- return (componentHeigght / 2048) * screenHeight;
19
+
20
+ export function justifyHeight(componentHeight: number) {
21
+ return (componentHeight / 2048) * screenHeight;
20
22
  }
21
- export const CommonStyles = StyleSheet.create({
22
- flex1: {
23
- flex: 1,
24
- backgroundColor: Colors.background,
25
- } as ViewStyle,
26
- flex1Transparent: {
27
- flex: 1,
28
- backgroundColor: 'transparent',
29
- } as ViewStyle,
30
- flex1Padding: {
31
- flex: 1,
32
- paddingHorizontal: CommonSizes.spacing.large,
33
- } as ViewStyle,
34
- flex1PaddingTransparent: {
35
- flex: 1,
36
- paddingHorizontal: CommonSizes.spacing.large,
37
- backgroundColor: 'transparent',
38
- } as ViewStyle,
39
- flexCenter: {
40
- flex: 1,
41
- alignItems: 'center',
42
- justifyContent: 'center',
43
- backgroundColor: Colors.background,
44
- } as ViewStyle,
45
- flexColumnCenterStretch: {
46
- flex: 1,
47
- flexDirection: 'column',
48
- alignItems: 'stretch',
49
- justifyContent: 'flex-start',
50
- backgroundColor: Colors.background,
51
- } as ViewStyle,
52
- listContentContainer: {
53
- flexGrow: 1,
54
- paddingHorizontal: CommonSizes.spacing.large,
55
- paddingVertical: CommonSizes.spacing.medium,
56
- } as ViewStyle,
57
- rowCenter: {
58
- flexDirection: 'row',
59
- alignItems: 'center',
60
- } as ViewStyle,
61
- columnAlignStart: {
62
- flexDirection: 'column',
63
- alignItems: 'flex-start',
64
- } as ViewStyle,
65
- shadow: {
66
- backgroundColor: Colors.white,
67
- shadowColor: '#2D9CDB',
68
- ...Platform.select({
69
- ios: {
70
- shadowOffset: {
71
- width: 0,
72
- height: 2,
73
- },
74
- shadowOpacity: 0.23,
75
- shadowRadius: 2.62,
76
- } as ViewStyle,
77
- android: {
78
- elevation: 4,
79
- } as ViewStyle,
80
- }),
81
- } as ViewStyle,
82
- iPhoneXFooter: {
83
- height: 20,
84
- } as ViewStyle,
85
- normalText: {
86
- fontFamily: Fonts.regular,
87
- fontSize: CommonSizes.font.medium,
88
- lineHeight: CommonSizes.lineHeight.medium,
89
- color: Colors.black,
90
- } as TextStyle,
91
- h1_bold: {
92
- fontFamily: Fonts.bold,
93
- fontSize: CommonSizes.font.largePlus,
94
- lineHeight: CommonSizes.lineHeight.largePlus,
95
- color: Colors.black,
96
- } as TextStyle,
97
- h1_semiBold: {
98
- fontFamily: Fonts.semiBold,
99
- fontSize: CommonSizes.font.largePlus,
100
- lineHeight: CommonSizes.lineHeight.largePlus,
101
- color: Colors.black,
102
- } as TextStyle,
103
- h1_regular: {
104
- fontFamily: Fonts.regular,
105
- fontSize: CommonSizes.font.largePlus,
106
- lineHeight: CommonSizes.lineHeight.largePlus,
107
- color: Colors.black,
108
- } as TextStyle,
109
- h2_bold: {
110
- fontFamily: Fonts.bold,
111
- fontSize: CommonSizes.font.extraMedium,
112
- lineHeight: CommonSizes.lineHeight.mediumPlus,
113
- color: Colors.black,
114
- } as TextStyle,
115
- h2_semiBold: {
116
- fontFamily: Fonts.semiBold,
117
- fontSize: CommonSizes.font.extraMedium,
118
- lineHeight: CommonSizes.lineHeight.mediumPlus,
119
- color: Colors.black,
120
- } as TextStyle,
121
- h2_regular: {
122
- fontFamily: Fonts.regular,
123
- fontSize: CommonSizes.font.extraMedium,
124
- lineHeight: CommonSizes.lineHeight.mediumPlus,
125
- color: Colors.black,
126
- } as TextStyle,
127
- h3_bold: {
128
- fontFamily: Fonts.bold,
129
- fontSize: CommonSizes.font.mediumPlus,
130
- lineHeight: CommonSizes.lineHeight.medium,
131
- color: Colors.black,
132
- } as TextStyle,
133
- h3_bold_underlined: {
134
- fontFamily: Fonts.bold,
135
- fontSize: CommonSizes.font.mediumPlus,
136
- lineHeight: CommonSizes.lineHeight.medium,
137
- textDecorationLine: 'underline',
138
- color: Colors.black,
139
- } as TextStyle,
140
- h3_semiBold: {
141
- fontFamily: Fonts.semiBold,
142
- fontSize: CommonSizes.font.mediumPlus,
143
- lineHeight: CommonSizes.lineHeight.medium,
144
- color: Colors.black,
145
- } as TextStyle,
146
- h3_regular: {
147
- fontFamily: Fonts.regular,
148
- fontSize: CommonSizes.font.mediumPlus,
149
- lineHeight: CommonSizes.lineHeight.medium,
150
- color: Colors.black,
151
- } as TextStyle,
152
- h4_bold: {
153
- fontFamily: Fonts.bold,
154
- fontSize: CommonSizes.font.medium,
155
- lineHeight: CommonSizes.lineHeight.medium,
156
- color: Colors.black,
157
- } as TextStyle,
158
- h4_bold_underlined: {
159
- fontFamily: Fonts.bold,
160
- fontSize: CommonSizes.font.medium,
161
- lineHeight: CommonSizes.lineHeight.medium,
162
- textDecorationLine: 'underline',
163
- color: Colors.black,
164
- } as TextStyle,
165
- h4_semiBold: {
166
- fontFamily: Fonts.semiBold,
167
- fontSize: CommonSizes.font.medium,
168
- lineHeight: CommonSizes.lineHeight.medium,
169
- color: Colors.black,
170
- } as TextStyle,
171
- h4_regular: {
172
- fontFamily: Fonts.regular,
173
- fontSize: CommonSizes.font.medium,
174
- lineHeight: CommonSizes.lineHeight.medium,
175
- color: Colors.black,
176
- } as TextStyle,
177
- body_bold: {
178
- fontFamily: Fonts.bold,
179
- fontSize: CommonSizes.font.small,
180
- lineHeight: CommonSizes.lineHeight.small,
181
- color: Colors.black,
182
- } as TextStyle,
183
- body_bold_underlined: {
184
- fontFamily: Fonts.bold,
185
- fontSize: CommonSizes.font.small,
186
- lineHeight: CommonSizes.lineHeight.small,
187
- textDecorationLine: 'underline',
188
- color: Colors.black,
189
- } as TextStyle,
190
- body_semiBold: {
191
- fontFamily: Fonts.semiBold,
192
- fontSize: CommonSizes.font.small,
193
- lineHeight: CommonSizes.lineHeight.small,
194
- color: Colors.black,
195
- } as TextStyle,
196
- body_regular: {
197
- fontFamily: Fonts.regular,
198
- fontSize: CommonSizes.font.small,
199
- lineHeight: CommonSizes.lineHeight.small,
200
- color: Colors.black,
201
- } as TextStyle,
202
- tabBar_bold: {
203
- fontFamily: Fonts.bold,
204
- fontSize: CommonSizes.font.extraSmallPlus,
205
- lineHeight: CommonSizes.lineHeight.extraSmallPlus,
206
- color: Colors.black,
207
- } as TextStyle,
208
- tabBar_regular: {
209
- fontFamily: Fonts.regular,
210
- fontSize: CommonSizes.font.extraSmallPlus,
211
- lineHeight: CommonSizes.lineHeight.extraSmallPlus,
212
- color: Colors.black,
213
- } as TextStyle,
214
- dropShadow: {
215
- shadowColor: '#000',
216
- shadowOffset: {
217
- width: 0,
218
- height: 2,
219
- },
220
- shadowOpacity: 0.25,
221
- shadowRadius: 3.84,
222
23
 
223
- elevation: 5,
224
- } as ViewStyle,
225
- textInputContainer: {
226
- width: '100%',
227
- } as ViewStyle,
24
+ export const createThemedStyles = (theme: Theme) =>
25
+ StyleSheet.create({
26
+ flex1: {
27
+ flex: 1,
28
+ backgroundColor: theme.colors.background,
29
+ } as ViewStyle,
30
+ flex1Transparent: {
31
+ flex: 1,
32
+ backgroundColor: 'transparent',
33
+ } as ViewStyle,
34
+ flex1Padding: {
35
+ flex: 1,
36
+ paddingHorizontal: theme.spacing.lg,
37
+ } as ViewStyle,
38
+ flex1PaddingTransparent: {
39
+ flex: 1,
40
+ paddingHorizontal: theme.spacing.lg,
41
+ backgroundColor: 'transparent',
42
+ } as ViewStyle,
43
+ flexCenter: {
44
+ flex: 1,
45
+ alignItems: 'center',
46
+ justifyContent: 'center',
47
+ backgroundColor: theme.colors.background,
48
+ } as ViewStyle,
49
+ flexColumnCenterStretch: {
50
+ flex: 1,
51
+ flexDirection: 'column',
52
+ alignItems: 'stretch',
53
+ justifyContent: 'flex-start',
54
+ backgroundColor: theme.colors.background,
55
+ } as ViewStyle,
56
+ listContentContainer: {
57
+ flexGrow: 1,
58
+ paddingHorizontal: theme.spacing.lg,
59
+ paddingVertical: theme.spacing.md,
60
+ } as ViewStyle,
61
+ rowCenter: {
62
+ flexDirection: 'row',
63
+ alignItems: 'center',
64
+ } as ViewStyle,
65
+ columnAlignStart: {
66
+ flexDirection: 'column',
67
+ alignItems: 'flex-start',
68
+ } as ViewStyle,
69
+ shadow: {
70
+ backgroundColor: theme.colors.card,
71
+ shadowColor: theme.colors.shadow,
72
+ ...Platform.select({
73
+ ios: {
74
+ shadowOffset: {
75
+ width: 0,
76
+ height: 2,
77
+ },
78
+ shadowOpacity: 0.23,
79
+ shadowRadius: 2.62,
80
+ } as ViewStyle,
81
+ android: {
82
+ elevation: 4,
83
+ } as ViewStyle,
84
+ }),
85
+ } as ViewStyle,
86
+ iPhoneXFooter: {
87
+ height: 20,
88
+ } as ViewStyle,
89
+ normalText: {
90
+ // fontFamily: Fonts.regular,
91
+ // fontSize: FontSizes.medium,
92
+ // lineHeight: LineHeight.medium,
93
+ } as TextStyle,
94
+ h1_bold: {
95
+ fontFamily: Fonts.bold,
96
+ } as TextStyle,
97
+ h1_semiBold: {
98
+ fontFamily: Fonts.semiBold,
99
+ } as TextStyle,
100
+ h1_regular: {
101
+ fontFamily: Fonts.regular,
102
+ } as TextStyle,
103
+ h2_bold: {
104
+ fontFamily: Fonts.bold,
105
+ } as TextStyle,
106
+ h2_semiBold: {
107
+ fontFamily: Fonts.semiBold,
108
+ } as TextStyle,
109
+ h2_regular: {
110
+ fontFamily: Fonts.regular,
111
+ } as TextStyle,
112
+ h3_bold: {
113
+ fontFamily: Fonts.bold,
114
+ } as TextStyle,
115
+ h3_bold_underlined: {
116
+ fontFamily: Fonts.bold,
117
+ textDecorationLine: 'underline',
118
+ } as TextStyle,
119
+ h3_semiBold: {
120
+ fontFamily: Fonts.semiBold,
121
+ } as TextStyle,
122
+ h3_regular: {
123
+ fontFamily: Fonts.regular,
124
+ } as TextStyle,
125
+ h4_bold: {
126
+ fontFamily: Fonts.bold,
127
+ } as TextStyle,
128
+ h4_bold_underlined: {
129
+ fontFamily: Fonts.bold,
130
+ textDecorationLine: 'underline',
131
+ } as TextStyle,
132
+ h4_semiBold: {
133
+ fontFamily: Fonts.semiBold,
134
+ fontSize: FontSizes.medium,
135
+ lineHeight: LineHeight.medium,
136
+ } as TextStyle,
137
+ h4_regular: {
138
+ fontFamily: Fonts.regular,
139
+ fontSize: FontSizes.medium,
140
+ lineHeight: LineHeight.medium,
141
+ } as TextStyle,
142
+ body_bold: {
143
+ fontFamily: Fonts.bold,
144
+ fontSize: FontSizes.small,
145
+ lineHeight: LineHeight.small,
146
+ } as TextStyle,
147
+ body_bold_underlined: {
148
+ fontFamily: Fonts.bold,
149
+ fontSize: FontSizes.small,
150
+ lineHeight: LineHeight.small,
151
+ textDecorationLine: 'underline',
152
+ } as TextStyle,
153
+ body_semiBold: {
154
+ fontFamily: Fonts.semiBold,
155
+ fontSize: FontSizes.small,
156
+ lineHeight: LineHeight.small,
157
+ } as TextStyle,
158
+ body_regular: {
159
+ fontFamily: Fonts.regular,
160
+ fontSize: FontSizes.small,
161
+ lineHeight: LineHeight.small,
162
+ } as TextStyle,
163
+ tabBar_bold: {
164
+ fontFamily: Fonts.bold,
165
+ } as TextStyle,
166
+ tabBar_regular: {
167
+ fontFamily: Fonts.regular,
168
+ } as TextStyle,
169
+ dropShadow: {
170
+ shadowColor: theme.colors.shadow,
171
+ shadowOffset: {
172
+ width: 0,
173
+ height: 4,
174
+ },
175
+ shadowOpacity: 0.25,
176
+ shadowRadius: 8,
177
+ elevation: 5,
178
+ borderWidth: 0.5,
179
+ borderColor: 'rgba(255, 255, 255, 0.1)',
180
+ } as ViewStyle,
181
+ textInputContainer: {
182
+ width: '100%',
183
+ } as ViewStyle,
184
+ });
185
+
186
+ // For backward compatibility and static styles
187
+ export const CommonStyles = createThemedStyles({
188
+ mode: 'light',
189
+ colors: {
190
+ indigoBlue: '#2D9CDB',
191
+ mutedLavender: '#B3B5FF',
192
+ tintColor: '#2D9CDB',
193
+ mutedLavender30: 'rgba(184, 186, 255, 0.3)',
194
+ white: '#FFFFFF',
195
+ backgroundOpacity: 'rgba(41, 45, 50, 0.8)',
196
+ black: '#000000',
197
+ background: '#FFFFFF',
198
+ surface: '#F5F5F5',
199
+ card: '#FFFFFF',
200
+ shadow: 'rgba(0, 0, 0, 0.1)',
201
+ red: '#FB043E',
202
+ balanceBackground: '#F5F5F5',
203
+ },
204
+ text: {
205
+ header1: {
206
+ fontFamily: Fonts.medium,
207
+ fontSize: FontSizes.header1,
208
+ color: '#000000',
209
+ },
210
+ header2: {
211
+ fontFamily: Fonts.normal,
212
+ fontSize: FontSizes.header2,
213
+ color: '#000000',
214
+ },
215
+ body1: {
216
+ fontFamily: Fonts.light,
217
+ fontSize: FontSizes.body1,
218
+ color: '#000000',
219
+ },
220
+ body2: {
221
+ fontFamily: Fonts.regular,
222
+ fontSize: FontSizes.body2,
223
+ color: '#000000',
224
+ },
225
+ button: {
226
+ fontFamily: Fonts.regular,
227
+ fontSize: FontSizes.button,
228
+ color: '#FFFFFF',
229
+ },
230
+ cards: {
231
+ fontFamily: Fonts.semiBold,
232
+ fontSize: FontSizes.card,
233
+ color: '#000000',
234
+ },
235
+ SearchBar: {
236
+ fontFamily: Fonts.light,
237
+ fontSize: FontSizes.searchBar,
238
+ color: '#000000',
239
+ },
240
+ label: {
241
+ fontFamily: Fonts.light,
242
+ fontSize: FontSizes.label,
243
+ color: '#000000',
244
+ },
245
+ hyperlink: {
246
+ fontFamily: Fonts.light,
247
+ fontSize: FontSizes.hyperlink,
248
+ color: '#000000',
249
+ textDecorationLine: 'underline',
250
+ },
251
+ balanceTitle: {
252
+ fontFamily: Fonts.semiBold,
253
+ fontSize: 16,
254
+ color: '#000000',
255
+ },
256
+ balanceAmount: {
257
+ fontFamily: Fonts.semiBold,
258
+ fontSize: 16,
259
+ color: '#000000',
260
+ },
261
+ balanceLabel: {
262
+ fontFamily: Fonts.regular,
263
+ fontSize: 12,
264
+ color: '#000000',
265
+ },
266
+ navBar: {
267
+ fontFamily: Fonts.semiBold,
268
+ fontSize: 16,
269
+ },
270
+ },
271
+ spacing: {
272
+ xs: 4,
273
+ sm: 8,
274
+ md: 12,
275
+ lg: 16,
276
+ xl: 24,
277
+ },
278
+ borderRadius: {
279
+ xs: 4,
280
+ sm: 8,
281
+ md: 12,
282
+ lg: 16,
283
+ xl: 24,
284
+ },
228
285
  });
@@ -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
+ };