@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.
- package/package.json +1 -1
- package/template/App.tsx +28 -19
- package/template/ios/reactnativemagic/AppDelegate.mm +5 -0
- package/template/src/common/components/Background.tsx +6 -4
- package/template/src/common/components/Container.tsx +6 -9
- package/template/src/common/components/OTPInput.tsx +3 -2
- package/template/src/common/components/PrimaryButton.tsx +23 -23
- package/template/src/common/components/PrimaryTextInput.tsx +189 -199
- package/template/src/common/components/RadioIcon.tsx +4 -4
- package/template/src/common/components/SafeText.tsx +41 -0
- package/template/src/common/components/SearchBar.tsx +19 -17
- package/template/src/common/components/TryAgain.tsx +3 -3
- package/template/src/common/localization/LocalizationProvider.tsx +14 -17
- package/template/src/common/localization/RTLInitializer.tsx +90 -0
- package/template/src/common/localization/localization.ts +8 -0
- package/template/src/common/localization/translations/commonLocalization.ts +33 -6
- package/template/src/common/localization/translations/emptyLocalization.ts +6 -2
- package/template/src/common/localization/translations/errorsLocalization.ts +33 -13
- package/template/src/common/localization/translations/homeLocalization.ts +6 -2
- package/template/src/common/localization/translations/loginLocalization.ts +32 -9
- package/template/src/common/localization/translations/mainNavigationLocalization.ts +30 -0
- package/template/src/common/localization/translations/navigationLocalization.ts +48 -0
- package/template/src/common/localization/translations/onboardingLocalization.ts +40 -9
- package/template/src/common/localization/translations/otpLocalization.ts +28 -0
- package/template/src/common/localization/translations/pagesLocalization.ts +13 -1
- package/template/src/common/localization/translations/passwordLocalization.ts +54 -0
- package/template/src/common/localization/translations/profileLocalization.ts +4 -4
- package/template/src/common/utils/FeesCaalculation.tsx +37 -0
- package/template/src/common/utils/index.tsx +11 -0
- package/template/src/common/utils/printData.tsx +161 -0
- package/template/src/common/validations/errorValidations.ts +3 -2
- package/template/src/core/api/serverHeaders.ts +62 -1
- package/template/src/core/store/Categories/categoryActions.ts +33 -0
- package/template/src/core/store/Categories/categorySlice.ts +75 -0
- package/template/src/core/store/Categories/categoryState.ts +41 -0
- package/template/src/core/store/Providers/providersActions.ts +102 -0
- package/template/src/core/store/Providers/providersSlice.ts +136 -0
- package/template/src/core/store/Providers/providersState.ts +37 -0
- package/template/src/core/store/Services/servicesActions.ts +191 -0
- package/template/src/core/store/Services/servicesSlice.ts +205 -0
- package/template/src/core/store/Services/servicesState.ts +466 -0
- package/template/src/core/store/app/appSlice.ts +13 -5
- package/template/src/core/store/app/appState.ts +10 -2
- package/template/src/core/store/rootReducer.ts +6 -1
- package/template/src/core/store/store.tsx +55 -2
- package/template/src/core/store/user/userActions.ts +164 -26
- package/template/src/core/store/user/userSlice.ts +193 -21
- package/template/src/core/store/user/userState.ts +148 -25
- package/template/src/core/theme/colors.ts +12 -0
- package/template/src/core/theme/themes.ts +1 -1
- package/template/src/core/utils/stringUtils.ts +114 -0
- package/template/src/navigation/AuthStack.tsx +8 -0
- package/template/src/navigation/HeaderComponents.tsx +52 -1
- package/template/src/navigation/MainNavigation.tsx +3 -1
- package/template/src/navigation/MainStack.tsx +39 -56
- package/template/src/navigation/TabBar.tsx +111 -59
- package/template/src/navigation/types.ts +24 -0
- package/template/src/screens/Login/Login.tsx +83 -85
- package/template/src/screens/OTP/OTPScreen.tsx +169 -0
- package/template/src/screens/home/Components/PayByCode.tsx +129 -0
- package/template/src/screens/home/HomeScreen.tsx +1 -103
- package/template/src/screens/home/hooks/useHomeData.ts +32 -38
- package/template/src/screens/index.tsx +24 -0
- package/template/src/common/components/Stepper.tsx +0 -153
- package/template/src/common/components/Svg.tsx +0 -25
- package/template/src/common/hooks/useDebounce.ts +0 -17
- package/template/src/common/hooks/usePrevious.ts +0 -11
- package/template/src/common/urls/emailUrl.ts +0 -20
- package/template/src/common/urls/mapUrl.ts +0 -22
- package/template/src/common/utils/listHandlers.ts +0 -30
- package/template/src/common/utils/serializeQueryParams.ts +0 -10
- package/template/src/common/validations/hooks/useDatesError.ts +0 -40
- package/template/src/common/validations/profileValidations.ts +0 -30
- package/template/src/navigation/TopTabBar.tsx +0 -77
- package/template/src/screens/Settings/Settings.tsx +0 -5
- package/template/src/screens/home/components/CarouselSection.tsx +0 -79
- package/template/src/screens/home/components/FeaturedCarousel.tsx +0 -128
- package/template/src/screens/main/Main.tsx +0 -5
- package/template/src/screens/registration/RegistrationScreen.tsx +0 -198
- package/template/src/screens/resetPassword/ForgotPasswordScreen.tsx +0 -129
package/package.json
CHANGED
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 {
|
|
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
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
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.
|
|
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={[
|
|
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 {
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
161
|
+
backgroundColor: theme.colors.mutedLavender30,
|
|
162
162
|
borderColor: outline
|
|
163
|
-
? theme.colors.
|
|
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.
|
|
169
|
+
tintColor: theme.colors.mutedLavender,
|
|
170
170
|
} as ImageStyle,
|
|
171
171
|
label: {
|
|
172
172
|
...styles.label,
|
|
173
|
-
color: theme.colors.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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:
|
|
274
|
+
padding: Spacing.medium,
|
|
275
275
|
alignItems: 'center',
|
|
276
276
|
justifyContent: 'center',
|
|
277
|
-
borderRadius:
|
|
277
|
+
borderRadius: BorderRadius.extraLarge,
|
|
278
278
|
flexDirection: 'row',
|
|
279
|
-
backgroundColor: theme.colors.
|
|
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.
|
|
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:
|
|
298
|
+
padding: Spacing.medium,
|
|
299
299
|
alignItems: 'center',
|
|
300
300
|
justifyContent: 'center',
|
|
301
|
-
borderRadius:
|
|
301
|
+
borderRadius: BorderRadius.extraLarge,
|
|
302
302
|
flexDirection: 'row',
|
|
303
303
|
backgroundColor: 'transparent',
|
|
304
304
|
width: 175,
|
|
305
|
-
borderColor: theme.colors.
|
|
305
|
+
borderColor: theme.colors.indigoBlue,
|
|
306
306
|
borderWidth: 1,
|
|
307
307
|
} as ViewStyle,
|
|
308
308
|
label: {
|
|
309
309
|
...commonStyles.normalText,
|
|
310
|
-
color: theme.colors.
|
|
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.
|
|
316
|
+
tintColor: theme.colors.indigoBlue,
|
|
317
317
|
} as ImageStyle,
|
|
318
318
|
});
|
|
319
319
|
}
|