@fadyshawky/react-native-magic 2.0.4 → 2.0.6

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 (80) hide show
  1. package/package.json +1 -1
  2. package/template/App.tsx +28 -19
  3. package/template/ios/reactnativemagic/AppDelegate.mm +5 -0
  4. package/template/src/common/components/Background.tsx +6 -4
  5. package/template/src/common/components/Container.tsx +6 -9
  6. package/template/src/common/components/OTPInput.tsx +3 -2
  7. package/template/src/common/components/PrimaryButton.tsx +23 -23
  8. package/template/src/common/components/PrimaryTextInput.tsx +189 -199
  9. package/template/src/common/components/RadioIcon.tsx +4 -4
  10. package/template/src/common/components/SafeText.tsx +41 -0
  11. package/template/src/common/components/SearchBar.tsx +19 -17
  12. package/template/src/common/components/TryAgain.tsx +3 -3
  13. package/template/src/common/localization/LocalizationProvider.tsx +14 -17
  14. package/template/src/common/localization/RTLInitializer.tsx +90 -0
  15. package/template/src/common/localization/localization.ts +8 -0
  16. package/template/src/common/localization/translations/commonLocalization.ts +33 -6
  17. package/template/src/common/localization/translations/emptyLocalization.ts +6 -2
  18. package/template/src/common/localization/translations/errorsLocalization.ts +33 -13
  19. package/template/src/common/localization/translations/homeLocalization.ts +6 -2
  20. package/template/src/common/localization/translations/loginLocalization.ts +32 -9
  21. package/template/src/common/localization/translations/mainNavigationLocalization.ts +30 -0
  22. package/template/src/common/localization/translations/navigationLocalization.ts +48 -0
  23. package/template/src/common/localization/translations/onboardingLocalization.ts +40 -9
  24. package/template/src/common/localization/translations/otpLocalization.ts +28 -0
  25. package/template/src/common/localization/translations/pagesLocalization.ts +13 -1
  26. package/template/src/common/localization/translations/passwordLocalization.ts +54 -0
  27. package/template/src/common/localization/translations/profileLocalization.ts +4 -4
  28. package/template/src/common/utils/FeesCaalculation.tsx +37 -0
  29. package/template/src/common/utils/index.tsx +11 -0
  30. package/template/src/common/utils/printData.tsx +161 -0
  31. package/template/src/common/validations/errorValidations.ts +3 -2
  32. package/template/src/core/api/serverHeaders.ts +62 -1
  33. package/template/src/core/store/Categories/categoryActions.ts +33 -0
  34. package/template/src/core/store/Categories/categorySlice.ts +75 -0
  35. package/template/src/core/store/Categories/categoryState.ts +41 -0
  36. package/template/src/core/store/Providers/providersActions.ts +102 -0
  37. package/template/src/core/store/Providers/providersSlice.ts +136 -0
  38. package/template/src/core/store/Providers/providersState.ts +37 -0
  39. package/template/src/core/store/Services/servicesActions.ts +191 -0
  40. package/template/src/core/store/Services/servicesSlice.ts +205 -0
  41. package/template/src/core/store/Services/servicesState.ts +466 -0
  42. package/template/src/core/store/app/appSlice.ts +13 -5
  43. package/template/src/core/store/app/appState.ts +10 -2
  44. package/template/src/core/store/rootReducer.ts +6 -1
  45. package/template/src/core/store/store.tsx +55 -2
  46. package/template/src/core/store/user/userActions.ts +164 -26
  47. package/template/src/core/store/user/userSlice.ts +193 -21
  48. package/template/src/core/store/user/userState.ts +148 -25
  49. package/template/src/core/theme/colors.ts +12 -0
  50. package/template/src/core/theme/themes.ts +1 -1
  51. package/template/src/core/utils/stringUtils.ts +114 -0
  52. package/template/src/navigation/AuthStack.tsx +8 -0
  53. package/template/src/navigation/HeaderComponents.tsx +52 -1
  54. package/template/src/navigation/MainNavigation.tsx +3 -1
  55. package/template/src/navigation/MainStack.tsx +39 -56
  56. package/template/src/navigation/TabBar.tsx +111 -59
  57. package/template/src/navigation/types.ts +24 -0
  58. package/template/src/screens/Login/Login.tsx +83 -85
  59. package/template/src/screens/OTP/OTPScreen.tsx +169 -0
  60. package/template/src/screens/home/Components/PayByCode.tsx +129 -0
  61. package/template/src/screens/home/HomeScreen.tsx +1 -103
  62. package/template/src/screens/home/hooks/useHomeData.ts +32 -38
  63. package/template/src/screens/index.tsx +24 -0
  64. package/template/src/common/components/Stepper.tsx +0 -153
  65. package/template/src/common/components/Svg.tsx +0 -25
  66. package/template/src/common/hooks/useDebounce.ts +0 -17
  67. package/template/src/common/hooks/usePrevious.ts +0 -11
  68. package/template/src/common/urls/emailUrl.ts +0 -20
  69. package/template/src/common/urls/mapUrl.ts +0 -22
  70. package/template/src/common/utils/listHandlers.ts +0 -30
  71. package/template/src/common/utils/serializeQueryParams.ts +0 -10
  72. package/template/src/common/validations/hooks/useDatesError.ts +0 -40
  73. package/template/src/common/validations/profileValidations.ts +0 -30
  74. package/template/src/navigation/TopTabBar.tsx +0 -77
  75. package/template/src/screens/Settings/Settings.tsx +0 -5
  76. package/template/src/screens/home/components/CarouselSection.tsx +0 -79
  77. package/template/src/screens/home/components/FeaturedCarousel.tsx +0 -128
  78. package/template/src/screens/main/Main.tsx +0 -5
  79. package/template/src/screens/registration/RegistrationScreen.tsx +0 -198
  80. 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.6",
