@fadyshawky/react-native-magic 1.0.0
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/README.md +269 -0
- package/package.json +36 -0
- package/template/.bundle/config +2 -0
- package/template/.env.development +5 -0
- package/template/.env.production +5 -0
- package/template/.env.staging +5 -0
- package/template/.eslintrc.js +4 -0
- package/template/.prettierrc.js +7 -0
- package/template/.watchmanconfig +1 -0
- package/template/App.tsx +34 -0
- package/template/Gemfile +9 -0
- package/template/Gemfile.lock +117 -0
- package/template/README.md +79 -0
- package/template/__tests__/App.test.tsx +17 -0
- package/template/android/app/build.gradle +128 -0
- package/template/android/app/debug.keystore +0 -0
- package/template/android/app/proguard-rules.pro +10 -0
- package/template/android/app/src/debug/AndroidManifest.xml +9 -0
- package/template/android/app/src/main/AndroidManifest.xml +26 -0
- package/template/android/app/src/main/java/com/reactnativemagic/MainActivity.kt +22 -0
- package/template/android/app/src/main/java/com/reactnativemagic/MainApplication.kt +44 -0
- package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/values/strings.xml +3 -0
- package/template/android/app/src/main/res/values/styles.xml +9 -0
- package/template/android/build.gradle +21 -0
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/template/android/gradle.properties +39 -0
- package/template/android/gradlew +252 -0
- package/template/android/gradlew.bat +94 -0
- package/template/android/settings.gradle +6 -0
- package/template/app.json +4 -0
- package/template/babel.config.js +3 -0
- package/template/index.js +9 -0
- package/template/install-dev.sh +1 -0
- package/template/install.sh +1 -0
- package/template/ios/.xcode.env +11 -0
- package/template/ios/Podfile +42 -0
- package/template/ios/Podfile.lock +2461 -0
- package/template/ios/reactnativemagic/AppDelegate.h +6 -0
- package/template/ios/reactnativemagic/AppDelegate.mm +31 -0
- package/template/ios/reactnativemagic/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/template/ios/reactnativemagic/Images.xcassets/Contents.json +6 -0
- package/template/ios/reactnativemagic/Info.plist +52 -0
- package/template/ios/reactnativemagic/LaunchScreen.storyboard +47 -0
- package/template/ios/reactnativemagic/PrivacyInfo.xcprivacy +46 -0
- package/template/ios/reactnativemagic/main.m +10 -0
- package/template/ios/reactnativemagic copy-Info.plist +52 -0
- package/template/ios/reactnativemagic.xcodeproj/project.pbxproj +836 -0
- package/template/ios/reactnativemagic.xcodeproj/xcshareddata/xcschemes/reactnativemagic.xcscheme +88 -0
- package/template/ios/reactnativemagic.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/reactnativemagic.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/template/ios/reactnativemagicTests/Info.plist +24 -0
- package/template/ios/reactnativemagicTests/reactnativemagicTests.m +66 -0
- package/template/ios/tmp.xcconfig +2 -0
- package/template/jest.config.js +3 -0
- package/template/metro.config.js +11 -0
- package/template/package-lock.json +18315 -0
- package/template/package.json +125 -0
- package/template/resources/symbols/SFSymbols.ts +2614 -0
- package/template/src/common/ImageResources.g.ts +14 -0
- package/template/src/common/components/Background.tsx +34 -0
- package/template/src/common/components/EmptyView.tsx +31 -0
- package/template/src/common/components/FlatListWrapper.tsx +66 -0
- package/template/src/common/components/IconPlatform.tsx +17 -0
- package/template/src/common/components/ImageCropPickerButton.tsx +108 -0
- package/template/src/common/components/LoadingComponent.tsx +16 -0
- package/template/src/common/components/PhotoTakingButton.tsx +99 -0
- package/template/src/common/components/PrimaryButton.tsx +305 -0
- package/template/src/common/components/PrimaryTextInput.tsx +287 -0
- package/template/src/common/components/RadioButton.tsx +73 -0
- package/template/src/common/components/RadioIcon.tsx +63 -0
- package/template/src/common/components/Separator.tsx +39 -0
- package/template/src/common/components/Svg.tsx +25 -0
- package/template/src/common/components/TouchablePlatform.tsx +70 -0
- package/template/src/common/components/TryAgain.tsx +56 -0
- package/template/src/common/helpers/arrayHelpers.ts +29 -0
- package/template/src/common/helpers/calculatePage.ts +16 -0
- package/template/src/common/helpers/colorHelpers.ts +34 -0
- package/template/src/common/helpers/defaultKeyIdExtractor.ts +5 -0
- package/template/src/common/helpers/dialogsHelpers.ts +66 -0
- package/template/src/common/helpers/imageHelpers.ts +5 -0
- package/template/src/common/helpers/inAppReviewHelper.ts +31 -0
- package/template/src/common/helpers/netInfoHelpers.ts +42 -0
- package/template/src/common/helpers/orientationHelpers.ts +25 -0
- package/template/src/common/helpers/regexHelpers.ts +7 -0
- package/template/src/common/helpers/shareHelpers.ts +47 -0
- package/template/src/common/helpers/stringsHelpers.ts +15 -0
- package/template/src/common/hooks/useBackHandler.ts +10 -0
- package/template/src/common/hooks/useDebounce.ts +17 -0
- package/template/src/common/hooks/useEventRegister.ts +50 -0
- package/template/src/common/hooks/useFlatListActions.ts +31 -0
- package/template/src/common/hooks/usePrevious.ts +11 -0
- package/template/src/common/hooks/useWhyDidYouUpdate.ts +27 -0
- package/template/src/common/localization/dateFormatter.ts +108 -0
- package/template/src/common/localization/intlFormatter.ts +37 -0
- package/template/src/common/localization/localization.ts +51 -0
- package/template/src/common/localization/translations/commonLocalization.ts +29 -0
- package/template/src/common/localization/translations/emptyLocalization.ts +6 -0
- package/template/src/common/localization/translations/errorsLocalization.ts +22 -0
- package/template/src/common/localization/translations/homeLocalization.ts +5 -0
- package/template/src/common/localization/translations/loginLocalization.ts +14 -0
- package/template/src/common/localization/translations/onboardingLocalization.ts +13 -0
- package/template/src/common/localization/translations/pagesLocalization.ts +14 -0
- package/template/src/common/localization/translations/profileLocalization.ts +6 -0
- package/template/src/common/urls/baseUrlOpener.ts +31 -0
- package/template/src/common/urls/emailUrl.ts +20 -0
- package/template/src/common/urls/httpUrl.ts +19 -0
- package/template/src/common/urls/mapUrl.ts +22 -0
- package/template/src/common/urls/phoneUrl.ts +16 -0
- package/template/src/common/utils/createPerfectSize.ts +15 -0
- package/template/src/common/utils/listHandlers.ts +30 -0
- package/template/src/common/utils/newState.ts +5 -0
- package/template/src/common/utils/serializeQueryParams.ts +10 -0
- package/template/src/common/validations/authValidations.ts +15 -0
- package/template/src/common/validations/commonValidations.ts +39 -0
- package/template/src/common/validations/errorValidations.ts +72 -0
- package/template/src/common/validations/hooks/useDatesError.ts +40 -0
- package/template/src/common/validations/hooks/useInputError.ts +30 -0
- package/template/src/common/validations/profileValidations.ts +30 -0
- package/template/src/common/validations/validationConstants.ts +20 -0
- package/template/src/core/api/responseHandlers.ts +43 -0
- package/template/src/core/api/serverHeaders.ts +39 -0
- package/template/src/core/store/app/appSlice.ts +12 -0
- package/template/src/core/store/app/appState.ts +3 -0
- package/template/src/core/store/reduxHelpers.ts +11 -0
- package/template/src/core/store/rootReducer.ts +10 -0
- package/template/src/core/store/store.tsx +41 -0
- package/template/src/core/store/user/userActions.ts +31 -0
- package/template/src/core/store/user/userSlice.ts +62 -0
- package/template/src/core/store/user/userState.ts +44 -0
- package/template/src/core/theme/colors.ts +117 -0
- package/template/src/core/theme/commonConsts.ts +45 -0
- package/template/src/core/theme/commonSizes.ts +70 -0
- package/template/src/core/theme/commonStyles.ts +228 -0
- package/template/src/core/theme/fonts.ts +12 -0
- package/template/src/navigation/AuthStack.tsx +39 -0
- package/template/src/navigation/HeaderComponents.tsx +104 -0
- package/template/src/navigation/MainNavigation.tsx +55 -0
- package/template/src/navigation/MainStack.tsx +99 -0
- package/template/src/navigation/RootNavigation.tsx +33 -0
- package/template/src/navigation/TabBar.tsx +94 -0
- package/template/src/navigation/TopTabBar.tsx +75 -0
- package/template/src/navigation/types.ts +5 -0
- package/template/src/screens/Login/Login.tsx +114 -0
- package/template/src/screens/Settings/Settings.tsx +5 -0
- package/template/src/screens/main/Main.tsx +5 -0
- package/template/src/screens/profile/Profile.tsx +5 -0
- package/template/src/screens/splash/Splash.tsx +19 -0
- package/template/src/sheetManager/sheets.tsx +14 -0
- package/template/tsconfig.json +3 -0
- package/template/types/index.ts +108 -0
- package/template/types/react-native-config.d.ts +19 -0
- package/template.config.js +4 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {createSlice} from '@reduxjs/toolkit';
|
|
2
|
+
import {LoadState} from '../../../../types';
|
|
3
|
+
import {newState} from '../../../common/utils/newState';
|
|
4
|
+
import {handleErrorResponse} from '../../api/responseHandlers';
|
|
5
|
+
import {userLogin} from './userActions';
|
|
6
|
+
import {UserInitialState, UserPayload, UserState} from './userState';
|
|
7
|
+
|
|
8
|
+
function loginHandler(state: UserState, payload: {payload: UserPayload}) {
|
|
9
|
+
return newState(state, {
|
|
10
|
+
user: payload.payload.user,
|
|
11
|
+
accessToken: payload.payload.token,
|
|
12
|
+
loginLoading: LoadState['allIsLoaded'],
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function loginLoadingHandler(state: UserState) {
|
|
16
|
+
return newState(state, {
|
|
17
|
+
loginLoading: LoadState['pullToRefresh'],
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function loginErrorHandler(
|
|
22
|
+
state: UserState,
|
|
23
|
+
payload: {payload: string | unknown},
|
|
24
|
+
) {
|
|
25
|
+
handleErrorResponse((payload.payload as string) || 'Login failed');
|
|
26
|
+
return newState(state, {
|
|
27
|
+
loginLoading: LoadState['error'],
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function logoutHandler(state: UserState) {
|
|
32
|
+
return newState(state, UserInitialState);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function updateHandler(state: UserState, payload: any) {
|
|
36
|
+
return newState(state, {
|
|
37
|
+
user: {
|
|
38
|
+
...state.user,
|
|
39
|
+
...payload.payload,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const {reducer: UserReducer, actions} = createSlice({
|
|
45
|
+
name: 'user',
|
|
46
|
+
initialState: UserInitialState,
|
|
47
|
+
reducers: {
|
|
48
|
+
setLogin: loginHandler,
|
|
49
|
+
setLoginLoading: loginLoadingHandler,
|
|
50
|
+
setLoginError: loginLoadingHandler,
|
|
51
|
+
setLogout: logoutHandler,
|
|
52
|
+
setUpdate: updateHandler,
|
|
53
|
+
},
|
|
54
|
+
extraReducers: builder => {
|
|
55
|
+
builder
|
|
56
|
+
.addCase(userLogin.fulfilled, loginHandler)
|
|
57
|
+
.addCase(userLogin.rejected, loginErrorHandler)
|
|
58
|
+
.addCase(userLogin.pending, loginLoadingHandler);
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const {setLogout, setUpdate} = actions;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {LoadState} from '../../../../types';
|
|
2
|
+
|
|
3
|
+
export interface UserState {
|
|
4
|
+
user: UserEntity;
|
|
5
|
+
accessToken: string;
|
|
6
|
+
loginLoading: LoadState;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface UserPayload {
|
|
10
|
+
user: UserEntity;
|
|
11
|
+
token: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const UserInitialState: UserState = {
|
|
15
|
+
user: {
|
|
16
|
+
id: 0,
|
|
17
|
+
email: '',
|
|
18
|
+
first_name: '',
|
|
19
|
+
last_name: '',
|
|
20
|
+
phone_number: '',
|
|
21
|
+
address: '',
|
|
22
|
+
role_id: 0,
|
|
23
|
+
created_at: '',
|
|
24
|
+
updated_at: '',
|
|
25
|
+
deleted_at: null,
|
|
26
|
+
roleName: '',
|
|
27
|
+
},
|
|
28
|
+
accessToken: '',
|
|
29
|
+
loginLoading: LoadState['needLoad'],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export interface UserEntity {
|
|
33
|
+
id: number;
|
|
34
|
+
email: string;
|
|
35
|
+
first_name: string;
|
|
36
|
+
last_name: string;
|
|
37
|
+
phone_number: string;
|
|
38
|
+
address: string;
|
|
39
|
+
role_id: number;
|
|
40
|
+
created_at: string;
|
|
41
|
+
updated_at: string;
|
|
42
|
+
deleted_at?: null;
|
|
43
|
+
roleName: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export enum Colors {
|
|
2
|
+
black = '#000000',
|
|
3
|
+
white = '#FFFFFF',
|
|
4
|
+
gray = '#929292',
|
|
5
|
+
gray2 = '#949494',
|
|
6
|
+
gray5 = '#E0E0E0',
|
|
7
|
+
background = '#F9FCFF',
|
|
8
|
+
gray_disabled = '#BDBDBD',
|
|
9
|
+
lightGray = '#BDBDBD',
|
|
10
|
+
darkGray = '#262626',
|
|
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',
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export enum PlatformColorsIOS {
|
|
47
|
+
/* Label Colors */
|
|
48
|
+
label = 'label',
|
|
49
|
+
secondaryLabel = 'secondaryLabel',
|
|
50
|
+
tertiaryLabel = 'tertiaryLabel',
|
|
51
|
+
quaternaryLabel = 'quaternaryLabel',
|
|
52
|
+
|
|
53
|
+
/* Fill Colors */
|
|
54
|
+
systemFill = 'systemFill',
|
|
55
|
+
secondarySystemFill = 'secondarySystemFill',
|
|
56
|
+
tertiarySystemFill = 'tertiarySystemFill',
|
|
57
|
+
quaternarySystemFill = 'quaternarySystemFill',
|
|
58
|
+
|
|
59
|
+
/* Text Colors */
|
|
60
|
+
placeholderText = 'placeholderText',
|
|
61
|
+
|
|
62
|
+
/* Standard Content Background Colors */
|
|
63
|
+
systemBackground = 'systemBackground',
|
|
64
|
+
secondarySystemBackground = 'secondarySystemBackground',
|
|
65
|
+
tertiarySystemBackground = 'tertiarySystemBackground',
|
|
66
|
+
|
|
67
|
+
/* Grouped Content Background Colors */
|
|
68
|
+
systemGroupedBackground = 'systemGroupedBackground',
|
|
69
|
+
secondarySystemGroupedBackground = 'secondarySystemGroupedBackground',
|
|
70
|
+
tertiarySystemGroupedBackground = 'tertiarySystemGroupedBackground',
|
|
71
|
+
|
|
72
|
+
/* Separator Colors */
|
|
73
|
+
separator = 'separator',
|
|
74
|
+
opaqueSeparator = 'opaqueSeparator',
|
|
75
|
+
|
|
76
|
+
/* Link Color */
|
|
77
|
+
link = 'link',
|
|
78
|
+
|
|
79
|
+
/* Nonadaptable Colors */
|
|
80
|
+
darkText = 'darkText',
|
|
81
|
+
lightText = 'lightText',
|
|
82
|
+
|
|
83
|
+
/* Standard Colors */
|
|
84
|
+
/* Adaptable Colors */
|
|
85
|
+
systemBlue = 'systemBlue',
|
|
86
|
+
systemGreen = 'systemGreen',
|
|
87
|
+
systemIndigo = 'systemIndigo',
|
|
88
|
+
systemOrange = 'systemOrange',
|
|
89
|
+
systemPink = 'systemPink',
|
|
90
|
+
systemPurple = 'systemPurple',
|
|
91
|
+
systemRed = 'systemRed',
|
|
92
|
+
systemTeal = 'systemTeal',
|
|
93
|
+
systemYellow = 'systemYellow',
|
|
94
|
+
|
|
95
|
+
/* Adaptable Gray Colors */
|
|
96
|
+
systemGray = 'systemGray',
|
|
97
|
+
systemGray2 = 'systemGray2',
|
|
98
|
+
systemGray3 = 'systemGray3',
|
|
99
|
+
systemGray4 = 'systemGray4',
|
|
100
|
+
systemGray5 = 'systemGray5',
|
|
101
|
+
systemGray6 = 'systemGray6',
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export enum PlatformColorsAndroid {
|
|
105
|
+
primary = '@color/primary',
|
|
106
|
+
primaryDark = '@color/primaryDark',
|
|
107
|
+
primaryLight = '@color/primaryLight',
|
|
108
|
+
background = '@color/background',
|
|
109
|
+
primaryText = '@color/primaryText',
|
|
110
|
+
primaryTextOpacity = '@color/primaryTextOpacity',
|
|
111
|
+
secondaryText = '@color/secondaryText',
|
|
112
|
+
onPrimaryText = '@color/onPrimaryText',
|
|
113
|
+
onPrimaryTextOpacity = '@color/onPrimaryTextOpacity',
|
|
114
|
+
divider = '@color/divider',
|
|
115
|
+
navigation = '@color/navigation',
|
|
116
|
+
statusbar = '@color/statusbar',
|
|
117
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import {
|
|
3
|
+
Dimensions,
|
|
4
|
+
PixelRatio,
|
|
5
|
+
Platform,
|
|
6
|
+
PlatformAndroidStatic,
|
|
7
|
+
PlatformIOSStatic,
|
|
8
|
+
StatusBar,
|
|
9
|
+
StyleSheet,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import DeviceInfo from 'react-native-device-info';
|
|
12
|
+
import {createPerfectSize} from '../../common/utils/createPerfectSize';
|
|
13
|
+
|
|
14
|
+
const windowDimensions = Dimensions.get('window');
|
|
15
|
+
export const isIos = Platform.OS == 'ios';
|
|
16
|
+
export const isAndroid = Platform.OS == 'android';
|
|
17
|
+
export const hasDynamicIsland = DeviceInfo.hasDynamicIsland();
|
|
18
|
+
export const hasNotch = DeviceInfo.hasNotch() || hasDynamicIsland;
|
|
19
|
+
export const isIpad = isIos && (Platform as PlatformIOSStatic).isPad;
|
|
20
|
+
export const isTablet = DeviceInfo.isTablet();
|
|
21
|
+
export const isAndroid11AndHigher =
|
|
22
|
+
isAndroid && (Platform as PlatformAndroidStatic).Version >= 30;
|
|
23
|
+
|
|
24
|
+
export const windowWidth = windowDimensions.width;
|
|
25
|
+
export const windowHeight =
|
|
26
|
+
windowDimensions.height - (!isIos ? StatusBar.currentHeight || 0 : 0);
|
|
27
|
+
|
|
28
|
+
export const screenTabInitialLayout = {height: 0, width: windowWidth};
|
|
29
|
+
export const hairlineWidth = StyleSheet.hairlineWidth;
|
|
30
|
+
|
|
31
|
+
export const hitSlop = {top: 10, bottom: 10, left: 10, right: 10};
|
|
32
|
+
export const hitSlopBig = {top: 20, bottom: 20, left: 20, right: 20};
|
|
33
|
+
|
|
34
|
+
export const pixelRatio = PixelRatio.get();
|
|
35
|
+
|
|
36
|
+
export const perfectSize = createPerfectSize(
|
|
37
|
+
PixelRatio.roundToNearestPixel(windowWidth * pixelRatio),
|
|
38
|
+
PixelRatio.roundToNearestPixel(windowHeight * pixelRatio),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export const maxWindowDimension = Math.max(windowWidth, windowHeight);
|
|
42
|
+
export const minWindowDimension = Math.min(windowHeight, windowWidth);
|
|
43
|
+
|
|
44
|
+
export const minimalLegalAge = dayjs().subtract(16, 'years').toDate();
|
|
45
|
+
export const maximalAge = dayjs().subtract(100, 'years').toDate();
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {ISize} from '../../types';
|
|
2
|
+
|
|
3
|
+
export const CommonSizes = {
|
|
4
|
+
font: {
|
|
5
|
+
extraSmall: 11,
|
|
6
|
+
extraSmallPlus: 12,
|
|
7
|
+
small: 14,
|
|
8
|
+
smallPlus: 15,
|
|
9
|
+
medium: 16,
|
|
10
|
+
mediumPlus: 18,
|
|
11
|
+
extraMedium: 20,
|
|
12
|
+
large: 22,
|
|
13
|
+
largePlus: 28,
|
|
14
|
+
extraLarge: 34,
|
|
15
|
+
extraLargePlus: 44,
|
|
16
|
+
} as Readonly<ISize>,
|
|
17
|
+
letterSpacing: {
|
|
18
|
+
extraSmall: 0.07,
|
|
19
|
+
extraSmallPlus: 0,
|
|
20
|
+
small: -0.08,
|
|
21
|
+
smallPlus: -0.24,
|
|
22
|
+
medium: -0.41,
|
|
23
|
+
mediumPlus: 0.38,
|
|
24
|
+
large: 0.35,
|
|
25
|
+
largePlus: 0.36,
|
|
26
|
+
extraLarge: 0.37,
|
|
27
|
+
extraLargePlus: 0.37,
|
|
28
|
+
} as Readonly<ISize>,
|
|
29
|
+
lineHeight: {
|
|
30
|
+
extraSmall: 13,
|
|
31
|
+
extraSmallPlus: 16,
|
|
32
|
+
small: 19,
|
|
33
|
+
smallPlus: 20,
|
|
34
|
+
medium: 22,
|
|
35
|
+
mediumPlus: 25,
|
|
36
|
+
large: 28,
|
|
37
|
+
largePlus: 34,
|
|
38
|
+
extraLarge: 41,
|
|
39
|
+
extraLargePlus: 52,
|
|
40
|
+
} as Readonly<ISize>,
|
|
41
|
+
spacing: {
|
|
42
|
+
extraSmall: 8,
|
|
43
|
+
extraSmallPlus: 10,
|
|
44
|
+
small: 12,
|
|
45
|
+
smallPlus: 13,
|
|
46
|
+
medium: 16,
|
|
47
|
+
mediumPlus: 20,
|
|
48
|
+
large: 30,
|
|
49
|
+
largePlus: 40,
|
|
50
|
+
extraLarge: 48,
|
|
51
|
+
extraLargePlus: 56,
|
|
52
|
+
} as Readonly<ISize>,
|
|
53
|
+
borderRadius: {
|
|
54
|
+
extraSmall: 4,
|
|
55
|
+
extraSmallPlus: 6,
|
|
56
|
+
small: 8,
|
|
57
|
+
smallPlus: 10,
|
|
58
|
+
medium: 12,
|
|
59
|
+
mediumPlus: 13,
|
|
60
|
+
large: 14,
|
|
61
|
+
largePlus: 16,
|
|
62
|
+
extraLarge: 18,
|
|
63
|
+
extraLargePlus: 30,
|
|
64
|
+
} as Readonly<ISize>,
|
|
65
|
+
borderWidth: {
|
|
66
|
+
small: 1,
|
|
67
|
+
medium: 2,
|
|
68
|
+
large: 3,
|
|
69
|
+
} as Readonly<ISize>,
|
|
70
|
+
};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dimensions,
|
|
3
|
+
Platform,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
TextStyle,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import {Colors} from './colors';
|
|
9
|
+
import {CommonSizes} from './commonSizes';
|
|
10
|
+
import {Fonts} from './fonts';
|
|
11
|
+
|
|
12
|
+
export const screenComponentWidth = Dimensions.get('screen').width - 60;
|
|
13
|
+
export const screenWidth = Dimensions.get('screen').width;
|
|
14
|
+
export const screenHeight = Dimensions.get('screen').height;
|
|
15
|
+
export function justifyWidth(componentWidth: number) {
|
|
16
|
+
return (componentWidth / 2048) * screenWidth;
|
|
17
|
+
}
|
|
18
|
+
export function justifyHeight(componentHeigght: number) {
|
|
19
|
+
return (componentHeigght / 2048) * screenHeight;
|
|
20
|
+
}
|
|
21
|
+
export const CommonStyles = StyleSheet.create({
|
|
22
|
+
flex1: {
|
|
23
|
+
flex: 1,
|
|
24
|
+
backgroundColor: Colors.background,
|
|
25
|
+
} as ViewStyle,
|
|
26
|
+
flex1Transparent: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
backgroundColor: 'transparent',
|
|
29
|
+
} as ViewStyle,
|
|
30
|
+
flex1Padding: {
|
|
31
|
+
flex: 1,
|
|
32
|
+
paddingHorizontal: CommonSizes.spacing.large,
|
|
33
|
+
} as ViewStyle,
|
|
34
|
+
flex1PaddingTransparent: {
|
|
35
|
+
flex: 1,
|
|
36
|
+
paddingHorizontal: CommonSizes.spacing.large,
|
|
37
|
+
backgroundColor: 'transparent',
|
|
38
|
+
} as ViewStyle,
|
|
39
|
+
flexCenter: {
|
|
40
|
+
flex: 1,
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
backgroundColor: Colors.background,
|
|
44
|
+
} as ViewStyle,
|
|
45
|
+
flexColumnCenterStretch: {
|
|
46
|
+
flex: 1,
|
|
47
|
+
flexDirection: 'column',
|
|
48
|
+
alignItems: 'stretch',
|
|
49
|
+
justifyContent: 'flex-start',
|
|
50
|
+
backgroundColor: Colors.background,
|
|
51
|
+
} as ViewStyle,
|
|
52
|
+
listContentContainer: {
|
|
53
|
+
flexGrow: 1,
|
|
54
|
+
paddingHorizontal: CommonSizes.spacing.large,
|
|
55
|
+
paddingVertical: CommonSizes.spacing.medium,
|
|
56
|
+
} as ViewStyle,
|
|
57
|
+
rowCenter: {
|
|
58
|
+
flexDirection: 'row',
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
} as ViewStyle,
|
|
61
|
+
columnAlignStart: {
|
|
62
|
+
flexDirection: 'column',
|
|
63
|
+
alignItems: 'flex-start',
|
|
64
|
+
} as ViewStyle,
|
|
65
|
+
shadow: {
|
|
66
|
+
backgroundColor: Colors.white,
|
|
67
|
+
shadowColor: '#2D9CDB',
|
|
68
|
+
...Platform.select({
|
|
69
|
+
ios: {
|
|
70
|
+
shadowOffset: {
|
|
71
|
+
width: 0,
|
|
72
|
+
height: 2,
|
|
73
|
+
},
|
|
74
|
+
shadowOpacity: 0.23,
|
|
75
|
+
shadowRadius: 2.62,
|
|
76
|
+
} as ViewStyle,
|
|
77
|
+
android: {
|
|
78
|
+
elevation: 4,
|
|
79
|
+
} as ViewStyle,
|
|
80
|
+
}),
|
|
81
|
+
} as ViewStyle,
|
|
82
|
+
iPhoneXFooter: {
|
|
83
|
+
height: 20,
|
|
84
|
+
} as ViewStyle,
|
|
85
|
+
normalText: {
|
|
86
|
+
fontFamily: Fonts.regular,
|
|
87
|
+
fontSize: CommonSizes.font.medium,
|
|
88
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
89
|
+
color: Colors.black,
|
|
90
|
+
} as TextStyle,
|
|
91
|
+
h1_bold: {
|
|
92
|
+
fontFamily: Fonts.bold,
|
|
93
|
+
fontSize: CommonSizes.font.largePlus,
|
|
94
|
+
lineHeight: CommonSizes.lineHeight.largePlus,
|
|
95
|
+
color: Colors.black,
|
|
96
|
+
} as TextStyle,
|
|
97
|
+
h1_semiBold: {
|
|
98
|
+
fontFamily: Fonts.semiBold,
|
|
99
|
+
fontSize: CommonSizes.font.largePlus,
|
|
100
|
+
lineHeight: CommonSizes.lineHeight.largePlus,
|
|
101
|
+
color: Colors.black,
|
|
102
|
+
} as TextStyle,
|
|
103
|
+
h1_regular: {
|
|
104
|
+
fontFamily: Fonts.regular,
|
|
105
|
+
fontSize: CommonSizes.font.largePlus,
|
|
106
|
+
lineHeight: CommonSizes.lineHeight.largePlus,
|
|
107
|
+
color: Colors.black,
|
|
108
|
+
} as TextStyle,
|
|
109
|
+
h2_bold: {
|
|
110
|
+
fontFamily: Fonts.bold,
|
|
111
|
+
fontSize: CommonSizes.font.extraMedium,
|
|
112
|
+
lineHeight: CommonSizes.lineHeight.mediumPlus,
|
|
113
|
+
color: Colors.black,
|
|
114
|
+
} as TextStyle,
|
|
115
|
+
h2_semiBold: {
|
|
116
|
+
fontFamily: Fonts.semiBold,
|
|
117
|
+
fontSize: CommonSizes.font.extraMedium,
|
|
118
|
+
lineHeight: CommonSizes.lineHeight.mediumPlus,
|
|
119
|
+
color: Colors.black,
|
|
120
|
+
} as TextStyle,
|
|
121
|
+
h2_regular: {
|
|
122
|
+
fontFamily: Fonts.regular,
|
|
123
|
+
fontSize: CommonSizes.font.extraMedium,
|
|
124
|
+
lineHeight: CommonSizes.lineHeight.mediumPlus,
|
|
125
|
+
color: Colors.black,
|
|
126
|
+
} as TextStyle,
|
|
127
|
+
h3_bold: {
|
|
128
|
+
fontFamily: Fonts.bold,
|
|
129
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
130
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
131
|
+
color: Colors.black,
|
|
132
|
+
} as TextStyle,
|
|
133
|
+
h3_bold_underlined: {
|
|
134
|
+
fontFamily: Fonts.bold,
|
|
135
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
136
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
137
|
+
textDecorationLine: 'underline',
|
|
138
|
+
color: Colors.black,
|
|
139
|
+
} as TextStyle,
|
|
140
|
+
h3_semiBold: {
|
|
141
|
+
fontFamily: Fonts.semiBold,
|
|
142
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
143
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
144
|
+
color: Colors.black,
|
|
145
|
+
} as TextStyle,
|
|
146
|
+
h3_regular: {
|
|
147
|
+
fontFamily: Fonts.regular,
|
|
148
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
149
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
150
|
+
color: Colors.black,
|
|
151
|
+
} as TextStyle,
|
|
152
|
+
h4_bold: {
|
|
153
|
+
fontFamily: Fonts.bold,
|
|
154
|
+
fontSize: CommonSizes.font.medium,
|
|
155
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
156
|
+
color: Colors.black,
|
|
157
|
+
} as TextStyle,
|
|
158
|
+
h4_bold_underlined: {
|
|
159
|
+
fontFamily: Fonts.bold,
|
|
160
|
+
fontSize: CommonSizes.font.medium,
|
|
161
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
162
|
+
textDecorationLine: 'underline',
|
|
163
|
+
color: Colors.black,
|
|
164
|
+
} as TextStyle,
|
|
165
|
+
h4_semiBold: {
|
|
166
|
+
fontFamily: Fonts.semiBold,
|
|
167
|
+
fontSize: CommonSizes.font.medium,
|
|
168
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
169
|
+
color: Colors.black,
|
|
170
|
+
} as TextStyle,
|
|
171
|
+
h4_regular: {
|
|
172
|
+
fontFamily: Fonts.regular,
|
|
173
|
+
fontSize: CommonSizes.font.medium,
|
|
174
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
175
|
+
color: Colors.black,
|
|
176
|
+
} as TextStyle,
|
|
177
|
+
body_bold: {
|
|
178
|
+
fontFamily: Fonts.bold,
|
|
179
|
+
fontSize: CommonSizes.font.small,
|
|
180
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
181
|
+
color: Colors.black,
|
|
182
|
+
} as TextStyle,
|
|
183
|
+
body_bold_underlined: {
|
|
184
|
+
fontFamily: Fonts.bold,
|
|
185
|
+
fontSize: CommonSizes.font.small,
|
|
186
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
187
|
+
textDecorationLine: 'underline',
|
|
188
|
+
color: Colors.black,
|
|
189
|
+
} as TextStyle,
|
|
190
|
+
body_semiBold: {
|
|
191
|
+
fontFamily: Fonts.semiBold,
|
|
192
|
+
fontSize: CommonSizes.font.small,
|
|
193
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
194
|
+
color: Colors.black,
|
|
195
|
+
} as TextStyle,
|
|
196
|
+
body_regular: {
|
|
197
|
+
fontFamily: Fonts.regular,
|
|
198
|
+
fontSize: CommonSizes.font.small,
|
|
199
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
200
|
+
color: Colors.black,
|
|
201
|
+
} as TextStyle,
|
|
202
|
+
tabBar_bold: {
|
|
203
|
+
fontFamily: Fonts.bold,
|
|
204
|
+
fontSize: CommonSizes.font.extraSmallPlus,
|
|
205
|
+
lineHeight: CommonSizes.lineHeight.extraSmallPlus,
|
|
206
|
+
color: Colors.black,
|
|
207
|
+
} as TextStyle,
|
|
208
|
+
tabBar_regular: {
|
|
209
|
+
fontFamily: Fonts.regular,
|
|
210
|
+
fontSize: CommonSizes.font.extraSmallPlus,
|
|
211
|
+
lineHeight: CommonSizes.lineHeight.extraSmallPlus,
|
|
212
|
+
color: Colors.black,
|
|
213
|
+
} as TextStyle,
|
|
214
|
+
dropShadow: {
|
|
215
|
+
shadowColor: '#000',
|
|
216
|
+
shadowOffset: {
|
|
217
|
+
width: 0,
|
|
218
|
+
height: 2,
|
|
219
|
+
},
|
|
220
|
+
shadowOpacity: 0.25,
|
|
221
|
+
shadowRadius: 3.84,
|
|
222
|
+
|
|
223
|
+
elevation: 5,
|
|
224
|
+
} as ViewStyle,
|
|
225
|
+
textInputContainer: {
|
|
226
|
+
width: '100%',
|
|
227
|
+
} as ViewStyle,
|
|
228
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const Fonts = {
|
|
2
|
+
system: 'System',
|
|
3
|
+
thin: 'KumbhSans-Thin',
|
|
4
|
+
light: 'KumbhSans-Light',
|
|
5
|
+
extraLight: 'KumbhSans-ExtraLight',
|
|
6
|
+
regular: 'KumbhSans-Regular',
|
|
7
|
+
medium: 'KumbhSans-Medium',
|
|
8
|
+
semiBold: 'KumbhSans-SemiBold',
|
|
9
|
+
bold: 'KumbhSans-Bold',
|
|
10
|
+
extraBold: 'KumbhSans-ExtraBold',
|
|
11
|
+
black: 'KumbhSans-Black',
|
|
12
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {createNativeStackNavigator} from '@react-navigation/native-stack';
|
|
2
|
+
import {Login} from '../screens/Login/Login';
|
|
3
|
+
import {Splash} from '../screens/splash/Splash';
|
|
4
|
+
|
|
5
|
+
const Stack = createNativeStackNavigator();
|
|
6
|
+
|
|
7
|
+
const AuthScreens = [
|
|
8
|
+
{
|
|
9
|
+
id: 'Splash',
|
|
10
|
+
component: Splash,
|
|
11
|
+
options: {
|
|
12
|
+
headerShown: false,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 'Login',
|
|
17
|
+
component: Login,
|
|
18
|
+
options: {
|
|
19
|
+
headerShown: false,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export function AuthStack() {
|
|
25
|
+
return (
|
|
26
|
+
<Stack.Navigator
|
|
27
|
+
initialRouteName="Login"
|
|
28
|
+
screenOptions={{animation: 'none'}}>
|
|
29
|
+
{AuthScreens.map(s => (
|
|
30
|
+
<Stack.Screen
|
|
31
|
+
key={s.id}
|
|
32
|
+
name={s.id}
|
|
33
|
+
component={s.component}
|
|
34
|
+
options={s.options}
|
|
35
|
+
/>
|
|
36
|
+
))}
|
|
37
|
+
</Stack.Navigator>
|
|
38
|
+
);
|
|
39
|
+
}
|