new-react-native-boilerplate 0.0.0-stage → 1.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/LICENSE +21 -0
- package/README.md +329 -2
- package/package.json +49 -4
- package/run.sh +36 -0
- package/setup.js +141 -0
- package/template/.bundle/config +2 -0
- package/template/.editorconfig +14 -0
- package/template/.eslintrc.js +49 -0
- package/template/.husky/commit-msg +4 -0
- package/template/.husky/pre-commit +1 -0
- package/template/.prettierrc.js +6 -0
- package/template/.watchmanconfig +1 -0
- package/template/Gemfile +17 -0
- package/template/Gemfile.lock +114 -0
- package/template/README.md +101 -0
- package/template/__tests__/App.test.tsx +13 -0
- package/template/__tests__/CustomTextInput.test.jsx +29 -0
- package/template/android/app/build.gradle +119 -0
- package/template/android/app/debug.keystore +0 -0
- package/template/android/app/proguard-rules.pro +10 -0
- package/template/android/app/src/main/AndroidManifest.xml +27 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Bold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Medium.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Regular.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/futura_book.otf +0 -0
- package/template/android/app/src/main/assets/fonts/futura_medium.otf +0 -0
- package/template/android/app/src/main/java/com/boilerplatereactnative/MainActivity.kt +22 -0
- package/template/android/app/src/main/java/com/boilerplatereactnative/MainApplication.kt +27 -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 +49 -0
- package/template/android/gradlew +248 -0
- package/template/android/gradlew.bat +98 -0
- package/template/android/link-assets-manifest.json +29 -0
- package/template/android/settings.gradle +6 -0
- package/template/app.json +4 -0
- package/template/babel.config.js +43 -0
- package/template/eslint.config.mjs +175 -0
- package/template/index.d.ts +1 -0
- package/template/index.js +10 -0
- package/template/ios/.xcode.env +11 -0
- package/template/ios/BoilerPlateReactNative/AppDelegate.swift +11 -0
- package/template/ios/BoilerPlateReactNative/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/template/ios/BoilerPlateReactNative/Images.xcassets/Contents.json +6 -0
- package/template/ios/BoilerPlateReactNative/Info.plist +102 -0
- package/template/ios/BoilerPlateReactNative/LaunchScreen.storyboard +47 -0
- package/template/ios/BoilerPlateReactNative/PrivacyInfo.xcprivacy +37 -0
- package/template/ios/BoilerPlateReactNative/SceneDelegate.swift +54 -0
- package/template/ios/BoilerPlateReactNative.xcodeproj/project.pbxproj +531 -0
- package/template/ios/BoilerPlateReactNative.xcodeproj/xcshareddata/xcschemes/BoilerPlateReactNative.xcscheme +88 -0
- package/template/ios/BoilerPlateReactNative.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/BoilerPlateReactNative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/template/ios/Podfile +34 -0
- package/template/ios/Podfile.lock +2552 -0
- package/template/ios/link-assets-manifest.json +29 -0
- package/template/jest.config.js +13 -0
- package/template/jest.setup.js +30 -0
- package/template/metro.config.js +15 -0
- package/template/package.json +88 -0
- package/template/plugins/compile-js/_prompts.js +6 -0
- package/template/plugins/compile-js/index.js +9 -0
- package/template/plugins/compile-js/plugin.js +103 -0
- package/template/plugins/compile-js/tsconfig.build.json +20 -0
- package/template/plugins/index.js +46 -0
- package/template/plugins/printSuccess/_prompts.js +1 -0
- package/template/plugins/printSuccess/index.js +9 -0
- package/template/plugins/printSuccess/plugin.js +40 -0
- package/template/react-native.config.js +7 -0
- package/template/src/App.tsx +27 -0
- package/template/src/assets/fonts/Poppins-Bold.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Medium.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Regular.ttf +0 -0
- package/template/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/template/src/assets/fonts/futura_book.otf +0 -0
- package/template/src/assets/fonts/futura_medium.otf +0 -0
- package/template/src/assets/images/check.png +0 -0
- package/template/src/assets/images/check@2x.png +0 -0
- package/template/src/assets/images/check@3x.png +0 -0
- package/template/src/assets/images/email.png +0 -0
- package/template/src/assets/images/email@2x.png +0 -0
- package/template/src/assets/images/email@3x.png +0 -0
- package/template/src/assets/images/icBack.png +0 -0
- package/template/src/assets/images/icBack@2x.png +0 -0
- package/template/src/assets/images/icBack@3x.png +0 -0
- package/template/src/assets/images/icClose.png +0 -0
- package/template/src/assets/images/icClose@2x.png +0 -0
- package/template/src/assets/images/icClose@3x.png +0 -0
- package/template/src/assets/images/icComment.png +0 -0
- package/template/src/assets/images/icComment@2x.png +0 -0
- package/template/src/assets/images/icComment@3x.png +0 -0
- package/template/src/assets/images/icLike.png +0 -0
- package/template/src/assets/images/icLike@2x.png +0 -0
- package/template/src/assets/images/icLike@3x.png +0 -0
- package/template/src/assets/images/icSearch.png +0 -0
- package/template/src/assets/images/icSearch@2x.png +0 -0
- package/template/src/assets/images/icSearch@3x.png +0 -0
- package/template/src/assets/images/icSetting.png +0 -0
- package/template/src/assets/images/icSetting@2x.png +0 -0
- package/template/src/assets/images/icSetting@3x.png +0 -0
- package/template/src/assets/images/icShare.png +0 -0
- package/template/src/assets/images/icShare@2x.png +0 -0
- package/template/src/assets/images/icShare@3x.png +0 -0
- package/template/src/assets/images/line.png +0 -0
- package/template/src/assets/images/line@2x.png +0 -0
- package/template/src/assets/images/line@3x.png +0 -0
- package/template/src/assets/images/lock.png +0 -0
- package/template/src/assets/images/lock@2x.png +0 -0
- package/template/src/assets/images/lock@3x.png +0 -0
- package/template/src/assets/images/notification.png +0 -0
- package/template/src/assets/images/notification@2x.png +0 -0
- package/template/src/assets/images/notification@3x.png +0 -0
- package/template/src/assets/images/oct_dark.png +0 -0
- package/template/src/assets/images/oct_light.png +0 -0
- package/template/src/assets/images/onboard.png +0 -0
- package/template/src/assets/images/password_hide.png +0 -0
- package/template/src/assets/images/password_hide@2x.png +0 -0
- package/template/src/assets/images/password_hide@3x.png +0 -0
- package/template/src/assets/images/password_show.png +0 -0
- package/template/src/assets/images/password_show@2x.png +0 -0
- package/template/src/assets/images/password_show@3x.png +0 -0
- package/template/src/assets/images/right_arrow.png +0 -0
- package/template/src/assets/images/right_arrow@2x.png +0 -0
- package/template/src/assets/images/right_arrow@3x.png +0 -0
- package/template/src/assets/images/star.png +0 -0
- package/template/src/assets/images/star@2x.png +0 -0
- package/template/src/assets/images/star@3x.png +0 -0
- package/template/src/assets/images/uncheck.png +0 -0
- package/template/src/assets/images/uncheck@2x.png +0 -0
- package/template/src/assets/images/uncheck@3x.png +0 -0
- package/template/src/assets/images/user.png +0 -0
- package/template/src/assets/images/user@2x.png +0 -0
- package/template/src/assets/images/user@3x.png +0 -0
- package/template/src/components/atoms/ButtonContainer.tsx +52 -0
- package/template/src/components/atoms/ImageContainer.tsx +10 -0
- package/template/src/components/atoms/RemoteImage.tsx +8 -0
- package/template/src/components/atoms/RoundImageBorder.tsx +35 -0
- package/template/src/components/atoms/TextContainer.tsx +38 -0
- package/template/src/components/atoms/WrapperContainer.tsx +43 -0
- package/template/src/components/atoms/index.ts +6 -0
- package/template/src/components/molecules/AuthHeader.tsx +55 -0
- package/template/src/components/molecules/CustomTextInput.tsx +102 -0
- package/template/src/components/molecules/EmptyComp.tsx +16 -0
- package/template/src/components/molecules/ErrorComp.tsx +25 -0
- package/template/src/components/molecules/FooterView.tsx +41 -0
- package/template/src/components/molecules/HeaderComp.tsx +51 -0
- package/template/src/components/molecules/HomeHeader.tsx +63 -0
- package/template/src/components/molecules/HomeListHeader.tsx +48 -0
- package/template/src/components/molecules/HomeListItems.tsx +86 -0
- package/template/src/components/molecules/Loader.tsx +25 -0
- package/template/src/components/molecules/ModalSheet.tsx +146 -0
- package/template/src/components/molecules/RememberMe.tsx +58 -0
- package/template/src/components/molecules/SearchBar.tsx +46 -0
- package/template/src/components/molecules/index.ts +12 -0
- package/template/src/constants/apiConstant.ts +12 -0
- package/template/src/constants/fontFamily.ts +8 -0
- package/template/src/constants/imagePath.ts +25 -0
- package/template/src/constants/index.ts +3 -0
- package/template/src/constants/storageKeys.ts +5 -0
- package/template/src/models/ApiErrorResponse.ts +19 -0
- package/template/src/models/HomeData.ts +17 -0
- package/template/src/models/User.ts +11 -0
- package/template/src/navigations/AuthStack.tsx +20 -0
- package/template/src/navigations/MainStack.tsx +19 -0
- package/template/src/navigations/Routes.tsx +22 -0
- package/template/src/navigations/navigationProps.ts +8 -0
- package/template/src/redux/hooks.ts +10 -0
- package/template/src/redux/reducers/auth.ts +43 -0
- package/template/src/redux/reducers/common.ts +24 -0
- package/template/src/redux/reducers/index.ts +31 -0
- package/template/src/redux/reducers/product.ts +37 -0
- package/template/src/redux/reducers/settings.ts +55 -0
- package/template/src/redux/store.ts +19 -0
- package/template/src/redux/types.ts +6 -0
- package/template/src/screens/Home/Home.tsx +65 -0
- package/template/src/screens/Login/Login.tsx +35 -0
- package/template/src/screens/Login/components/LoginForm.tsx +88 -0
- package/template/src/screens/Login/hooks/useLogin.ts +38 -0
- package/template/src/screens/Login/styles.ts +17 -0
- package/template/src/screens/Login/types.ts +10 -0
- package/template/src/screens/Onboarding/Onboarding.tsx +87 -0
- package/template/src/screens/Onboarding/styles.ts +25 -0
- package/template/src/screens/PostDetails/PostDetails.tsx +168 -0
- package/template/src/screens/PostDetails/styles.ts +82 -0
- package/template/src/screens/Signup/Signup.tsx +32 -0
- package/template/src/screens/Signup/components/SignupForm.tsx +113 -0
- package/template/src/screens/Signup/hooks/useSignup.ts +38 -0
- package/template/src/screens/Signup/styles.ts +18 -0
- package/template/src/screens/Signup/type.ts +12 -0
- package/template/src/screens/index.ts +5 -0
- package/template/src/services/apiService.ts +144 -0
- package/template/src/services/authService.ts +79 -0
- package/template/src/services/productService.ts +45 -0
- package/template/src/services/statusHandler.ts +17 -0
- package/template/src/styles/breakpoints.ts +11 -0
- package/template/src/styles/themes.ts +45 -0
- package/template/src/styles/unistyles.ts +25 -0
- package/template/src/translations/ar.json +47 -0
- package/template/src/translations/en.json +47 -0
- package/template/src/translations/fr.json +47 -0
- package/template/src/translations/index.ts +32 -0
- package/template/src/typings/env.d.ts +5 -0
- package/template/src/typings/global.d.ts +3 -0
- package/template/src/utils/handleLocalStorage.ts +31 -0
- package/template/src/utils/i18nHelpers.ts +20 -0
- package/template/src/utils/index.ts +66 -0
- package/template/src/utils/scaling.ts +13 -0
- package/template/src/utils/themeHelpers.ts +10 -0
- package/template/src/utils/validationForm.ts +23 -0
- package/template/src/utils/validations.ts +69 -0
- package/template/tsconfig.json +22 -0
- package/template/yarn.lock +7728 -0
- package/template.config.js +6 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {TextContainer} from '@components/atoms';
|
|
2
|
+
import {moderateScale} from '@utils/scaling';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { PressableProps, ViewStyle} from 'react-native';
|
|
5
|
+
import {ActivityIndicator, Pressable} from 'react-native';
|
|
6
|
+
import {createStyleSheet, UnistylesRuntime, useStyles} from 'react-native-unistyles';
|
|
7
|
+
|
|
8
|
+
const stylesheet = createStyleSheet(theme => ({
|
|
9
|
+
btnStyle: (isDarkMode: boolean) => ({
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
backgroundColor: isDarkMode ? theme.colors.white : theme.colors.black,
|
|
12
|
+
borderRadius: moderateScale(8),
|
|
13
|
+
height: moderateScale(52),
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
}),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
interface CustomButtonProps extends PressableProps {
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
label: string;
|
|
21
|
+
style?: ViewStyle;
|
|
22
|
+
textStyle?: object;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ButtonContainer: React.FC<CustomButtonProps> = ({
|
|
26
|
+
isLoading,
|
|
27
|
+
label,
|
|
28
|
+
style,
|
|
29
|
+
textStyle,
|
|
30
|
+
...props
|
|
31
|
+
}) => {
|
|
32
|
+
const {styles, theme} = useStyles(stylesheet);
|
|
33
|
+
const isDarkMode = UnistylesRuntime.themeName === 'dark';
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Pressable style={[styles.btnStyle(isDarkMode), style]} {...props}>
|
|
37
|
+
{isLoading ? (
|
|
38
|
+
<ActivityIndicator color={isDarkMode ? theme.colors.black : theme.colors.white} />
|
|
39
|
+
) : (
|
|
40
|
+
<TextContainer
|
|
41
|
+
style={{
|
|
42
|
+
color: isDarkMode ? theme.colors.black : theme.colors.white,
|
|
43
|
+
...textStyle,
|
|
44
|
+
}}
|
|
45
|
+
text={label}
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
48
|
+
</Pressable>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default React.memo(ButtonContainer);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ImageProps} from "react-native";
|
|
3
|
+
import { Image as RNImage } from "react-native";
|
|
4
|
+
import { useStyles } from "react-native-unistyles";
|
|
5
|
+
|
|
6
|
+
const ImageContainer: React.FC<ImageProps> = ({ ...rest }) => {
|
|
7
|
+
const { theme } = useStyles();
|
|
8
|
+
return <RNImage tintColor={theme.colors.typography} {...rest} />;
|
|
9
|
+
};
|
|
10
|
+
export default ImageContainer;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { moderateScale } from "@utils/scaling";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { ImageProps} from "react-native";
|
|
4
|
+
import { Image as RNImage, View } from "react-native";
|
|
5
|
+
import { createStyleSheet, useStyles } from "react-native-unistyles";
|
|
6
|
+
|
|
7
|
+
const stylesheet = createStyleSheet((theme) => ({
|
|
8
|
+
container: {
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
backgroundColor: theme.colors.background,
|
|
11
|
+
borderColor: "rgba(90,90,90,0.5)",
|
|
12
|
+
borderRadius: moderateScale(25),
|
|
13
|
+
borderWidth: 0.5,
|
|
14
|
+
height: moderateScale(50),
|
|
15
|
+
justifyContent: "center",
|
|
16
|
+
width: moderateScale(50),
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
interface CustomImageProps extends ImageProps {
|
|
21
|
+
imageStyle?: object;
|
|
22
|
+
viewStyle?: object;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Define the component
|
|
26
|
+
const RoundImageBorder: React.FC<CustomImageProps> = ({ imageStyle, viewStyle, ...props }) => {
|
|
27
|
+
const { styles, theme } = useStyles(stylesheet);
|
|
28
|
+
return (
|
|
29
|
+
<View style={[styles.container, viewStyle]}>
|
|
30
|
+
<RNImage tintColor={theme.colors.darkwhite} {...props} />
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default React.memo(RoundImageBorder);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import fontFamily from "@constants/fontFamily";
|
|
2
|
+
import { scale } from "@utils/scaling";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import type { TextProps } from "react-native";
|
|
6
|
+
import { Text } from "react-native";
|
|
7
|
+
import { createStyleSheet, useStyles } from "react-native-unistyles";
|
|
8
|
+
|
|
9
|
+
const stylesheet = createStyleSheet((theme) => ({
|
|
10
|
+
sectionTitle: {
|
|
11
|
+
color: theme.colors.typography,
|
|
12
|
+
fontFamily: fontFamily.regular,
|
|
13
|
+
fontSize: scale(14),
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
interface TextContainterProps extends TextProps {
|
|
18
|
+
isDynamicText?: boolean;
|
|
19
|
+
style?: object;
|
|
20
|
+
text: "" | string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const TextContainer: React.FC<TextContainterProps> = ({
|
|
24
|
+
isDynamicText = false,
|
|
25
|
+
style,
|
|
26
|
+
text,
|
|
27
|
+
...rest
|
|
28
|
+
}) => {
|
|
29
|
+
const { t } = useTranslation();
|
|
30
|
+
const { styles } = useStyles(stylesheet);
|
|
31
|
+
return (
|
|
32
|
+
<Text style={[styles.sectionTitle, style]} {...rest}>
|
|
33
|
+
{isDynamicText ? text : t(text)}
|
|
34
|
+
</Text>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default React.memo(TextContainer);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StatusBar, View } from 'react-native';
|
|
4
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
5
|
+
import { createStyleSheet, useStyles } from 'react-native-unistyles';
|
|
6
|
+
|
|
7
|
+
const stylesheet = createStyleSheet(theme => ({
|
|
8
|
+
container: {
|
|
9
|
+
backgroundColor: theme.colors.background,
|
|
10
|
+
flex: 1,
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
type SectionProps = PropsWithChildren<{
|
|
15
|
+
isSafeAreaView?: boolean;
|
|
16
|
+
style?: object;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
const WrapperContainer = ({
|
|
20
|
+
children,
|
|
21
|
+
isSafeAreaView = true,
|
|
22
|
+
style,
|
|
23
|
+
}: SectionProps): React.JSX.Element => {
|
|
24
|
+
const {styles} = useStyles(stylesheet);
|
|
25
|
+
const {theme} = useStyles();
|
|
26
|
+
|
|
27
|
+
if (isSafeAreaView) {
|
|
28
|
+
return (
|
|
29
|
+
<SafeAreaView style={[styles.container, style]}>
|
|
30
|
+
<StatusBar barStyle={theme.colors.barStyle} />
|
|
31
|
+
{children}
|
|
32
|
+
</SafeAreaView>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return (
|
|
36
|
+
<View style={[styles.container, style]}>
|
|
37
|
+
<StatusBar barStyle={theme.colors.barStyle} />
|
|
38
|
+
{children}
|
|
39
|
+
</View>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default React.memo(WrapperContainer);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as ButtonContainer } from './ButtonContainer';
|
|
2
|
+
export { default as ImageContainer } from './ImageContainer';
|
|
3
|
+
export { default as RemoteImage } from './RemoteImage';
|
|
4
|
+
export { default as RoundImageBorder } from './RoundImageBorder';
|
|
5
|
+
export { default as TextContainer } from './TextContainer';
|
|
6
|
+
export { default as WrapperContainer } from './WrapperContainer';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ImageContainer, TextContainer } from "@components/atoms";
|
|
2
|
+
import fontFamily from "@constants/fontFamily";
|
|
3
|
+
import imagePath from "@constants/imagePath";
|
|
4
|
+
import { moderateScale, scale, verticalScale } from "@utils/scaling";
|
|
5
|
+
import type { PropsWithChildren } from "react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import type { ViewStyle } from "react-native";
|
|
8
|
+
import { View } from "react-native";
|
|
9
|
+
import { createStyleSheet, useStyles } from "react-native-unistyles";
|
|
10
|
+
|
|
11
|
+
const stylesheet = createStyleSheet(() => ({
|
|
12
|
+
descStyle: {
|
|
13
|
+
fontFamily: fontFamily.regular,
|
|
14
|
+
fontSize: scale(14),
|
|
15
|
+
lineHeight: scale(27),
|
|
16
|
+
marginBottom: verticalScale(24),
|
|
17
|
+
marginTop: verticalScale(8),
|
|
18
|
+
opacity: 0.5,
|
|
19
|
+
},
|
|
20
|
+
headerStyle: {
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
flexDirection: "row",
|
|
23
|
+
marginBottom: verticalScale(32),
|
|
24
|
+
},
|
|
25
|
+
titleStyle: {
|
|
26
|
+
fontFamily: fontFamily.semiBold,
|
|
27
|
+
fontSize: scale(27),
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
type SectionProps = PropsWithChildren<{
|
|
32
|
+
description: string;
|
|
33
|
+
style?: ViewStyle;
|
|
34
|
+
title: string;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
const AuthHeader = ({ description, style = {}, title }: SectionProps): React.JSX.Element => {
|
|
38
|
+
const { styles } = useStyles(stylesheet);
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
<View style={[styles.headerStyle, style]}>
|
|
42
|
+
<ImageContainer source={imagePath.icStar} />
|
|
43
|
+
<ImageContainer
|
|
44
|
+
resizeMode="cover"
|
|
45
|
+
source={imagePath.icLine}
|
|
46
|
+
style={{ marginLeft: moderateScale(16), width: "100%" }}
|
|
47
|
+
/>
|
|
48
|
+
</View>
|
|
49
|
+
<TextContainer style={styles.titleStyle} text={title} />
|
|
50
|
+
<TextContainer style={styles.descStyle} text={description} />
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default React.memo(AuthHeader);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {TextContainer} from '@components/atoms';
|
|
2
|
+
import fontFamily from '@constants/fontFamily';
|
|
3
|
+
import {moderateScale, scale, verticalScale} from '@utils/scaling';
|
|
4
|
+
import React, {forwardRef, Ref, useState} from 'react';
|
|
5
|
+
import {useTranslation} from 'react-i18next';
|
|
6
|
+
import type {ImageSourcePropType, TextInputInstance,TextInputProps} from 'react-native';
|
|
7
|
+
import { Pressable, TextInput, View} from 'react-native';
|
|
8
|
+
import {createStyleSheet, useStyles} from 'react-native-unistyles';
|
|
9
|
+
import ImageContainer from '../atoms/ImageContainer';
|
|
10
|
+
|
|
11
|
+
const stylesheet = createStyleSheet(theme => ({
|
|
12
|
+
errorText: {
|
|
13
|
+
color: theme.colors.danger,
|
|
14
|
+
fontFamily: fontFamily.medium,
|
|
15
|
+
fontSize: scale(12),
|
|
16
|
+
marginLeft: scale(2),
|
|
17
|
+
marginTop: verticalScale(5),
|
|
18
|
+
},
|
|
19
|
+
input: {
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
backgroundColor: theme.colors.textInputColor,
|
|
22
|
+
borderColor: 'rgba(217, 217, 217,1)',
|
|
23
|
+
borderRadius: moderateScale(10),
|
|
24
|
+
borderWidth: moderateScale(0.5),
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
height: moderateScale(52),
|
|
27
|
+
paddingHorizontal: moderateScale(12),
|
|
28
|
+
},
|
|
29
|
+
labelStyle: {
|
|
30
|
+
fontFamily: fontFamily.medium,
|
|
31
|
+
fontSize: scale(14),
|
|
32
|
+
marginBottom: moderateScale(8),
|
|
33
|
+
},
|
|
34
|
+
textInputStyle: {
|
|
35
|
+
color: theme.colors.typography,
|
|
36
|
+
flex: 1,
|
|
37
|
+
fontFamily: fontFamily.medium,
|
|
38
|
+
fontSize: scale(12),
|
|
39
|
+
height: moderateScale(52),
|
|
40
|
+
marginHorizontal: moderateScale(8),
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
interface CustomTextInputProps extends TextInputProps {
|
|
45
|
+
error?: null | string;
|
|
46
|
+
label: string;
|
|
47
|
+
leftImage?: ImageSourcePropType | null;
|
|
48
|
+
onChangeText: (text: string) => void;
|
|
49
|
+
onPressRight?: () => void;
|
|
50
|
+
placeholder: string;
|
|
51
|
+
rightImage?: ImageSourcePropType | null;
|
|
52
|
+
style?: object;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const CustomTextInput = forwardRef<TextInputInstance, CustomTextInputProps>(
|
|
56
|
+
(
|
|
57
|
+
{error, label, leftImage, onChangeText, onPressRight, placeholder, rightImage, style, ...rest},
|
|
58
|
+
ref,
|
|
59
|
+
) => {
|
|
60
|
+
const [text, setText] = useState('');
|
|
61
|
+
const {styles, theme} = useStyles(stylesheet);
|
|
62
|
+
const {t} = useTranslation();
|
|
63
|
+
|
|
64
|
+
const handleTextChange = (inputText: string) => {
|
|
65
|
+
setText(inputText);
|
|
66
|
+
if (onChangeText) {
|
|
67
|
+
onChangeText(inputText);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<View style={style}>
|
|
73
|
+
{label ? <TextContainer style={styles.labelStyle} text={label} /> : null}
|
|
74
|
+
<View style={styles.input}>
|
|
75
|
+
{leftImage ? (
|
|
76
|
+
<ImageContainer
|
|
77
|
+
resizeMode="contain"
|
|
78
|
+
source={leftImage}
|
|
79
|
+
style={{height: moderateScale(16), width: moderateScale(16)}}
|
|
80
|
+
/>
|
|
81
|
+
) : null}
|
|
82
|
+
<TextInput
|
|
83
|
+
onChangeText={handleTextChange}
|
|
84
|
+
placeholder={t(`${placeholder}`)}
|
|
85
|
+
placeholderTextColor={theme.colors.placeholder}
|
|
86
|
+
ref={ref}
|
|
87
|
+
style={styles.textInputStyle}
|
|
88
|
+
value={text}
|
|
89
|
+
{...rest}
|
|
90
|
+
/>
|
|
91
|
+
{rightImage ? (
|
|
92
|
+
<Pressable onPress={onPressRight}>
|
|
93
|
+
<ImageContainer source={rightImage} />
|
|
94
|
+
</Pressable>
|
|
95
|
+
) : null}
|
|
96
|
+
</View>
|
|
97
|
+
{error && <TextContainer style={styles.errorText} text={error} />}
|
|
98
|
+
</View>
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
);
|
|
102
|
+
export default React.memo(CustomTextInput);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { ActivityIndicator, View } from "react-native";
|
|
5
|
+
import ErrorComp from "./ErrorComp";
|
|
6
|
+
|
|
7
|
+
type EmptyCompType = {
|
|
8
|
+
isError: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
};
|
|
11
|
+
const EmptyComp: React.FC<EmptyCompType> = ({ isError, isLoading }): React.JSX.Element => {
|
|
12
|
+
const emptyComponent = isLoading ? <ActivityIndicator /> : isError ? <ErrorComp /> : <View />;
|
|
13
|
+
return emptyComponent;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default EmptyComp;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {TextContainer, WrapperContainer} from '@components/atoms';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {View} from 'react-native';
|
|
4
|
+
import {createStyleSheet, useStyles} from 'react-native-unistyles';
|
|
5
|
+
|
|
6
|
+
const stylesheet = createStyleSheet(() => ({
|
|
7
|
+
container: {
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
flex: 1,
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const ErrorComp = (): React.JSX.Element => {
|
|
15
|
+
const {styles} = useStyles(stylesheet);
|
|
16
|
+
return (
|
|
17
|
+
<WrapperContainer isSafeAreaView={false}>
|
|
18
|
+
<View style={styles.container}>
|
|
19
|
+
<TextContainer text="SOMETHING_WENT_WRONG" />
|
|
20
|
+
</View>
|
|
21
|
+
</WrapperContainer>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default React.memo(ErrorComp);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {TextContainer} from '@components/atoms';
|
|
2
|
+
import fontFamily from '@constants/fontFamily';
|
|
3
|
+
import {moderateScale} from '@utils/scaling';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type {GestureResponderEvent} from 'react-native';
|
|
6
|
+
import { View} from 'react-native';
|
|
7
|
+
import {createStyleSheet, useStyles} from 'react-native-unistyles';
|
|
8
|
+
|
|
9
|
+
const stylesheet = createStyleSheet(() => ({
|
|
10
|
+
bottomView: {
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
alignSelf: 'center',
|
|
13
|
+
flexDirection: 'row',
|
|
14
|
+
},
|
|
15
|
+
text: {
|
|
16
|
+
fontFamily: fontFamily.semiBold,
|
|
17
|
+
marginLeft: moderateScale(4),
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const FooterView = ({
|
|
22
|
+
linkPress,
|
|
23
|
+
linkText,
|
|
24
|
+
simpleText,
|
|
25
|
+
}: {
|
|
26
|
+
linkPress: ((event: GestureResponderEvent) => void) | undefined;
|
|
27
|
+
linkText: string;
|
|
28
|
+
simpleText: string;
|
|
29
|
+
}): React.JSX.Element => {
|
|
30
|
+
// Stylesheet declaration
|
|
31
|
+
const {styles} = useStyles(stylesheet);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={styles.bottomView}>
|
|
35
|
+
<TextContainer text={simpleText} />
|
|
36
|
+
<TextContainer onPress={linkPress} style={styles.text} text={linkText} />
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default FooterView;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import RoundImageBorder from "@components/atoms/RoundImageBorder";
|
|
2
|
+
import imagePath from "@constants/imagePath";
|
|
3
|
+
import { useNavigation } from "@react-navigation/native";
|
|
4
|
+
import { moderateScale } from "@utils/scaling";
|
|
5
|
+
import type { PropsWithChildren } from "react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import type { ImageSourcePropType} from "react-native";
|
|
8
|
+
import { Pressable, View } from "react-native";
|
|
9
|
+
import { createStyleSheet, useStyles } from "react-native-unistyles";
|
|
10
|
+
|
|
11
|
+
const stylesheet = createStyleSheet(() => ({
|
|
12
|
+
headerStyle: {
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
flexDirection: "row",
|
|
15
|
+
height: moderateScale(60),
|
|
16
|
+
justifyContent: "space-between",
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
type SectionProps = PropsWithChildren<{
|
|
21
|
+
leftImage?: ImageSourcePropType;
|
|
22
|
+
onPressLeft?: () => void;
|
|
23
|
+
onPressRight?: () => void;
|
|
24
|
+
rightImage?: ImageSourcePropType;
|
|
25
|
+
style?: object;
|
|
26
|
+
}>;
|
|
27
|
+
|
|
28
|
+
const HeaderComp = ({
|
|
29
|
+
leftImage = imagePath.icBack,
|
|
30
|
+
onPressLeft,
|
|
31
|
+
onPressRight,
|
|
32
|
+
rightImage = imagePath.icShare,
|
|
33
|
+
style,
|
|
34
|
+
}: SectionProps): React.JSX.Element => {
|
|
35
|
+
const navigation = useNavigation();
|
|
36
|
+
|
|
37
|
+
const { styles } = useStyles(stylesheet);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<View style={{ ...styles.headerStyle, ...style }}>
|
|
41
|
+
<Pressable onPress={onPressLeft || (() => navigation.goBack())}>
|
|
42
|
+
<RoundImageBorder source={leftImage} />
|
|
43
|
+
</Pressable>
|
|
44
|
+
<Pressable onPress={onPressRight}>
|
|
45
|
+
<RoundImageBorder source={rightImage} />
|
|
46
|
+
</Pressable>
|
|
47
|
+
</View>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default React.memo(HeaderComp);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ImageContainer, TextContainer } from "@components/atoms";
|
|
2
|
+
import fontFamily from "@constants/fontFamily";
|
|
3
|
+
import imagePath from "@constants/imagePath";
|
|
4
|
+
import { moderateScale, scale, verticalScale } from "@utils/scaling";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import type { PropsWithChildren } from "react";
|
|
7
|
+
import type { ViewStyle } from "react-native";
|
|
8
|
+
import { Image, Pressable, View } from "react-native";
|
|
9
|
+
import { createStyleSheet, useStyles } from "react-native-unistyles";
|
|
10
|
+
|
|
11
|
+
const stylesheet = createStyleSheet(() => ({
|
|
12
|
+
descStyle: {
|
|
13
|
+
fontFamily: fontFamily.regular,
|
|
14
|
+
fontSize: scale(14),
|
|
15
|
+
lineHeight: scale(27),
|
|
16
|
+
marginBottom: verticalScale(24),
|
|
17
|
+
marginTop: verticalScale(8),
|
|
18
|
+
opacity: 0.5,
|
|
19
|
+
},
|
|
20
|
+
headerStyle: {
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
flexDirection: "row",
|
|
23
|
+
height: moderateScale(60),
|
|
24
|
+
justifyContent: "space-between",
|
|
25
|
+
},
|
|
26
|
+
profileImage: {
|
|
27
|
+
borderRadius: moderateScale(25),
|
|
28
|
+
height: moderateScale(50),
|
|
29
|
+
width: moderateScale(50),
|
|
30
|
+
},
|
|
31
|
+
titleStyle: {
|
|
32
|
+
fontFamily: fontFamily.semiBold,
|
|
33
|
+
fontSize: scale(24),
|
|
34
|
+
lineHeight: scale(27),
|
|
35
|
+
},
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
type SectionProps = PropsWithChildren<{
|
|
39
|
+
onPress?: () => void;
|
|
40
|
+
style?: ViewStyle;
|
|
41
|
+
title?: string;
|
|
42
|
+
}>;
|
|
43
|
+
|
|
44
|
+
const HeaderComp = ({ onPress, style, title }: SectionProps): React.JSX.Element => {
|
|
45
|
+
const { styles } = useStyles(stylesheet);
|
|
46
|
+
return (
|
|
47
|
+
<View key="header" style={{ ...styles.headerStyle, ...style }}>
|
|
48
|
+
<Image
|
|
49
|
+
key="profileImage"
|
|
50
|
+
source={{
|
|
51
|
+
uri: "https://m.media-amazon.com/images/I/31Cd9UQp6eL._AC_UF1000,1000_QL80_.jpg",
|
|
52
|
+
}}
|
|
53
|
+
style={styles.profileImage}
|
|
54
|
+
/>
|
|
55
|
+
<TextContainer key="title" style={styles.titleStyle} text={`${title}`} />
|
|
56
|
+
<Pressable key="setting" onPress={onPress}>
|
|
57
|
+
<ImageContainer source={imagePath.icSetting} />
|
|
58
|
+
</Pressable>
|
|
59
|
+
</View>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default React.memo(HeaderComp);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {TextContainer} from '@components/atoms';
|
|
2
|
+
import fontFamily from '@constants/fontFamily';
|
|
3
|
+
import {moderateScale, scale, verticalScale} from '@utils/scaling';
|
|
4
|
+
import React, {memo} from 'react';
|
|
5
|
+
import {View} from 'react-native';
|
|
6
|
+
import {createStyleSheet, useStyles} from 'react-native-unistyles';
|
|
7
|
+
import SearchBar from './SearchBar';
|
|
8
|
+
|
|
9
|
+
const stylesheet = createStyleSheet(theme => ({
|
|
10
|
+
flexRow: {
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
justifyContent: 'space-between',
|
|
14
|
+
marginBottom: verticalScale(15),
|
|
15
|
+
marginHorizontal: moderateScale(20),
|
|
16
|
+
},
|
|
17
|
+
recommendTextStyle: {
|
|
18
|
+
fontFamily: fontFamily.medium,
|
|
19
|
+
fontSize: scale(18),
|
|
20
|
+
},
|
|
21
|
+
searchBarStyle: {
|
|
22
|
+
marginBottom: verticalScale(20),
|
|
23
|
+
marginHorizontal: moderateScale(16),
|
|
24
|
+
marginTop: verticalScale(28),
|
|
25
|
+
},
|
|
26
|
+
textStyle: {
|
|
27
|
+
color: theme.colors.typography,
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
const HomeListHeader: React.FC = memo(() => {
|
|
32
|
+
const {styles} = useStyles(stylesheet);
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<SearchBar
|
|
36
|
+
style={styles.searchBarStyle}
|
|
37
|
+
textStyle={styles.textStyle}
|
|
38
|
+
title="FIND_INTERESTING_BLOG"
|
|
39
|
+
/>
|
|
40
|
+
<View style={styles.flexRow}>
|
|
41
|
+
<TextContainer style={styles.recommendTextStyle} text="RECOMMEND" />
|
|
42
|
+
<TextContainer text="SEE_MORE" />
|
|
43
|
+
</View>
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export default React.memo(HomeListHeader);
|