4
4
  "description": "react native template with ready components, hooks, react navigation, redux, typescript, etc.",
5
5
  "keywords": [
6
6
  "react-native-magic",
package/template/App.tsx CHANGED
@@ -4,33 +4,44 @@
4
4
  *
5
5
  * @format
6
6
  */
7
- import React from 'react';
8
- import {LogBox, SafeAreaView, StatusBar} from 'react-native';
7
+ import React, {useEffect} from 'react';
8
+ import {ImageBackground, LogBox, SafeAreaView, StatusBar} from 'react-native';
9
9
  import {SheetProvider} from 'react-native-actions-sheet';
10
10
  import {SafeAreaProvider} from 'react-native-safe-area-context';
11
11
  import {Provider} from 'react-redux';
12
12
  import {PersistGate} from 'redux-persist/integration/react';
13
13
  import {LocalizationProvider} from './src/common/localization/LocalizationProvider';
14
- import {DEFAULT_LANGUAGE} from './src/common/localization/localization';
14
+ import {RTLInitializer} from './src/common/localization/RTLInitializer';
15
+ import {
16
+ Languages,
17
+ DEFAULT_LANGUAGE,
18
+ } from './src/common/localization/localization';
15
19
  import {persistor, store} from './src/core/store/store';
16
- import {ThemeProvider, useTheme} from './src/core/theme/ThemeProvider';
17
20
  import AppNavigator from './src/navigation/MainNavigation';
21
+ import {ThemeProvider, useTheme} from './src/core/theme/ThemeProvider';
22
+ import {useAppSelector} from './src/core/store/reduxHelpers';
18
23
 
19
24
  LogBox.ignoreAllLogs();
20
25
 
21
26
  const ThemedApp = () => {
22
27
  const {theme} = useTheme();
28
+ const {language} = useAppSelector(state => state.app);
29
+
23
30
  return (
24
- <SafeAreaProvider>
25
- <SafeAreaView style={{position: 'absolute'}} />
26
- <StatusBar
27
- barStyle={theme.mode === 'dark' ? 'light-content' : 'dark-content'}
28
- backgroundColor={theme.colors.background}
29
- />
30
- <SheetProvider>
31
- <AppNavigator />
32
- </SheetProvider>
33
- </SafeAreaProvider>
31
+ <RTLInitializer>
32
+ <LocalizationProvider initialLanguage={language}>
33
+ <SafeAreaProvider>
34
+ <SafeAreaView style={{position: 'absolute'}} />
35
+ <StatusBar
36
+ barStyle={theme.mode === 'dark' ? 'light-content' : 'dark-content'}
37
+ backgroundColor={theme.colors.background_2}
38
+ />
39
+ <SheetProvider>
40
+ <AppNavigator />
41
+ </SheetProvider>
42
+ </SafeAreaProvider>
43
+ </LocalizationProvider>
44
+ </RTLInitializer>
34
45
  );
35
46
  };
36
47
 
@@ -38,11 +49,9 @@ function App(): React.JSX.Element {
38
49
  return (
39
50
  <Provider store={store}>
40
51
  <PersistGate loading={null} persistor={persistor}>
41
- <LocalizationProvider initialLanguage={DEFAULT_LANGUAGE}>
42
- <ThemeProvider initialTheme="dark">
43
- <ThemedApp />
44
- </ThemeProvider>
45
- </LocalizationProvider>
52
+ <ThemeProvider initialTheme="dark">
53
+ <ThemedApp />
54
+ </ThemeProvider>
46
55
  </PersistGate>
47
56
  </Provider>
48
57
  );
@@ -1,11 +1,16 @@
1
1
  #import "AppDelegate.h"
2
2
 
3
3
  #import <React/RCTBundleURLProvider.h>
4
+ #import <React/RCTI18nUtil.h>
4
5
 
5
6
  @implementation AppDelegate
6
7
 
7
8
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8
9
  {
10
+
11
+ [[RCTI18nUtil sharedInstance] allowRTL:YES];
12
+ [[RCTI18nUtil sharedInstance] forceRTL:YES];
13
+
9
14
  self.moduleName = @"reactnativemagic";
10
15
  // You can add your custom initial props in the dictionary below.
11
16
  // They will be passed down to the ViewController used by React Native.
@@ -1,9 +1,8 @@
1
1
  import React, {FC, memo} from 'react';
2
2
  import {ImageBackground, StyleSheet, View, ViewStyle} from 'react-native';
3
+ import {KeyboardAwareScrollViewProps} from 'react-native-keyboard-aware-scroll-view';
3
4
  import {useTheme} from '../../core/theme/ThemeProvider';
4
- import {ImageResources} from '../ImageResources.g';
5
5
  import {Container} from './Container';
6
- import {KeyboardAwareScrollViewProps} from 'react-native-keyboard-aware-scroll-view';
7
6
 
8
7
  interface BackgroundProps
9
8
  extends Omit<KeyboardAwareScrollViewProps, 'contentContainerStyle'> {
@@ -46,7 +45,7 @@ export const Background: FC<BackgroundProps> = memo(
46
45
  <View
47
46
  style={[
48
47
  styles.container,
49
- {backgroundColor: theme.colors.background},
48
+ {backgroundColor: theme.colors.background_2},
50
49
  ]}>
51
50
  {content}
52
51
  </View>
@@ -55,7 +54,10 @@ export const Background: FC<BackgroundProps> = memo(
55
54
 
56
55
  return (
57
56
  <View
58
- style={[styles.container, {backgroundColor: theme.colors.background}]}>
57
+ style={[
58
+ styles.container,
59
+ {backgroundColor: theme.colors.background_2},
60
+ ]}>
59
61
  <ImageBackground source={0} style={styles.container}>
60
62
  {content}
61
63
  </ImageBackground>
@@ -1,21 +1,18 @@
1
1
  import React, {forwardRef} from 'react';
2
2
  import {
3
- StyleSheet,
4
- ViewStyle,
5
- Platform,
6
- KeyboardAvoidingView,
7
- ScrollView,
8
- View,
9
3
  ImageBackground,
10
4
  ImageSourcePropType,
5
+ KeyboardAvoidingView,
6
+ StyleSheet,
7
+ View,
8
+ ViewStyle,
11
9
  } from 'react-native';
12
10
  import {
13
11
  KeyboardAwareScrollView,
14
12
  KeyboardAwareScrollViewProps,
15
13
  } from 'react-native-keyboard-aware-scroll-view';
16
- import {useTheme} from '../../core/theme/ThemeProvider';
17
14
  import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
18
- import {ImageResources} from '../ImageResources.g';
15
+ import {useTheme} from '../../core/theme/ThemeProvider';
19
16
 
20
17
  interface ContainerProps extends Partial<KeyboardAwareScrollViewProps> {
21
18
  children: React.ReactNode;
@@ -50,7 +47,7 @@ export const Container = forwardRef<KeyboardAwareScrollView, ContainerProps>(
50
47
  const {theme} = useTheme();
51
48
  const insets = useSafeAreaInsets();
52
49
  const Wrapper = useSafeArea ? SafeAreaView : View;
53
- const bgColor = backgroundColor || theme.colors.background;
50
+ const bgColor = backgroundColor || theme.colors.background_2;
54
51
 
55
52
  const content = (
56
53
  <Wrapper
@@ -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
  }