@fadyshawky/react-native-magic 2.0.4 → 2.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.
Files changed (110) hide show
  1. package/package.json +1 -1
  2. package/template/src/common/ImageResources.g.ts +33 -1
  3. package/template/src/common/components/Background.tsx +3 -1
  4. package/template/src/common/components/Container.tsx +1 -1
  5. package/template/src/common/components/OTPInput.tsx +3 -2
  6. package/template/src/common/components/PrimaryButton.tsx +23 -23
  7. package/template/src/common/components/PrimaryTextInput.tsx +189 -199
  8. package/template/src/common/components/RadioIcon.tsx +4 -4
  9. package/template/src/common/components/SafeText.tsx +41 -0
  10. package/template/src/common/components/SearchBar.tsx +19 -17
  11. package/template/src/common/components/TryAgain.tsx +3 -3
  12. package/template/src/common/localization/localization.ts +10 -0
  13. package/template/src/common/localization/translations/commonLocalization.ts +97 -0
  14. package/template/src/common/localization/translations/homeLocalization.ts +24 -0
  15. package/template/src/common/localization/translations/loginLocalization.ts +28 -2
  16. package/template/src/common/localization/translations/mainNavigationLocalization.ts +30 -0
  17. package/template/src/common/localization/translations/navigationLocalization.ts +48 -0
  18. package/template/src/common/localization/translations/otpLocalization.ts +28 -0
  19. package/template/src/common/localization/translations/passwordLocalization.ts +54 -0
  20. package/template/src/common/localization/translations/posLocalization.ts +196 -0
  21. package/template/src/common/utils/FeesCaalculation.tsx +37 -0
  22. package/template/src/common/utils/index.tsx +11 -0
  23. package/template/src/common/utils/printData.tsx +161 -0
  24. package/template/src/common/validations/errorValidations.ts +3 -2
  25. package/template/src/components/PrinterExample.js +226 -0
  26. package/template/src/core/api/serverHeaders.ts +62 -1
  27. package/template/src/core/store/Categories/categoryActions.ts +33 -0
  28. package/template/src/core/store/Categories/categorySlice.ts +75 -0
  29. package/template/src/core/store/Categories/categoryState.ts +41 -0
  30. package/template/src/core/store/Providers/providersActions.ts +102 -0
  31. package/template/src/core/store/Providers/providersSlice.ts +136 -0
  32. package/template/src/core/store/Providers/providersState.ts +37 -0
  33. package/template/src/core/store/Services/servicesActions.ts +191 -0
  34. package/template/src/core/store/Services/servicesSlice.ts +205 -0
  35. package/template/src/core/store/Services/servicesState.ts +466 -0
  36. package/template/src/core/store/app/appSlice.ts +13 -5
  37. package/template/src/core/store/app/appState.ts +10 -2
  38. package/template/src/core/store/rootReducer.ts +6 -1
  39. package/template/src/core/store/store.tsx +55 -2
  40. package/template/src/core/store/user/userActions.ts +164 -26
  41. package/template/src/core/store/user/userSlice.ts +193 -21
  42. package/template/src/core/store/user/userState.ts +148 -25
  43. package/template/src/core/theme/colors.ts +70 -94
  44. package/template/src/core/theme/commonConsts.ts +1 -1
  45. package/template/src/core/theme/commonSizes.ts +94 -119
  46. package/template/src/core/theme/commonStyles.ts +22 -22
  47. package/template/src/core/theme/fonts.ts +14 -13
  48. package/template/src/core/theme/themes.ts +75 -386
  49. package/template/src/core/theme/types.ts +15 -201
  50. package/template/src/core/utils/stringUtils.ts +114 -0
  51. package/template/src/modules/SunmiCard.js +212 -0
  52. package/template/src/modules/SunmiPrepaid.ts +122 -0
  53. package/template/src/navigation/AuthStack.tsx +8 -0
  54. package/template/src/navigation/HeaderComponents.tsx +76 -1
  55. package/template/src/navigation/MainNavigation.tsx +3 -1
  56. package/template/src/navigation/MainStack.tsx +130 -56
  57. package/template/src/navigation/TabBar.tsx +111 -59
  58. package/template/src/navigation/types.ts +24 -0
  59. package/template/src/screens/Categories/Categories.tsx +141 -0
  60. package/template/src/screens/Categories/hooks/useCategoriesData.ts +33 -0
  61. package/template/src/screens/Categories/types.ts +7 -0
  62. package/template/src/screens/Favorites/Favorites.tsx +130 -0
  63. package/template/src/screens/ForceChangePassword/ForceChangePasswordScreen.tsx +155 -0
  64. package/template/src/screens/History/History.tsx +430 -0
  65. package/template/src/screens/History/hooks/useHistoryData.ts +49 -0
  66. package/template/src/screens/History/types.ts +7 -0
  67. package/template/src/screens/InquiredBill/InquiredBill.tsx +443 -0
  68. package/template/src/screens/InquiredBill/hooks/useInquiredData.ts +91 -0
  69. package/template/src/screens/Login/Login.tsx +85 -85
  70. package/template/src/screens/OTP/OTPScreen.tsx +170 -0
  71. package/template/src/screens/PaymentConfirmation/PaymentConfirmation.tsx +326 -0
  72. package/template/src/screens/Providers/Providers.tsx +166 -0
  73. package/template/src/screens/Providers/hooks/useProvidersData.ts +33 -0
  74. package/template/src/screens/Providers/types.ts +7 -0
  75. package/template/src/screens/ReceiptScreen/ReceiptScreen.tsx +181 -0
  76. package/template/src/screens/ReceiptScreen/hooks/useReceiptData.ts +46 -0
  77. package/template/src/screens/ReceiptScreen/utils/utils.tsx +156 -0
  78. package/template/src/screens/Services/Services.tsx +144 -0
  79. package/template/src/screens/Services/hooks/useServicesData.ts +41 -0
  80. package/template/src/screens/SingleService/Components/FawryInputs.tsx +446 -0
  81. package/template/src/screens/SingleService/SingleService.tsx +229 -0
  82. package/template/src/screens/SingleService/hooks/useServiceData.ts +164 -0
  83. package/template/src/screens/home/Components/PayByCode.tsx +129 -0
  84. package/template/src/screens/home/HomeScreen.tsx +268 -77
  85. package/template/src/screens/home/hooks/useHomeData.ts +32 -38
  86. package/template/src/screens/index.tsx +24 -0
  87. package/template/src/screens/profile/Profile.tsx +290 -2
  88. package/template/src/services/SunmiPrinterInternal.js +268 -0
  89. package/template/src/types/sunmiPrepaid.d.ts +20 -0
  90. package/template/src/utils/SunmiPrinter.ts +442 -0
  91. package/template/src/utils/feesCalculator.ts +92 -0
  92. package/template/src/common/components/Stepper.tsx +0 -153
  93. package/template/src/common/components/Svg.tsx +0 -25
  94. package/template/src/common/hooks/useDebounce.ts +0 -17
  95. package/template/src/common/hooks/usePrevious.ts +0 -11
  96. package/template/src/common/localization/intlFormatter.ts +0 -37
  97. package/template/src/common/urls/emailUrl.ts +0 -20
  98. package/template/src/common/urls/mapUrl.ts +0 -22
  99. package/template/src/common/utils/listHandlers.ts +0 -30
  100. package/template/src/common/utils/serializeQueryParams.ts +0 -10
  101. package/template/src/common/validations/hooks/useDatesError.ts +0 -40
  102. package/template/src/common/validations/profileValidations.ts +0 -30
  103. package/template/src/core/theme/shadows.ts +0 -135
  104. package/template/src/navigation/TopTabBar.tsx +0 -77
  105. package/template/src/screens/Settings/Settings.tsx +0 -5
  106. package/template/src/screens/home/components/CarouselSection.tsx +0 -79
  107. package/template/src/screens/home/components/FeaturedCarousel.tsx +0 -128
  108. package/template/src/screens/main/Main.tsx +0 -5
  109. package/template/src/screens/registration/RegistrationScreen.tsx +0 -198
  110. package/template/src/screens/resetPassword/ForgotPasswordScreen.tsx +0 -129
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fadyshawky/react-native-magic",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "react native template with ready components, hooks, react navigation, redux, typescript, etc.",
5
5
  "keywords": [
6
6
  "react-native-magic",
@@ -9,4 +9,36 @@ import {ImageURISource} from 'react-native';
9
9
  * https://github.com/svbutko/react-native-image-resource-generator
10
10
  */
11
11
 
12
- export class ImageResources {}
12
+ export class ImageResources {
13
+ static readonly account: ImageURISource = require('../../resources/images/Account.png');
14
+ static readonly arrows: ImageURISource = require('../../resources/images/Arrows.png');
15
+ static readonly background_2: ImageURISource = require('../../resources/images/Background_2.png');
16
+ static readonly balance: ImageURISource = require('../../resources/images/Balance.png');
17
+ static readonly commission: ImageURISource = require('../../resources/images/Commission.png');
18
+ static readonly display: ImageURISource = require('../../resources/images/Display.png');
19
+ static readonly en: ImageURISource = require('../../resources/images/EN.png');
20
+ static readonly favourite_active: ImageURISource = require('../../resources/images/Favourite_Active.png');
21
+ static readonly favourite_inactive: ImageURISource = require('../../resources/images/Favourite_Inactive.png');
22
+ static readonly favourites: ImageURISource = require('../../resources/images/Favourites.png');
23
+ static readonly financials: ImageURISource = require('../../resources/images/Financials.png');
24
+ static readonly language: ImageURISource = require('../../resources/images/Language.png');
25
+ static readonly neo_pay_plus_logo: ImageURISource = require('../../resources/images/Neo_Pay_Plus_Logo.png');
26
+ static readonly services: ImageURISource = require('../../resources/images/Services.png');
27
+ static readonly splash_screen: ImageURISource = require('../../resources/images/Splash_Screen.png');
28
+ static readonly ar: ImageURISource = require('../../resources/images/ar.png');
29
+ static readonly arrow_left: ImageURISource = require('../../resources/images/arrow_left.png');
30
+ static readonly arrow_right: ImageURISource = require('../../resources/images/arrow_right.png');
31
+ static readonly dark: ImageURISource = require('../../resources/images/dark.png');
32
+ static readonly dark_background_1: ImageURISource = require('../../resources/images/dark_background_1.png');
33
+ static readonly dark_splash_logo: ImageURISource = require('../../resources/images/dark_splash_logo.png');
34
+ static readonly full_ammount: ImageURISource = require('../../resources/images/full_ammount.png');
35
+ static readonly header_logo: ImageURISource = require('../../resources/images/header_logo.png');
36
+ static readonly light: ImageURISource = require('../../resources/images/light.png');
37
+ static readonly light_background_1: ImageURISource = require('../../resources/images/light_background_1.png');
38
+ static readonly light_header_logo: ImageURISource = require('../../resources/images/light_header_logo.png');
39
+ static readonly light_splash_logo: ImageURISource = require('../../resources/images/light_splash_logo.png');
40
+ static readonly partial_ammount: ImageURISource = require('../../resources/images/partial_ammount.png');
41
+ static readonly receipt_logo: ImageURISource = require('../../resources/images/receipt_logo.png');
42
+ static readonly receipt_logo_transparent: ImageURISource = require('../../resources/images/receipt_logo_transparent.png');
43
+ static readonly repeat: ImageURISource = require('../../resources/images/repeat.png');
44
+ }
@@ -56,7 +56,9 @@ export const Background: FC<BackgroundProps> = memo(
56
56
  return (
57
57
  <View
58
58
  style={[styles.container, {backgroundColor: theme.colors.background}]}>
59
- <ImageBackground source={0} style={styles.container}>
59
+ <ImageBackground
60
+ source={ImageResources[`${theme.mode}_background_1`]}
61
+ style={styles.container}>
60
62
  {content}
61
63
  </ImageBackground>
62
64
  </View>
@@ -41,7 +41,7 @@ export const Container = forwardRef<KeyboardAwareScrollView, ContainerProps>(
41
41
  withoutScroll = false,
42
42
  backgroundColor,
43
43
  withoutBackgroundImage = false,
44
- backgroundImage = 0,
44
+ backgroundImage = ImageResources[`light_background_1`],
45
45
  extendedBackground = false,
46
46
  ...scrollViewProps
47
47
  },
@@ -1,15 +1,16 @@
1
1
  import React, {useRef, useState} from 'react';
2
2
  import {
3
- NativeSyntheticEvent,
4
3
  StyleSheet,
4
+ View,
5
5
  TextInput,
6
+ NativeSyntheticEvent,
6
7
  TextInputKeyPressEventData,
7
8
  ViewStyle,
8
9
  } from 'react-native';
9
10
  import {useTheme} from '../../core/theme/ThemeProvider';
10
11
  import {CommonSizes} from '../../core/theme/commonSizes';
11
- import {scaleWidth} from '../../core/theme/scaling';
12
12
  import {PrimaryTextInput} from './PrimaryTextInput';
13
+ import {scaleWidth} from '../../core/theme/scaling';
13
14
  import {RTLAwareView} from './RTLAwareView';
14
15
 
15
16
  interface OTPInputProps {
@@ -17,12 +17,12 @@ import {
17
17
  TouchablePlatformProps,
18
18
  } from '../../../types';
19
19
  import {useTheme} from '../../core/theme/ThemeProvider';
20
+ import {BorderRadius, Spacing} from '../../core/theme/commonSizes';
20
21
  import {createThemedStyles} from '../../core/theme/commonStyles';
21
22
  import {Theme} from '../../core/theme/types';
22
23
  import {IconPlatform} from './IconPlatform';
23
24
  import {TouchablePlatform} from './TouchablePlatform';
24
25
  import {scaleHeight, scaleSpacing} from '../../core/theme/scaling';
25
- import {CommonSizes} from '../../core/theme/commonSizes';
26
26
 
27
27
  interface IProps extends TouchablePlatformProps {
28
28
  label: string;
@@ -58,7 +58,7 @@ export const PrimaryButton: FC<IProps> = memo(
58
58
  return (
59
59
  <ActivityIndicator
60
60
  animating={true}
61
- color={theme.colors.grayScale_50}
61
+ color={theme.colors.backgroundOpacity}
62
62
  size={'small'}
63
63
  />
64
64
  );
@@ -91,7 +91,7 @@ export const PrimaryButton: FC<IProps> = memo(
91
91
  return (
92
92
  <TouchablePlatform
93
93
  style={[styles.button, style] as ViewStyle[]}
94
- highlightColor={theme.colors.grayScale_50}
94
+ highlightColor={theme.colors.mutedLavender30}
95
95
  {...props}>
96
96
  {content}
97
97
  </TouchablePlatform>
@@ -158,19 +158,19 @@ function mergeStylesWithDisabled(
158
158
  ...styles,
159
159
  button: {
160
160
  ...styles.button,
161
- backgroundColor: theme.colors.grayScale_50,
161
+ backgroundColor: theme.colors.mutedLavender30,
162
162
  borderColor: outline
163
- ? theme.colors.grayScale_50
163
+ ? theme.colors.mutedLavender
164
164
  : styles.button.borderColor,
165
165
  elevation: 0,
166
166
  } as ViewStyle,
167
167
  icon: {
168
168
  ...styles.icon,
169
- tintColor: theme.colors.grayScale_50,
169
+ tintColor: theme.colors.mutedLavender,
170
170
  } as ImageStyle,
171
171
  label: {
172
172
  ...styles.label,
173
- color: theme.colors.grayScale_50,
173
+ color: theme.colors.backgroundOpacity,
174
174
  } as TextStyle,
175
175
  };
176
176
  }
@@ -194,7 +194,7 @@ function createButtonStyles(theme: Theme) {
194
194
 
195
195
  const commonLabelStyle: TextStyle = {
196
196
  ...createThemedStyles(theme).h4_bold,
197
- color: theme.colors.grayScale_0,
197
+ color: theme.colors.white,
198
198
  textAlign: 'center',
199
199
  textAlignVertical: 'center',
200
200
  ...Platform.select({
@@ -209,26 +209,26 @@ function createButtonStyles(theme: Theme) {
209
209
  height: 22,
210
210
  marginHorizontal: scaleSpacing(12),
211
211
  resizeMode: 'contain',
212
- tintColor: theme.colors.PlatinateBlue_700,
212
+ tintColor: theme.colors.indigoBlue,
213
213
  };
214
214
 
215
215
  return {
216
216
  solid: StyleSheet.create({
217
217
  button: {
218
218
  ...commonButtonStyle,
219
- backgroundColor: theme.colors.PlatinateBlue_700,
219
+ backgroundColor: theme.colors.indigoBlue,
220
220
  } as ViewStyle,
221
221
  label: theme.text.button,
222
222
  icon: {
223
223
  ...commonIcon,
224
- tintColor: theme.colors.grayScale_0,
224
+ tintColor: theme.colors.white,
225
225
  },
226
226
  }),
227
227
 
228
228
  outline: StyleSheet.create({
229
229
  button: {
230
230
  ...commonButtonStyle,
231
- borderColor: theme.colors.PlatinateBlue_700,
231
+ borderColor: theme.colors.indigoBlue,
232
232
  borderWidth: 2,
233
233
  } as ViewStyle,
234
234
  label: {
@@ -240,7 +240,7 @@ function createButtonStyles(theme: Theme) {
240
240
  outlineNegative: StyleSheet.create({
241
241
  button: {
242
242
  ...commonButtonStyle,
243
- borderColor: theme.colors.PlatinateBlue_700,
243
+ borderColor: theme.colors.mutedLavender,
244
244
  borderWidth: 2,
245
245
  } as ViewStyle,
246
246
  label: {
@@ -248,7 +248,7 @@ function createButtonStyles(theme: Theme) {
248
248
  } as TextStyle,
249
249
  icon: {
250
250
  ...commonIcon,
251
- tintColor: theme.colors.PlatinateBlue_700,
251
+ tintColor: theme.colors.mutedLavender,
252
252
  },
253
253
  }),
254
254
 
@@ -271,12 +271,12 @@ function createSmallSolidStyles(theme: Theme): IStyles {
271
271
  const commonStyles = createThemedStyles(theme);
272
272
  return StyleSheet.create({
273
273
  button: {
274
- padding: CommonSizes.spacing.md,
274
+ padding: Spacing.medium,
275
275
  alignItems: 'center',
276
276
  justifyContent: 'center',
277
- borderRadius: CommonSizes.borderRadius.xl,
277
+ borderRadius: BorderRadius.extraLarge,
278
278
  flexDirection: 'row',
279
- backgroundColor: theme.colors.PlatinateBlue_700,
279
+ backgroundColor: theme.colors.indigoBlue,
280
280
  // width: 175,
281
281
  } as ViewStyle,
282
282
  label: {
@@ -286,7 +286,7 @@ function createSmallSolidStyles(theme: Theme): IStyles {
286
286
  width: 22,
287
287
  height: 22,
288
288
  resizeMode: 'contain',
289
- tintColor: theme.colors.grayScale_0,
289
+ tintColor: theme.colors.white,
290
290
  } as ImageStyle,
291
291
  });
292
292
  }
@@ -295,25 +295,25 @@ function createSmallOutlineStyles(theme: Theme): IStyles {
295
295
  const commonStyles = createThemedStyles(theme);
296
296
  return StyleSheet.create({
297
297
  button: {
298
- padding: CommonSizes.spacing.md,
298
+ padding: Spacing.medium,
299
299
  alignItems: 'center',
300
300
  justifyContent: 'center',
301
- borderRadius: CommonSizes.borderRadius.xl,
301
+ borderRadius: BorderRadius.extraLarge,
302
302
  flexDirection: 'row',
303
303
  backgroundColor: 'transparent',
304
304
  width: 175,
305
- borderColor: theme.colors.PlatinateBlue_700,
305
+ borderColor: theme.colors.indigoBlue,
306
306
  borderWidth: 1,
307
307
  } as ViewStyle,
308
308
  label: {
309
309
  ...commonStyles.normalText,
310
- color: theme.colors.PlatinateBlue_700,
310
+ color: theme.colors.indigoBlue,
311
311
  } as TextStyle,
312
312
  icon: {
313
313
  width: 22,
314
314
  height: 22,
315
315
  resizeMode: 'contain',
316
- tintColor: theme.colors.PlatinateBlue_700,
316
+ tintColor: theme.colors.indigoBlue,
317
317
  } as ImageStyle,
318
318
  });
319
319
  }