@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.
- package/.vscode/settings.json +7 -0
- package/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/template/App.tsx +30 -9
- package/template/package-lock.json +170 -123
- package/template/package.json +1 -0
- package/template/src/common/ImageResources.g.ts +3 -5
- package/template/src/common/components/Background.tsx +66 -28
- package/template/src/common/components/Cards.tsx +116 -0
- package/template/src/common/components/Container.tsx +145 -0
- package/template/src/common/components/FlatListWrapper.tsx +1 -0
- package/template/src/common/components/ImageCropPickerButton.tsx +1 -1
- package/template/src/common/components/OTPInput.tsx +107 -0
- package/template/src/common/components/PhotoTakingButton.tsx +1 -4
- package/template/src/common/components/PrimaryButton.tsx +171 -157
- package/template/src/common/components/RTLAwareText.tsx +42 -0
- package/template/src/common/components/RTLAwareView.tsx +179 -0
- package/template/src/common/components/RadioButton.tsx +1 -3
- package/template/src/common/components/RadioIcon.tsx +1 -2
- package/template/src/common/components/SearchBar.tsx +179 -0
- package/template/src/common/components/Separator.tsx +7 -4
- package/template/src/common/components/TouchablePlatform.tsx +1 -3
- package/template/src/common/components/TryAgain.tsx +3 -3
- package/template/src/common/helpers/inAppReviewHelper.ts +0 -1
- package/template/src/common/helpers/stringsHelpers.ts +10 -0
- package/template/src/common/hooks/useFlatListActions.ts +1 -1
- package/template/src/common/localization/LocalizationProvider.tsx +152 -0
- package/template/src/common/localization/README.md +488 -0
- package/template/src/common/localization/localization.ts +12 -0
- package/template/src/common/localization/translations/homeLocalization.ts +1 -0
- package/template/src/common/localization/translations/profileLocalization.ts +24 -0
- package/template/src/common/validations/errorValidations.ts +1 -6
- package/template/src/common/validations/examples/TextInputWithValidation.tsx +229 -0
- package/template/src/common/validations/index.ts +28 -0
- package/template/src/common/validations/regex.js +83 -0
- package/template/src/common/validations/regexValidator.ts +240 -0
- package/template/src/common/validations/validationConstants.ts +2 -2
- package/template/src/core/api/errorHandler.ts +39 -0
- package/template/src/core/api/responseHandlers.ts +1 -26
- package/template/src/core/api/serverHeaders.ts +13 -23
- package/template/src/core/store/app/appSlice.ts +1 -2
- package/template/src/core/store/user/userSlice.ts +1 -0
- package/template/src/core/theme/ThemeProvider.tsx +63 -0
- package/template/src/core/theme/colors.ts +31 -42
- package/template/src/core/theme/commonConsts.ts +1 -1
- package/template/src/core/theme/commonStyles.ts +267 -210
- package/template/src/core/theme/fonts.ts +17 -1
- package/template/src/core/theme/scaling.ts +101 -0
- package/template/src/core/theme/themes.ts +214 -0
- package/template/src/core/theme/types.ts +51 -0
- package/template/src/navigation/AuthStack.tsx +25 -30
- package/template/src/navigation/HeaderComponents.tsx +18 -58
- package/template/src/navigation/MainNavigation.tsx +5 -6
- package/template/src/navigation/MainStack.tsx +6 -27
- package/template/src/navigation/RootNavigation.tsx +1 -7
- package/template/src/navigation/TabBar.tsx +2 -2
- package/template/src/navigation/TopTabBar.tsx +1 -1
- package/template/src/screens/Login/Login.tsx +3 -3
- package/template/src/screens/home/HomeScreen.tsx +107 -0
- package/template/src/screens/home/components/CarouselSection.tsx +79 -0
- package/template/src/screens/home/components/FeaturedCarousel.tsx +128 -0
- package/template/src/screens/home/hooks/useHomeData.ts +60 -0
- package/template/src/screens/home/types.ts +7 -0
- package/template/src/screens/registration/RegistrationScreen.tsx +2 -2
- package/template/src/screens/resetPassword/ForgotPasswordScreen.tsx +2 -2
- package/template/src/utils/stringBuilder.js +25 -0
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import {AxiosDefaults} from 'axios';
|
|
1
|
+
import axios, {AxiosDefaults} from 'axios';
|
|
4
2
|
|
|
5
3
|
export const defaultHeaders: HeadersInit_ = {
|
|
6
4
|
Connection: 'keep-alive',
|
|
@@ -12,28 +10,20 @@ declare type MethodData = {
|
|
|
12
10
|
config?: any;
|
|
13
11
|
};
|
|
14
12
|
|
|
13
|
+
const baseURL = '';
|
|
14
|
+
|
|
15
15
|
const instance = axios.create({
|
|
16
|
-
baseURL:
|
|
17
|
-
timeout: 5000,
|
|
18
|
-
maxRate: 100,
|
|
16
|
+
baseURL: baseURL,
|
|
19
17
|
headers: {
|
|
20
|
-
|
|
21
|
-
'Content-Type': 'application/json',
|
|
18
|
+
...defaultHeaders,
|
|
22
19
|
},
|
|
23
20
|
});
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export const
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const put = ({url, data, config}: MethodData) => {
|
|
34
|
-
return instance.put(url, data, config);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const deleteApi = ({url, config}: MethodData) => {
|
|
38
|
-
return instance.delete(url, config);
|
|
39
|
-
};
|
|
22
|
+
// Export HTTP methods using the configured instance
|
|
23
|
+
export const post = ({url, data, config}: MethodData) =>
|
|
24
|
+
instance.post(url, data, config);
|
|
25
|
+
export const get = ({url, config}: MethodData) => instance.get(url, config);
|
|
26
|
+
export const put = ({url, data, config}: MethodData) =>
|
|
27
|
+
instance.put(url, data, config);
|
|
28
|
+
export const deleteApi = ({url, config}: MethodData) =>
|
|
29
|
+
instance.delete(url, config);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {createSlice} from '@reduxjs/toolkit';
|
|
2
|
-
import {newState} from '../../../common/utils/newState';
|
|
3
2
|
|
|
4
|
-
import {appInitialState
|
|
3
|
+
import {appInitialState} from './appState';
|
|
5
4
|
|
|
6
5
|
export const {reducer: AppReducer, actions} = createSlice({
|
|
7
6
|
name: 'app',
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createContext,
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useState,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import {useColorScheme} from 'react-native';
|
|
9
|
+
import {Theme, ThemeMode} from './types';
|
|
10
|
+
import {darkTheme, lightTheme} from './themes';
|
|
11
|
+
|
|
12
|
+
interface ThemeContextType {
|
|
13
|
+
theme: Theme;
|
|
14
|
+
toggleTheme: () => void;
|
|
15
|
+
setThemeMode: (mode: ThemeMode) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ThemeContext = createContext<ThemeContextType>({
|
|
19
|
+
theme: lightTheme,
|
|
20
|
+
toggleTheme: () => {},
|
|
21
|
+
setThemeMode: () => {},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const useTheme = () => {
|
|
25
|
+
const context = useContext(ThemeContext);
|
|
26
|
+
if (!context) {
|
|
27
|
+
throw new Error('useTheme must be used within a ThemeProvider');
|
|
28
|
+
}
|
|
29
|
+
return context;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
interface ThemeProviderProps {
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
initialTheme?: ThemeMode;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const ThemeProvider: React.FC<ThemeProviderProps> = ({
|
|
38
|
+
children,
|
|
39
|
+
initialTheme,
|
|
40
|
+
}) => {
|
|
41
|
+
const systemColorScheme = useColorScheme();
|
|
42
|
+
const [themeMode, setThemeMode] = useState<ThemeMode>(
|
|
43
|
+
initialTheme || systemColorScheme || 'light',
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!initialTheme && systemColorScheme) {
|
|
48
|
+
setThemeMode(systemColorScheme);
|
|
49
|
+
}
|
|
50
|
+
}, [systemColorScheme, initialTheme]);
|
|
51
|
+
|
|
52
|
+
const toggleTheme = useCallback(() => {
|
|
53
|
+
setThemeMode(prev => (prev === 'light' ? 'dark' : 'light'));
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
const theme = themeMode === 'dark' ? darkTheme : lightTheme;
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<ThemeContext.Provider value={{theme, toggleTheme, setThemeMode}}>
|
|
60
|
+
{children}
|
|
61
|
+
</ThemeContext.Provider>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -1,49 +1,36 @@
|
|
|
1
|
-
export enum
|
|
1
|
+
export enum BlackColors {
|
|
2
|
+
indigoBlue = '#6666FF',
|
|
3
|
+
mutedLavender = '#B3B5FF',
|
|
4
|
+
tintColor = '#B3B5FF',
|
|
5
|
+
mutedLavender30 = 'rgba(184, 186, 255, 0.3)',
|
|
6
|
+
balanceBackground = 'rgba(41, 45, 50, 0.8)',
|
|
7
|
+
white = '#FFFFFF',
|
|
8
|
+
backgroundOpacity = 'rgba(36, 40, 44, 0.8)',
|
|
2
9
|
black = '#000000',
|
|
10
|
+
background = '#000000',
|
|
11
|
+
surface = '#121212',
|
|
12
|
+
card = '#1E1E1E',
|
|
13
|
+
shadow = '#FFFFFF',
|
|
14
|
+
red = '#FB043E',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum WhiteColors {
|
|
18
|
+
indigoBlue = '#6666FF',
|
|
19
|
+
mutedLavender = '#B3B5FF',
|
|
20
|
+
tintColor = '#6666FF',
|
|
21
|
+
mutedLavender30 = 'rgba(184, 186, 255, 0.3)',
|
|
22
|
+
balanceBackground = 'rgba(184, 186, 255, 0.3)',
|
|
3
23
|
white = '#FFFFFF',
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
green = '#4DAD4A',
|
|
12
|
-
red = '#CE3C3E',
|
|
13
|
-
transparent = 'transparent',
|
|
14
|
-
primary100 = '#8481FD',
|
|
15
|
-
primary50 = '#C1C0FE',
|
|
16
|
-
primary20 = '#E6E6FF',
|
|
17
|
-
primary10 = '#F3F2FF',
|
|
18
|
-
primary5 = '#F9F9FF',
|
|
19
|
-
teal100 = '#1ED3B8',
|
|
20
|
-
teal50 = '#8EE9DB',
|
|
21
|
-
teal20 = '#D2F6F1',
|
|
22
|
-
teal10 = '#E9FBF8',
|
|
23
|
-
teal5 = '#F4FDFB',
|
|
24
|
-
blue100 = '#52BDFF',
|
|
25
|
-
blue50 = '#A8DEFF',
|
|
26
|
-
blue20 = '#DCF2FF',
|
|
27
|
-
blue10 = '#EEF8FF',
|
|
28
|
-
blue5 = '#F6FCFF',
|
|
29
|
-
coral100 = '#F2565E',
|
|
30
|
-
coral50 = '#F9AAAF',
|
|
31
|
-
coral20 = '#FCDDDF',
|
|
32
|
-
coral10 = '#FEF7F7',
|
|
33
|
-
coral5 = '#FEF7F7',
|
|
34
|
-
orange100 = '#F79E69',
|
|
35
|
-
orange50 = '#FBCEB4',
|
|
36
|
-
orange20 = '#FDECE1',
|
|
37
|
-
orange10 = '#FEF5F0',
|
|
38
|
-
orange5 = '#FFFAF8',
|
|
39
|
-
yellow100 = '#FFDF75',
|
|
40
|
-
yellow50 = '#FFEFBA',
|
|
41
|
-
yellow20 = '#FFF8E3',
|
|
42
|
-
yellow10 = '#FFFCF1',
|
|
43
|
-
yellow5 = '#FFFDF8',
|
|
24
|
+
backgroundOpacity = 'rgba(255, 255, 255, 0.7)',
|
|
25
|
+
black = '#000000',
|
|
26
|
+
background = '#FFFFFF',
|
|
27
|
+
surface = '#FFFFFF',
|
|
28
|
+
card = '#FFFFFF',
|
|
29
|
+
shadow = 'rgba(0, 0, 0, 0.8)',
|
|
30
|
+
red = '#FB043E',
|
|
44
31
|
}
|
|
45
32
|
|
|
46
|
-
export enum
|
|
33
|
+
export enum Colors {
|
|
47
34
|
violetLight = '#F3F2FF',
|
|
48
35
|
violetLightHover = '#E6E6FF',
|
|
49
36
|
violetLightActive = '#C1C0FE',
|
|
@@ -85,4 +72,6 @@ export enum NewColors {
|
|
|
85
72
|
red = '#FFFCF1',
|
|
86
73
|
green = '#F4FDFB',
|
|
87
74
|
background = '#FAFAFA',
|
|
75
|
+
white = 'white',
|
|
76
|
+
gray = 'gray',
|
|
88
77
|
}
|
|
@@ -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';
|
|
13
13
|
|
|
14
14
|
const windowDimensions = Dimensions.get('window');
|
|
15
15
|
export const isIos = Platform.OS == 'ios';
|