@fadyshawky/react-native-magic 1.0.9 → 2.0.1
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 +4 -7
- package/template/package-lock.json +11 -0
- package/template/package.json +1 -0
- package/template/src/common/components/Cards.tsx +5 -5
- package/template/src/common/components/EmptyView.tsx +1 -1
- package/template/src/common/components/ImageCropPickerButton.tsx +1 -1
- package/template/src/common/components/OTPInput.tsx +5 -5
- package/template/src/common/components/PhotoTakingButton.tsx +2 -2
- package/template/src/common/components/PrimaryButton.tsx +5 -5
- package/template/src/common/components/PrimaryTextInput.tsx +12 -12
- package/template/src/common/components/RadioButton.tsx +2 -2
- package/template/src/common/components/RadioIcon.tsx +4 -4
- package/template/src/common/components/SearchBar.tsx +7 -7
- package/template/src/common/components/Separator.tsx +1 -1
- package/template/src/common/components/TryAgain.tsx +1 -1
- package/template/src/common/helpers/defaultKeyIdExtractor.ts +1 -1
- package/template/src/common/helpers/stringsHelpers.ts +4 -0
- package/template/src/common/validations/errorValidations.ts +2 -3
- package/template/src/core/api/errorHandler.ts +2 -1
- package/template/src/core/store/app/appSlice.ts +13 -5
- package/template/src/core/store/app/appState.ts +10 -2
- package/template/src/core/theme/commonConsts.ts +1 -1
- package/template/src/core/theme/commonSizes.ts +17 -27
- package/template/src/core/theme/types.ts +59 -0
- package/template/src/navigation/AuthStack.tsx +0 -8
- package/template/src/navigation/HeaderComponents.tsx +1 -1
- package/template/src/screens/Login/Login.tsx +3 -3
- package/template/src/screens/home/HomeScreen.tsx +8 -8
- package/template/src/screens/home/components/CarouselSection.tsx +6 -6
- package/template/src/screens/home/components/FeaturedCarousel.tsx +5 -5
- package/template/src/screens/registration/RegistrationScreen.tsx +3 -3
- package/template/src/screens/resetPassword/ForgotPasswordScreen.tsx +3 -3
- package/template/install-dev.sh +0 -1
- package/template/install.sh +0 -1
- package/template/src/common/helpers/shareHelpers.ts +0 -47
- package/template/src/types/react-native-config.d.ts +0 -8
package/package.json
CHANGED
package/template/App.tsx
CHANGED
|
@@ -4,20 +4,17 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @format
|
|
6
6
|
*/
|
|
7
|
-
import React
|
|
8
|
-
import {
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import {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 {
|
|
15
|
-
Languages,
|
|
16
|
-
DEFAULT_LANGUAGE,
|
|
17
|
-
} from './src/common/localization/localization';
|
|
14
|
+
import {DEFAULT_LANGUAGE} from './src/common/localization/localization';
|
|
18
15
|
import {persistor, store} from './src/core/store/store';
|
|
19
|
-
import AppNavigator from './src/navigation/MainNavigation';
|
|
20
16
|
import {ThemeProvider, useTheme} from './src/core/theme/ThemeProvider';
|
|
17
|
+
import AppNavigator from './src/navigation/MainNavigation';
|
|
21
18
|
|
|
22
19
|
LogBox.ignoreAllLogs();
|
|
23
20
|
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"react-native-permissions": "^5.2.1",
|
|
57
57
|
"react-native-reanimated": "^3.16.6",
|
|
58
58
|
"react-native-reanimated-carousel": "^3.5.1",
|
|
59
|
+
"react-native-restart": "^0.0.27",
|
|
59
60
|
"react-native-safe-area-context": "^5.0.0",
|
|
60
61
|
"react-native-screens": "^4.4.0",
|
|
61
62
|
"react-native-sfsymbols": "^1.2.2",
|
|
@@ -13217,6 +13218,16 @@
|
|
|
13217
13218
|
"react-native-reanimated": ">=3.0.0"
|
|
13218
13219
|
}
|
|
13219
13220
|
},
|
|
13221
|
+
"node_modules/react-native-restart": {
|
|
13222
|
+
"version": "0.0.27",
|
|
13223
|
+
"resolved": "https://registry.npmjs.org/react-native-restart/-/react-native-restart-0.0.27.tgz",
|
|
13224
|
+
"integrity": "sha512-8KScVICrXwcTSJ1rjWkqVTHyEKQIttm5AIMGSK1QG1+RS5owYlE4z/1DykOTdWfVl9l16FIk0w9Xzk9ZO6jxlA==",
|
|
13225
|
+
"license": "MIT",
|
|
13226
|
+
"peerDependencies": {
|
|
13227
|
+
"react": "*",
|
|
13228
|
+
"react-native": "*"
|
|
13229
|
+
}
|
|
13230
|
+
},
|
|
13220
13231
|
"node_modules/react-native-safe-area-context": {
|
|
13221
13232
|
"version": "5.0.0",
|
|
13222
13233
|
"resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.0.0.tgz",
|
package/template/package.json
CHANGED
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"react-native-permissions": "^5.2.1",
|
|
68
68
|
"react-native-reanimated": "^3.16.6",
|
|
69
69
|
"react-native-reanimated-carousel": "^3.5.1",
|
|
70
|
+
"react-native-restart": "^0.0.27",
|
|
70
71
|
"react-native-safe-area-context": "^5.0.0",
|
|
71
72
|
"react-native-screens": "^4.4.0",
|
|
72
73
|
"react-native-sfsymbols": "^1.2.2",
|
|
@@ -61,8 +61,8 @@ export const Card = ({
|
|
|
61
61
|
|
|
62
62
|
const styles = StyleSheet.create({
|
|
63
63
|
card: {
|
|
64
|
-
padding: CommonSizes.spacing.
|
|
65
|
-
borderRadius: CommonSizes.borderRadius.
|
|
64
|
+
padding: CommonSizes.spacing.md,
|
|
65
|
+
borderRadius: CommonSizes.borderRadius.lg,
|
|
66
66
|
alignItems: 'center',
|
|
67
67
|
justifyContent: 'flex-start',
|
|
68
68
|
gap: scaleHeight(10),
|
|
@@ -71,7 +71,7 @@ const styles = StyleSheet.create({
|
|
|
71
71
|
},
|
|
72
72
|
blurContainer: {
|
|
73
73
|
flex: 1,
|
|
74
|
-
padding: CommonSizes.spacing.
|
|
74
|
+
padding: CommonSizes.spacing.md,
|
|
75
75
|
alignItems: 'center',
|
|
76
76
|
justifyContent: 'center',
|
|
77
77
|
},
|
|
@@ -80,9 +80,9 @@ const styles = StyleSheet.create({
|
|
|
80
80
|
height: scaleHeight(100),
|
|
81
81
|
},
|
|
82
82
|
title: {
|
|
83
|
-
fontSize: CommonSizes.
|
|
83
|
+
fontSize: CommonSizes.font.medium,
|
|
84
84
|
textAlign: 'center',
|
|
85
|
-
marginBottom: CommonSizes.spacing.
|
|
85
|
+
marginBottom: CommonSizes.spacing.sm,
|
|
86
86
|
},
|
|
87
87
|
dotsContainer: {
|
|
88
88
|
flexDirection: 'row',
|
|
@@ -22,7 +22,7 @@ const styles = StyleSheet.create({
|
|
|
22
22
|
...CommonStyles.normalText,
|
|
23
23
|
fontWeight: '600',
|
|
24
24
|
textAlign: 'center',
|
|
25
|
-
marginBottom: CommonSizes.spacing.
|
|
25
|
+
marginBottom: CommonSizes.spacing.xs,
|
|
26
26
|
} as TextStyle,
|
|
27
27
|
description: {
|
|
28
28
|
...CommonStyles.normalText,
|
|
@@ -61,7 +61,7 @@ export const OTPInput: React.FC<OTPInputProps> = ({
|
|
|
61
61
|
<RTLAwareView style={{...styles.container, ...style}}>
|
|
62
62
|
{[0, 1, 2, 3, 4, 5].map(index => (
|
|
63
63
|
<PrimaryTextInput
|
|
64
|
-
|
|
64
|
+
containerStyle={{width: scaleWidth(78)}}
|
|
65
65
|
key={index}
|
|
66
66
|
inputRef={ref => (inputRefs.current[index] = ref)}
|
|
67
67
|
style={[
|
|
@@ -94,14 +94,14 @@ const styles = StyleSheet.create({
|
|
|
94
94
|
flexDirection: 'row',
|
|
95
95
|
justifyContent: 'space-between',
|
|
96
96
|
width: '100%',
|
|
97
|
-
gap: CommonSizes.spacing.
|
|
98
|
-
paddingHorizontal: CommonSizes.spacing.
|
|
97
|
+
gap: CommonSizes.spacing.sm,
|
|
98
|
+
paddingHorizontal: CommonSizes.spacing.lg,
|
|
99
99
|
},
|
|
100
100
|
input: {
|
|
101
101
|
flex: 1,
|
|
102
|
-
height: CommonSizes.spacing.
|
|
102
|
+
height: CommonSizes.spacing.xl,
|
|
103
103
|
borderWidth: 1,
|
|
104
|
-
borderRadius: CommonSizes.borderRadius.
|
|
104
|
+
borderRadius: CommonSizes.borderRadius.md,
|
|
105
105
|
textAlign: 'center',
|
|
106
106
|
},
|
|
107
107
|
});
|
|
@@ -73,7 +73,7 @@ const styles = StyleSheet.create({
|
|
|
73
73
|
width: 120,
|
|
74
74
|
alignItems: 'center',
|
|
75
75
|
justifyContent: 'center',
|
|
76
|
-
borderRadius: CommonSizes.borderRadius.
|
|
76
|
+
borderRadius: CommonSizes.borderRadius.sm,
|
|
77
77
|
borderWidth: 1,
|
|
78
78
|
} as ViewStyle,
|
|
79
79
|
image: {
|
|
@@ -82,7 +82,7 @@ const styles = StyleSheet.create({
|
|
|
82
82
|
resizeMode: 'contain',
|
|
83
83
|
alignItems: 'center',
|
|
84
84
|
justifyContent: 'center',
|
|
85
|
-
borderRadius: CommonSizes.borderRadius.
|
|
85
|
+
borderRadius: CommonSizes.borderRadius.sm,
|
|
86
86
|
overflow: 'hidden',
|
|
87
87
|
} as ImageStyle,
|
|
88
88
|
icon: {
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
TouchablePlatformProps,
|
|
18
18
|
} from '../../../types';
|
|
19
19
|
import {useTheme} from '../../core/theme/ThemeProvider';
|
|
20
|
-
import {
|
|
20
|
+
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
21
21
|
import {createThemedStyles} from '../../core/theme/commonStyles';
|
|
22
22
|
import {Theme} from '../../core/theme/types';
|
|
23
23
|
import {IconPlatform} from './IconPlatform';
|
|
@@ -271,10 +271,10 @@ function createSmallSolidStyles(theme: Theme): IStyles {
|
|
|
271
271
|
const commonStyles = createThemedStyles(theme);
|
|
272
272
|
return StyleSheet.create({
|
|
273
273
|
button: {
|
|
274
|
-
padding:
|
|
274
|
+
padding: CommonSizes.spacing.md,
|
|
275
275
|
alignItems: 'center',
|
|
276
276
|
justifyContent: 'center',
|
|
277
|
-
borderRadius:
|
|
277
|
+
borderRadius: CommonSizes.borderRadius.xl,
|
|
278
278
|
flexDirection: 'row',
|
|
279
279
|
backgroundColor: theme.colors.indigoBlue,
|
|
280
280
|
// width: 175,
|
|
@@ -295,10 +295,10 @@ function createSmallOutlineStyles(theme: Theme): IStyles {
|
|
|
295
295
|
const commonStyles = createThemedStyles(theme);
|
|
296
296
|
return StyleSheet.create({
|
|
297
297
|
button: {
|
|
298
|
-
padding:
|
|
298
|
+
padding: CommonSizes.spacing.md,
|
|
299
299
|
alignItems: 'center',
|
|
300
300
|
justifyContent: 'center',
|
|
301
|
-
borderRadius:
|
|
301
|
+
borderRadius: CommonSizes.borderRadius.xl,
|
|
302
302
|
flexDirection: 'row',
|
|
303
303
|
backgroundColor: 'transparent',
|
|
304
304
|
width: 175,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
View,
|
|
22
22
|
ViewStyle,
|
|
23
23
|
} from 'react-native';
|
|
24
|
-
import {Colors
|
|
24
|
+
import {Colors} from '../../core/theme/colors';
|
|
25
25
|
import {isIos} from '../../core/theme/commonConsts';
|
|
26
26
|
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
27
27
|
import {CommonStyles} from '../../core/theme/commonStyles';
|
|
@@ -59,7 +59,7 @@ export const PrimaryTextInput: FC<IProps> = memo(
|
|
|
59
59
|
blurOnSubmit = true,
|
|
60
60
|
disableFullscreenUI = true,
|
|
61
61
|
enablesReturnKeyAutomatically = true,
|
|
62
|
-
underlineColorAndroid = Colors.
|
|
62
|
+
underlineColorAndroid = Colors.white,
|
|
63
63
|
placeholderTextColor = Colors.gray,
|
|
64
64
|
editable = true,
|
|
65
65
|
clearButtonMode = 'while-editing',
|
|
@@ -192,17 +192,17 @@ function getInputContainerStyle(
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
const selectionColor =
|
|
195
|
+
const selectionColor = Colors.blueNormalActive;
|
|
196
196
|
|
|
197
197
|
const commonInputContainer: TextStyle = {
|
|
198
198
|
flexDirection: 'row',
|
|
199
199
|
alignItems: 'center',
|
|
200
200
|
justifyContent: 'center',
|
|
201
|
-
minHeight: CommonSizes.spacing.
|
|
201
|
+
minHeight: CommonSizes.spacing.xl,
|
|
202
202
|
textAlignVertical: 'center',
|
|
203
203
|
textAlign: 'center',
|
|
204
204
|
backgroundColor: Colors.white,
|
|
205
|
-
borderRadius: CommonSizes.borderRadius.
|
|
205
|
+
borderRadius: CommonSizes.borderRadius.md,
|
|
206
206
|
borderWidth: CommonSizes.borderWidth.small,
|
|
207
207
|
borderColor: Colors.gray,
|
|
208
208
|
};
|
|
@@ -215,10 +215,10 @@ const styles = StyleSheet.create({
|
|
|
215
215
|
...CommonStyles.normalText,
|
|
216
216
|
flex: 1,
|
|
217
217
|
textAlignVertical: 'center',
|
|
218
|
-
paddingStart: CommonSizes.spacing.
|
|
218
|
+
paddingStart: CommonSizes.spacing.md,
|
|
219
219
|
...Platform.select({
|
|
220
220
|
android: {
|
|
221
|
-
paddingEnd: CommonSizes.spacing.
|
|
221
|
+
paddingEnd: CommonSizes.spacing.md,
|
|
222
222
|
},
|
|
223
223
|
}),
|
|
224
224
|
} as TextStyle,
|
|
@@ -226,7 +226,7 @@ const styles = StyleSheet.create({
|
|
|
226
226
|
...commonInputContainer,
|
|
227
227
|
...Platform.select({
|
|
228
228
|
ios: {
|
|
229
|
-
paddingEnd: CommonSizes.spacing.
|
|
229
|
+
paddingEnd: CommonSizes.spacing.md,
|
|
230
230
|
},
|
|
231
231
|
}),
|
|
232
232
|
} as TextStyle,
|
|
@@ -251,26 +251,26 @@ const styles = StyleSheet.create({
|
|
|
251
251
|
...commonInputContainer,
|
|
252
252
|
...Platform.select({
|
|
253
253
|
android: {
|
|
254
|
-
borderColor: Colors.
|
|
254
|
+
borderColor: Colors.gray,
|
|
255
255
|
},
|
|
256
256
|
}),
|
|
257
257
|
} as TextStyle,
|
|
258
258
|
label: {
|
|
259
259
|
...CommonStyles.body_regular,
|
|
260
|
-
paddingBottom: CommonSizes.spacing.
|
|
260
|
+
paddingBottom: CommonSizes.spacing.xs,
|
|
261
261
|
} as TextStyle,
|
|
262
262
|
hint: {
|
|
263
263
|
...CommonStyles.normalText,
|
|
264
264
|
fontWeight: '200',
|
|
265
265
|
fontSize: CommonSizes.font.small,
|
|
266
266
|
lineHeight: CommonSizes.lineHeight.small,
|
|
267
|
-
paddingTop: CommonSizes.spacing.
|
|
267
|
+
paddingTop: CommonSizes.spacing.xs,
|
|
268
268
|
} as TextStyle,
|
|
269
269
|
error: {
|
|
270
270
|
...CommonStyles.normalText,
|
|
271
271
|
color: Colors.red,
|
|
272
272
|
fontSize: CommonSizes.font.small,
|
|
273
273
|
lineHeight: CommonSizes.lineHeight.small,
|
|
274
|
-
paddingTop: CommonSizes.spacing.
|
|
274
|
+
paddingTop: CommonSizes.spacing.xs,
|
|
275
275
|
} as TextStyle,
|
|
276
276
|
});
|
|
@@ -46,13 +46,13 @@ export const RadioButton: FC<IProps> = memo(
|
|
|
46
46
|
const commonLabel: TextStyle = {
|
|
47
47
|
...CommonStyles.normalText,
|
|
48
48
|
flex: 1,
|
|
49
|
-
paddingStart: CommonSizes.spacing.
|
|
49
|
+
paddingStart: CommonSizes.spacing.xs,
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const styles = StyleSheet.create({
|
|
53
53
|
container: {
|
|
54
54
|
flexDirection: 'row',
|
|
55
|
-
padding: CommonSizes.spacing.
|
|
55
|
+
padding: CommonSizes.spacing.md,
|
|
56
56
|
alignItems: 'center',
|
|
57
57
|
} as ViewStyle,
|
|
58
58
|
label: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {FC, memo, useMemo} from 'react';
|
|
2
2
|
import {StyleSheet, View, ViewStyle} from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import {Colors} from '../../core/theme/colors';
|
|
4
4
|
|
|
5
5
|
interface IProps {
|
|
6
6
|
isSelected: boolean;
|
|
@@ -41,14 +41,14 @@ const commonInnerCircle: ViewStyle = {
|
|
|
41
41
|
const styles = StyleSheet.create({
|
|
42
42
|
outerCircle: {
|
|
43
43
|
...commonOuterCircle,
|
|
44
|
-
borderColor:
|
|
44
|
+
borderColor: Colors.blueNormalActive,
|
|
45
45
|
} as ViewStyle,
|
|
46
46
|
outerCircleSelected: {
|
|
47
47
|
...commonOuterCircle,
|
|
48
|
-
borderColor:
|
|
48
|
+
borderColor: Colors.blueNormalActive,
|
|
49
49
|
} as ViewStyle,
|
|
50
50
|
innerCircle: {
|
|
51
51
|
...commonInnerCircle,
|
|
52
|
-
backgroundColor:
|
|
52
|
+
backgroundColor: Colors.blueNormalActive,
|
|
53
53
|
} as ViewStyle,
|
|
54
54
|
});
|
|
@@ -161,19 +161,19 @@ const styles = StyleSheet.create({
|
|
|
161
161
|
height: 48,
|
|
162
162
|
borderRadius: 16,
|
|
163
163
|
borderWidth: 1,
|
|
164
|
-
paddingHorizontal: CommonSizes.spacing.
|
|
165
|
-
marginHorizontal: CommonSizes.spacing.
|
|
166
|
-
marginBottom: CommonSizes.spacing.
|
|
164
|
+
paddingHorizontal: CommonSizes.spacing.md,
|
|
165
|
+
marginHorizontal: CommonSizes.spacing.lg,
|
|
166
|
+
marginBottom: CommonSizes.spacing.lg,
|
|
167
167
|
},
|
|
168
168
|
input: {
|
|
169
169
|
flex: 1,
|
|
170
|
-
paddingVertical: CommonSizes.spacing.
|
|
171
|
-
paddingHorizontal: CommonSizes.spacing.
|
|
170
|
+
paddingVertical: CommonSizes.spacing.md,
|
|
171
|
+
paddingHorizontal: CommonSizes.spacing.sm,
|
|
172
172
|
},
|
|
173
173
|
searchIcon: {
|
|
174
|
-
marginHorizontal: CommonSizes.spacing.
|
|
174
|
+
marginHorizontal: CommonSizes.spacing.sm,
|
|
175
175
|
},
|
|
176
176
|
clearButton: {
|
|
177
|
-
padding: CommonSizes.spacing.
|
|
177
|
+
padding: CommonSizes.spacing.sm,
|
|
178
178
|
},
|
|
179
179
|
});
|
|
@@ -23,3 +23,7 @@ export function normalizeAndTrimWhitespace(text: string): string {
|
|
|
23
23
|
?.trimEnd() // Remove trailing whitespace
|
|
24
24
|
?.replace(/\s+/g, ' '); // Replace multiple whitespaces with single space
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
export function ensureString(text: string): string {
|
|
28
|
+
return text != null ? text : '';
|
|
29
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {localization} from '../localization/localization';
|
|
2
1
|
import {unwrapResult} from '@reduxjs/toolkit';
|
|
3
2
|
import {Alert} from 'react-native';
|
|
4
|
-
import {IErrorResult, ErrorRepresentationType} from '../../../types';
|
|
5
3
|
import Snackbar from 'react-native-snackbar';
|
|
6
|
-
import {
|
|
4
|
+
import {ErrorRepresentationType, IErrorResult} from '../../../types';
|
|
5
|
+
import {localization} from '../localization/localization';
|
|
7
6
|
export function handlePromiseResult(
|
|
8
7
|
promiseAction: Promise<any>,
|
|
9
8
|
successMessage?: string,
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* @param error The error caught from an API request
|
|
5
5
|
* @returns A structured error object with message (as string) and details
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import {ensureString} from '../../common/helpers/stringsHelpers';
|
|
8
9
|
|
|
9
10
|
export const extractServerError = (error: any) => {
|
|
10
11
|
let errorObj = {
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import {createSlice} from '@reduxjs/toolkit';
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import {createSlice, PayloadAction} from '@reduxjs/toolkit';
|
|
2
|
+
import {newState} from '../../../common/utils/newState';
|
|
3
|
+
import {Languages} from '../../../common/localization/localization';
|
|
4
|
+
import {appInitialState, AppInitialEntity} from './appState';
|
|
4
5
|
|
|
5
6
|
export const {reducer: AppReducer, actions} = createSlice({
|
|
6
7
|
name: 'app',
|
|
7
8
|
initialState: appInitialState,
|
|
8
|
-
reducers: {
|
|
9
|
+
reducers: {
|
|
10
|
+
setLanguage: (state, action: PayloadAction<Languages>) => {
|
|
11
|
+
return newState(state, {
|
|
12
|
+
language: action.payload,
|
|
13
|
+
isRTL: action.payload === Languages.ar,
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
},
|
|
9
17
|
});
|
|
10
18
|
|
|
11
|
-
export const {} = actions;
|
|
19
|
+
export const {setLanguage} = actions;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import {Languages} from '../../../common/localization/localization';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface AppInitialEntity {
|
|
4
|
+
language?: Languages;
|
|
5
|
+
isRTL?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const appInitialState: AppInitialEntity = {
|
|
9
|
+
language: undefined,
|
|
10
|
+
isRTL: false,
|
|
11
|
+
};
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
StyleSheet,
|
|
10
10
|
} from 'react-native';
|
|
11
11
|
import DeviceInfo from 'react-native-device-info';
|
|
12
|
-
import {createPerfectSize} from '../../common/utils';
|
|
12
|
+
import {createPerfectSize} from '../../common/utils/createPerfectSize';
|
|
13
13
|
|
|
14
14
|
const windowDimensions = Dimensions.get('window');
|
|
15
15
|
export const isIos = Platform.OS == 'ios';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ISize} from '
|
|
1
|
+
import {ISize} from './types';
|
|
2
2
|
|
|
3
3
|
export const CommonSizes = {
|
|
4
4
|
font: {
|
|
@@ -13,7 +13,7 @@ export const CommonSizes = {
|
|
|
13
13
|
largePlus: 28,
|
|
14
14
|
extraLarge: 34,
|
|
15
15
|
extraLargePlus: 44,
|
|
16
|
-
} as Readonly<ISize>,
|
|
16
|
+
} as Readonly<ISize['font']>,
|
|
17
17
|
letterSpacing: {
|
|
18
18
|
extraSmall: 0.07,
|
|
19
19
|
extraSmallPlus: 0,
|
|
@@ -25,7 +25,7 @@ export const CommonSizes = {
|
|
|
25
25
|
largePlus: 0.36,
|
|
26
26
|
extraLarge: 0.37,
|
|
27
27
|
extraLargePlus: 0.37,
|
|
28
|
-
} as Readonly<ISize>,
|
|
28
|
+
} as Readonly<ISize['letterSpacing']>,
|
|
29
29
|
lineHeight: {
|
|
30
30
|
extraSmall: 13,
|
|
31
31
|
extraSmallPlus: 16,
|
|
@@ -37,34 +37,24 @@ export const CommonSizes = {
|
|
|
37
37
|
largePlus: 34,
|
|
38
38
|
extraLarge: 41,
|
|
39
39
|
extraLargePlus: 52,
|
|
40
|
-
} as Readonly<ISize>,
|
|
40
|
+
} as Readonly<ISize['lineHeight']>,
|
|
41
41
|
spacing: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
large: 30,
|
|
49
|
-
largePlus: 40,
|
|
50
|
-
extraLarge: 48,
|
|
51
|
-
extraLargePlus: 56,
|
|
52
|
-
} as Readonly<ISize>,
|
|
42
|
+
xs: 4,
|
|
43
|
+
sm: 8,
|
|
44
|
+
md: 16,
|
|
45
|
+
lg: 24,
|
|
46
|
+
xl: 32,
|
|
47
|
+
} as Readonly<ISize['spacing']>,
|
|
53
48
|
borderRadius: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
large: 14,
|
|
61
|
-
largePlus: 16,
|
|
62
|
-
extraLarge: 18,
|
|
63
|
-
extraLargePlus: 30,
|
|
64
|
-
} as Readonly<ISize>,
|
|
49
|
+
xs: 4,
|
|
50
|
+
sm: 8,
|
|
51
|
+
md: 12,
|
|
52
|
+
lg: 16,
|
|
53
|
+
xl: 24,
|
|
54
|
+
} as Readonly<ISize['borderRadius']>,
|
|
65
55
|
borderWidth: {
|
|
66
56
|
small: 1,
|
|
67
57
|
medium: 2,
|
|
68
58
|
large: 3,
|
|
69
|
-
} as Readonly<ISize>,
|
|
59
|
+
} as Readonly<ISize['borderWidth']>,
|
|
70
60
|
};
|
|
@@ -2,6 +2,65 @@ import {TextStyle} from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
export type ThemeMode = 'light' | 'dark';
|
|
4
4
|
|
|
5
|
+
export interface ISize {
|
|
6
|
+
font: {
|
|
7
|
+
extraSmall: number;
|
|
8
|
+
extraSmallPlus: number;
|
|
9
|
+
small: number;
|
|
10
|
+
smallPlus: number;
|
|
11
|
+
medium: number;
|
|
12
|
+
mediumPlus: number;
|
|
13
|
+
extraMedium: number;
|
|
14
|
+
large: number;
|
|
15
|
+
largePlus: number;
|
|
16
|
+
extraLarge: number;
|
|
17
|
+
extraLargePlus: number;
|
|
18
|
+
};
|
|
19
|
+
letterSpacing: {
|
|
20
|
+
extraSmall: number;
|
|
21
|
+
extraSmallPlus: number;
|
|
22
|
+
small: number;
|
|
23
|
+
smallPlus: number;
|
|
24
|
+
medium: number;
|
|
25
|
+
mediumPlus: number;
|
|
26
|
+
large: number;
|
|
27
|
+
largePlus: number;
|
|
28
|
+
extraLarge: number;
|
|
29
|
+
extraLargePlus: number;
|
|
30
|
+
};
|
|
31
|
+
lineHeight: {
|
|
32
|
+
extraSmall: number;
|
|
33
|
+
extraSmallPlus: number;
|
|
34
|
+
small: number;
|
|
35
|
+
smallPlus: number;
|
|
36
|
+
medium: number;
|
|
37
|
+
mediumPlus: number;
|
|
38
|
+
large: number;
|
|
39
|
+
largePlus: number;
|
|
40
|
+
extraLarge: number;
|
|
41
|
+
extraLargePlus: number;
|
|
42
|
+
};
|
|
43
|
+
spacing: {
|
|
44
|
+
xs: number;
|
|
45
|
+
sm: number;
|
|
46
|
+
md: number;
|
|
47
|
+
lg: number;
|
|
48
|
+
xl: number;
|
|
49
|
+
};
|
|
50
|
+
borderRadius: {
|
|
51
|
+
xs: number;
|
|
52
|
+
sm: number;
|
|
53
|
+
md: number;
|
|
54
|
+
lg: number;
|
|
55
|
+
xl: number;
|
|
56
|
+
};
|
|
57
|
+
borderWidth: {
|
|
58
|
+
small: number;
|
|
59
|
+
medium: number;
|
|
60
|
+
large: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
5
64
|
export interface Theme {
|
|
6
65
|
mode: ThemeMode;
|
|
7
66
|
colors: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {createNativeStackNavigator} from '@react-navigation/native-stack';
|
|
2
2
|
import {useTranslation} from '../common/localization/LocalizationProvider';
|
|
3
3
|
import {Login} from '../screens/Login/Login';
|
|
4
|
-
import {OTPScreen} from '../screens/OTP/OTPScreen';
|
|
5
4
|
import {Splash} from '../screens/splash/Splash';
|
|
6
5
|
|
|
7
6
|
const Stack = createNativeStackNavigator();
|
|
@@ -24,13 +23,6 @@ export function AuthStack() {
|
|
|
24
23
|
headerShown: false,
|
|
25
24
|
},
|
|
26
25
|
},
|
|
27
|
-
{
|
|
28
|
-
id: 'OTP',
|
|
29
|
-
component: OTPScreen,
|
|
30
|
-
options: {
|
|
31
|
-
headerShown: false,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
26
|
];
|
|
35
27
|
|
|
36
28
|
return (
|
|
@@ -35,7 +35,7 @@ const styles = StyleSheet.create({
|
|
|
35
35
|
backgroundColor: 'white',
|
|
36
36
|
justifyContent: 'flex-start',
|
|
37
37
|
alignItems: 'center',
|
|
38
|
-
paddingHorizontal: CommonSizes.spacing.
|
|
38
|
+
paddingHorizontal: CommonSizes.spacing.lg,
|
|
39
39
|
flexDirection: 'row',
|
|
40
40
|
},
|
|
41
41
|
titleContainer: {
|
|
@@ -139,13 +139,13 @@ const styles = StyleSheet.create({
|
|
|
139
139
|
container: {
|
|
140
140
|
flexGrow: 1,
|
|
141
141
|
backgroundColor: Colors.white,
|
|
142
|
-
borderTopRightRadius: CommonSizes.
|
|
143
|
-
borderTopLeftRadius: CommonSizes.
|
|
142
|
+
borderTopRightRadius: CommonSizes.borderRadius.lg,
|
|
143
|
+
borderTopLeftRadius: CommonSizes.borderRadius.lg,
|
|
144
144
|
},
|
|
145
145
|
contentContainer: {
|
|
146
146
|
justifyContent: 'center',
|
|
147
147
|
alignItems: 'center',
|
|
148
|
-
paddingHorizontal: CommonSizes.spacing.
|
|
148
|
+
paddingHorizontal: CommonSizes.spacing.lg,
|
|
149
149
|
paddingVertical: 26,
|
|
150
150
|
gap: 16,
|
|
151
151
|
},
|
|
@@ -76,32 +76,32 @@ const styles = StyleSheet.create({
|
|
|
76
76
|
backgroundColor: Colors.background,
|
|
77
77
|
},
|
|
78
78
|
content: {
|
|
79
|
-
paddingVertical: CommonSizes.spacing.
|
|
79
|
+
paddingVertical: CommonSizes.spacing.md,
|
|
80
80
|
},
|
|
81
81
|
featuredSection: {
|
|
82
|
-
marginBottom: CommonSizes.spacing.
|
|
82
|
+
marginBottom: CommonSizes.spacing.lg,
|
|
83
83
|
},
|
|
84
84
|
carouselSection: {
|
|
85
|
-
marginBottom: CommonSizes.spacing.
|
|
85
|
+
marginBottom: CommonSizes.spacing.lg,
|
|
86
86
|
},
|
|
87
87
|
sectionTitle: {
|
|
88
88
|
...CommonStyles.h2_semiBold,
|
|
89
|
-
marginHorizontal: CommonSizes.spacing.
|
|
90
|
-
marginBottom: CommonSizes.spacing.
|
|
89
|
+
marginHorizontal: CommonSizes.spacing.lg,
|
|
90
|
+
marginBottom: CommonSizes.spacing.md,
|
|
91
91
|
},
|
|
92
92
|
trendingImage: {
|
|
93
93
|
width: width * 0.7,
|
|
94
94
|
height: 200,
|
|
95
|
-
borderRadius: CommonSizes.borderRadius.
|
|
95
|
+
borderRadius: CommonSizes.borderRadius.md,
|
|
96
96
|
},
|
|
97
97
|
newArrivalsImage: {
|
|
98
98
|
width: width * 0.5,
|
|
99
99
|
height: 180,
|
|
100
|
-
borderRadius: CommonSizes.borderRadius.
|
|
100
|
+
borderRadius: CommonSizes.borderRadius.md,
|
|
101
101
|
},
|
|
102
102
|
recommendedImage: {
|
|
103
103
|
width: width * 0.6,
|
|
104
104
|
height: 160,
|
|
105
|
-
borderRadius: CommonSizes.borderRadius.
|
|
105
|
+
borderRadius: CommonSizes.borderRadius.md,
|
|
106
106
|
},
|
|
107
107
|
});
|
|
@@ -53,26 +53,26 @@ export function CarouselSection({
|
|
|
53
53
|
|
|
54
54
|
const styles = StyleSheet.create({
|
|
55
55
|
container: {
|
|
56
|
-
paddingHorizontal: CommonSizes.spacing.
|
|
56
|
+
paddingHorizontal: CommonSizes.spacing.lg,
|
|
57
57
|
},
|
|
58
58
|
itemContainer: {
|
|
59
|
-
marginRight: CommonSizes.spacing.
|
|
59
|
+
marginRight: CommonSizes.spacing.md,
|
|
60
60
|
},
|
|
61
61
|
image: {
|
|
62
62
|
width: 200,
|
|
63
63
|
height: 150,
|
|
64
|
-
borderRadius: CommonSizes.borderRadius.
|
|
64
|
+
borderRadius: CommonSizes.borderRadius.md,
|
|
65
65
|
},
|
|
66
66
|
textContainer: {
|
|
67
|
-
marginTop: CommonSizes.spacing.
|
|
67
|
+
marginTop: CommonSizes.spacing.sm,
|
|
68
68
|
},
|
|
69
69
|
title: {
|
|
70
|
-
fontSize:
|
|
70
|
+
fontSize: CommonSizes.font.medium,
|
|
71
71
|
fontWeight: '600',
|
|
72
72
|
color: Colors.blueDarker,
|
|
73
73
|
},
|
|
74
74
|
subtitle: {
|
|
75
|
-
fontSize:
|
|
75
|
+
fontSize: CommonSizes.font.small,
|
|
76
76
|
color: Colors.blueDarker,
|
|
77
77
|
marginTop: 2,
|
|
78
78
|
},
|
|
@@ -87,13 +87,13 @@ const styles = StyleSheet.create({
|
|
|
87
87
|
image: {
|
|
88
88
|
width: '100%',
|
|
89
89
|
height: '100%',
|
|
90
|
-
borderRadius: CommonSizes.borderRadius.
|
|
90
|
+
borderRadius: CommonSizes.borderRadius.lg,
|
|
91
91
|
},
|
|
92
92
|
overlay: {
|
|
93
93
|
...StyleSheet.absoluteFillObject,
|
|
94
94
|
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
|
95
|
-
borderRadius: CommonSizes.borderRadius.
|
|
96
|
-
padding: CommonSizes.spacing.
|
|
95
|
+
borderRadius: CommonSizes.borderRadius.lg,
|
|
96
|
+
padding: CommonSizes.spacing.lg,
|
|
97
97
|
justifyContent: 'flex-end',
|
|
98
98
|
},
|
|
99
99
|
title: {
|
|
@@ -104,13 +104,13 @@ const styles = StyleSheet.create({
|
|
|
104
104
|
subtitle: {
|
|
105
105
|
fontSize: 16,
|
|
106
106
|
color: Colors.white,
|
|
107
|
-
marginTop: CommonSizes.spacing.
|
|
107
|
+
marginTop: CommonSizes.spacing.sm,
|
|
108
108
|
},
|
|
109
109
|
pagination: {
|
|
110
110
|
flexDirection: 'row',
|
|
111
111
|
justifyContent: 'center',
|
|
112
112
|
alignItems: 'center',
|
|
113
|
-
marginTop: CommonSizes.spacing.
|
|
113
|
+
marginTop: CommonSizes.spacing.md,
|
|
114
114
|
},
|
|
115
115
|
dot: {
|
|
116
116
|
width: 8,
|
|
@@ -179,13 +179,13 @@ const styles = StyleSheet.create({
|
|
|
179
179
|
container: {
|
|
180
180
|
flexGrow: 1,
|
|
181
181
|
backgroundColor: Colors.white,
|
|
182
|
-
borderTopRightRadius: CommonSizes.
|
|
183
|
-
borderTopLeftRadius: CommonSizes.
|
|
182
|
+
borderTopRightRadius: CommonSizes.borderRadius.lg,
|
|
183
|
+
borderTopLeftRadius: CommonSizes.borderRadius.lg,
|
|
184
184
|
},
|
|
185
185
|
contentContainer: {
|
|
186
186
|
justifyContent: 'center',
|
|
187
187
|
alignItems: 'center',
|
|
188
|
-
paddingHorizontal: CommonSizes.spacing.
|
|
188
|
+
paddingHorizontal: CommonSizes.spacing.lg,
|
|
189
189
|
paddingVertical: 26,
|
|
190
190
|
gap: 16,
|
|
191
191
|
},
|
|
@@ -105,13 +105,13 @@ const styles = StyleSheet.create({
|
|
|
105
105
|
container: {
|
|
106
106
|
flexGrow: 1,
|
|
107
107
|
backgroundColor: Colors.white,
|
|
108
|
-
borderTopRightRadius: CommonSizes.
|
|
109
|
-
borderTopLeftRadius: CommonSizes.
|
|
108
|
+
borderTopRightRadius: CommonSizes.borderRadius.lg,
|
|
109
|
+
borderTopLeftRadius: CommonSizes.borderRadius.lg,
|
|
110
110
|
},
|
|
111
111
|
contentContainer: {
|
|
112
112
|
justifyContent: 'center',
|
|
113
113
|
alignItems: 'center',
|
|
114
|
-
paddingHorizontal: CommonSizes.spacing.
|
|
114
|
+
paddingHorizontal: CommonSizes.spacing.lg,
|
|
115
115
|
paddingVertical: 26,
|
|
116
116
|
gap: 16,
|
|
117
117
|
},
|
package/template/install-dev.sh
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npm i --legacy-peer-deps --save-dev@babel/core @babel/preset-env @babel/runtime @react-native/babel-preset @react-native/eslint-config @react-native/metro-config @react-native/typescript-config @types/lodash @types/react @types/react-test-renderer babel-jest eslint jest prettier react-test-renderer typescript
|
package/template/install.sh
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npm i --legacy-peer-deps @react-native-async-storage/async-storage @react-native-camera-roll/camera-roll @react-native-community/datetimepicker @react-native-community/image-editor @react-native-community/netinfo @react-native-community/slider @react-navigation/bottom-tabs @react-navigation/drawer @react-navigation/material-top-tabs @react-navigation/native @react-navigation/native-stack @reduxjs/toolkit @shopify/flash-list @types/intl @types/jest @types/react-native-vector-icons @types/react-redux @typescript-eslint/eslint-plugin @typescript-eslint/parser axios babel-plugin-transform-remove-console dayjs detox eslint-config-react-strong eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-jest eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-native eslint-plugin-unused-imports husky intl lint-staged lodash metro-react-native-babel-preset mime moment patch-package react react-dom react-native react-native-actions-sheet react-native-animated-pagination-dots react-native-bundle-visualizer react-native-calendars react-native-camera react-native-config react-native-config-node react-native-dev-menu react-native-device-info react-native-dropdown-select-list react-native-gesture-handler react-native-image-crop-picker react-native-image-resource-generator react-native-in-app-review react-native-keyboard-aware-scroll-view react-native-localization react-native-mask-input react-native-pager-view react-native-permissions react-native-reanimated react-native-reanimated-carousel react-native-safe-area-context react-native-screens react-native-sfsymbols react-native-share react-native-size-matters react-native-snackbar react-native-svg react-native-tab-view react-native-vector-icons react-native-version react-native-webview react-redux redux redux-persist redux-persist-transform-filter rn-fetch-blob @gorhom/bottom-sheet react-native-vision-camera
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {Linking} from 'react-native';
|
|
2
|
-
import Share, {ShareOptions} from 'react-native-share';
|
|
3
|
-
import {isAndroid, isIos} from '../../core/theme/commonConsts';
|
|
4
|
-
import {
|
|
5
|
-
ShareOpenResult,
|
|
6
|
-
ShareSingleOptions,
|
|
7
|
-
ShareSingleResult,
|
|
8
|
-
} from 'react-native-share/lib/typescript/src/types';
|
|
9
|
-
|
|
10
|
-
export async function showShareDialog(
|
|
11
|
-
options: ShareOptions,
|
|
12
|
-
completedCallback?: (result: ShareOpenResult) => void,
|
|
13
|
-
errorCallback?: (error: Error | unknown) => void,
|
|
14
|
-
) {
|
|
15
|
-
try {
|
|
16
|
-
const result = await Share.open(options);
|
|
17
|
-
completedCallback?.(result);
|
|
18
|
-
} catch (error: Error | unknown) {
|
|
19
|
-
errorCallback?.(error);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function showShareSocialDialog(
|
|
24
|
-
options: ShareSingleOptions,
|
|
25
|
-
completedCallback?: (result: ShareSingleResult) => void,
|
|
26
|
-
errorCallback?: (error: Error | unknown) => void,
|
|
27
|
-
) {
|
|
28
|
-
try {
|
|
29
|
-
const result = await Share.shareSingle(options);
|
|
30
|
-
completedCallback?.(result);
|
|
31
|
-
} catch (error: Error | unknown) {
|
|
32
|
-
errorCallback?.(error);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export async function isPackageInstalled(
|
|
37
|
-
androidPackageName?: string,
|
|
38
|
-
iosUrl?: string,
|
|
39
|
-
): Promise<boolean> {
|
|
40
|
-
if (isAndroid && androidPackageName) {
|
|
41
|
-
return (await Share.isPackageInstalled(androidPackageName)).isInstalled;
|
|
42
|
-
} else if (isIos && iosUrl) {
|
|
43
|
-
return Linking.canOpenURL(iosUrl);
|
|
44
|
-
} else {
|
|
45
|
-
throw new Error('No arguments were given or the platform is not supported');
|
|
46
|
-
}
|
|
47
|
-
}
|