new-react-native-boilerplate 0.0.0-stage → 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.
Files changed (227) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +314 -2
  3. package/package.json +49 -4
  4. package/run.sh +36 -0
  5. package/setup.js +141 -0
  6. package/template/.bundle/config +2 -0
  7. package/template/.editorconfig +14 -0
  8. package/template/.eslintrc.js +49 -0
  9. package/template/.husky/commit-msg +4 -0
  10. package/template/.husky/pre-commit +1 -0
  11. package/template/.prettierrc.js +6 -0
  12. package/template/.watchmanconfig +1 -0
  13. package/template/Gemfile +17 -0
  14. package/template/Gemfile.lock +114 -0
  15. package/template/README.md +103 -0
  16. package/template/__tests__/App.test.tsx +13 -0
  17. package/template/__tests__/CustomTextInput.test.jsx +29 -0
  18. package/template/android/app/build.gradle +119 -0
  19. package/template/android/app/debug.keystore +0 -0
  20. package/template/android/app/proguard-rules.pro +10 -0
  21. package/template/android/app/src/main/AndroidManifest.xml +27 -0
  22. package/template/android/app/src/main/assets/fonts/Poppins-Bold.ttf +0 -0
  23. package/template/android/app/src/main/assets/fonts/Poppins-Medium.ttf +0 -0
  24. package/template/android/app/src/main/assets/fonts/Poppins-Regular.ttf +0 -0
  25. package/template/android/app/src/main/assets/fonts/Poppins-SemiBold.ttf +0 -0
  26. package/template/android/app/src/main/assets/fonts/futura_book.otf +0 -0
  27. package/template/android/app/src/main/assets/fonts/futura_medium.otf +0 -0
  28. package/template/android/app/src/main/java/com/boilerplatereactnative/MainActivity.kt +22 -0
  29. package/template/android/app/src/main/java/com/boilerplatereactnative/MainApplication.kt +27 -0
  30. package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  31. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  32. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  33. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  34. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  35. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  36. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  37. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  38. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  39. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  40. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  41. package/template/android/app/src/main/res/values/strings.xml +3 -0
  42. package/template/android/app/src/main/res/values/styles.xml +9 -0
  43. package/template/android/build.gradle +21 -0
  44. package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  45. package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  46. package/template/android/gradle.properties +49 -0
  47. package/template/android/gradlew +248 -0
  48. package/template/android/gradlew.bat +98 -0
  49. package/template/android/link-assets-manifest.json +29 -0
  50. package/template/android/settings.gradle +6 -0
  51. package/template/app.json +4 -0
  52. package/template/babel.config.js +43 -0
  53. package/template/eslint.config.mjs +175 -0
  54. package/template/index.d.ts +1 -0
  55. package/template/index.js +10 -0
  56. package/template/ios/.xcode.env +11 -0
  57. package/template/ios/BoilerPlateReactNative/AppDelegate.swift +11 -0
  58. package/template/ios/BoilerPlateReactNative/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  59. package/template/ios/BoilerPlateReactNative/Images.xcassets/Contents.json +6 -0
  60. package/template/ios/BoilerPlateReactNative/Info.plist +102 -0
  61. package/template/ios/BoilerPlateReactNative/LaunchScreen.storyboard +47 -0
  62. package/template/ios/BoilerPlateReactNative/PrivacyInfo.xcprivacy +37 -0
  63. package/template/ios/BoilerPlateReactNative/SceneDelegate.swift +54 -0
  64. package/template/ios/BoilerPlateReactNative.xcodeproj/project.pbxproj +531 -0
  65. package/template/ios/BoilerPlateReactNative.xcodeproj/xcshareddata/xcschemes/BoilerPlateReactNative.xcscheme +88 -0
  66. package/template/ios/BoilerPlateReactNative.xcworkspace/contents.xcworkspacedata +10 -0
  67. package/template/ios/BoilerPlateReactNative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  68. package/template/ios/Podfile +34 -0
  69. package/template/ios/Podfile.lock +2552 -0
  70. package/template/ios/link-assets-manifest.json +29 -0
  71. package/template/jest.config.js +13 -0
  72. package/template/jest.setup.js +30 -0
  73. package/template/metro.config.js +15 -0
  74. package/template/package.json +88 -0
  75. package/template/plugins/compile-js/_prompts.js +6 -0
  76. package/template/plugins/compile-js/index.js +9 -0
  77. package/template/plugins/compile-js/plugin.js +103 -0
  78. package/template/plugins/compile-js/tsconfig.build.json +20 -0
  79. package/template/plugins/index.js +46 -0
  80. package/template/plugins/printSuccess/_prompts.js +1 -0
  81. package/template/plugins/printSuccess/index.js +9 -0
  82. package/template/plugins/printSuccess/plugin.js +40 -0
  83. package/template/react-native.config.js +7 -0
  84. package/template/src/App.tsx +27 -0
  85. package/template/src/assets/fonts/Poppins-Bold.ttf +0 -0
  86. package/template/src/assets/fonts/Poppins-Medium.ttf +0 -0
  87. package/template/src/assets/fonts/Poppins-Regular.ttf +0 -0
  88. package/template/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
  89. package/template/src/assets/fonts/futura_book.otf +0 -0
  90. package/template/src/assets/fonts/futura_medium.otf +0 -0
  91. package/template/src/assets/images/check.png +0 -0
  92. package/template/src/assets/images/check@2x.png +0 -0
  93. package/template/src/assets/images/check@3x.png +0 -0
  94. package/template/src/assets/images/email.png +0 -0
  95. package/template/src/assets/images/email@2x.png +0 -0
  96. package/template/src/assets/images/email@3x.png +0 -0
  97. package/template/src/assets/images/icBack.png +0 -0
  98. package/template/src/assets/images/icBack@2x.png +0 -0
  99. package/template/src/assets/images/icBack@3x.png +0 -0
  100. package/template/src/assets/images/icClose.png +0 -0
  101. package/template/src/assets/images/icClose@2x.png +0 -0
  102. package/template/src/assets/images/icClose@3x.png +0 -0
  103. package/template/src/assets/images/icComment.png +0 -0
  104. package/template/src/assets/images/icComment@2x.png +0 -0
  105. package/template/src/assets/images/icComment@3x.png +0 -0
  106. package/template/src/assets/images/icLike.png +0 -0
  107. package/template/src/assets/images/icLike@2x.png +0 -0
  108. package/template/src/assets/images/icLike@3x.png +0 -0
  109. package/template/src/assets/images/icSearch.png +0 -0
  110. package/template/src/assets/images/icSearch@2x.png +0 -0
  111. package/template/src/assets/images/icSearch@3x.png +0 -0
  112. package/template/src/assets/images/icSetting.png +0 -0
  113. package/template/src/assets/images/icSetting@2x.png +0 -0
  114. package/template/src/assets/images/icSetting@3x.png +0 -0
  115. package/template/src/assets/images/icShare.png +0 -0
  116. package/template/src/assets/images/icShare@2x.png +0 -0
  117. package/template/src/assets/images/icShare@3x.png +0 -0
  118. package/template/src/assets/images/line.png +0 -0
  119. package/template/src/assets/images/line@2x.png +0 -0
  120. package/template/src/assets/images/line@3x.png +0 -0
  121. package/template/src/assets/images/lock.png +0 -0
  122. package/template/src/assets/images/lock@2x.png +0 -0
  123. package/template/src/assets/images/lock@3x.png +0 -0
  124. package/template/src/assets/images/notification.png +0 -0
  125. package/template/src/assets/images/notification@2x.png +0 -0
  126. package/template/src/assets/images/notification@3x.png +0 -0
  127. package/template/src/assets/images/oct_dark.png +0 -0
  128. package/template/src/assets/images/oct_light.png +0 -0
  129. package/template/src/assets/images/onboard.png +0 -0
  130. package/template/src/assets/images/password_hide.png +0 -0
  131. package/template/src/assets/images/password_hide@2x.png +0 -0
  132. package/template/src/assets/images/password_hide@3x.png +0 -0
  133. package/template/src/assets/images/password_show.png +0 -0
  134. package/template/src/assets/images/password_show@2x.png +0 -0
  135. package/template/src/assets/images/password_show@3x.png +0 -0
  136. package/template/src/assets/images/right_arrow.png +0 -0
  137. package/template/src/assets/images/right_arrow@2x.png +0 -0
  138. package/template/src/assets/images/right_arrow@3x.png +0 -0
  139. package/template/src/assets/images/star.png +0 -0
  140. package/template/src/assets/images/star@2x.png +0 -0
  141. package/template/src/assets/images/star@3x.png +0 -0
  142. package/template/src/assets/images/uncheck.png +0 -0
  143. package/template/src/assets/images/uncheck@2x.png +0 -0
  144. package/template/src/assets/images/uncheck@3x.png +0 -0
  145. package/template/src/assets/images/user.png +0 -0
  146. package/template/src/assets/images/user@2x.png +0 -0
  147. package/template/src/assets/images/user@3x.png +0 -0
  148. package/template/src/components/atoms/ButtonContainer.tsx +52 -0
  149. package/template/src/components/atoms/ImageContainer.tsx +10 -0
  150. package/template/src/components/atoms/RemoteImage.tsx +8 -0
  151. package/template/src/components/atoms/RoundImageBorder.tsx +35 -0
  152. package/template/src/components/atoms/TextContainer.tsx +38 -0
  153. package/template/src/components/atoms/WrapperContainer.tsx +43 -0
  154. package/template/src/components/atoms/index.ts +6 -0
  155. package/template/src/components/molecules/AuthHeader.tsx +55 -0
  156. package/template/src/components/molecules/CustomTextInput.tsx +102 -0
  157. package/template/src/components/molecules/EmptyComp.tsx +16 -0
  158. package/template/src/components/molecules/ErrorComp.tsx +25 -0
  159. package/template/src/components/molecules/FooterView.tsx +41 -0
  160. package/template/src/components/molecules/HeaderComp.tsx +51 -0
  161. package/template/src/components/molecules/HomeHeader.tsx +63 -0
  162. package/template/src/components/molecules/HomeListHeader.tsx +48 -0
  163. package/template/src/components/molecules/HomeListItems.tsx +86 -0
  164. package/template/src/components/molecules/Loader.tsx +25 -0
  165. package/template/src/components/molecules/ModalSheet.tsx +146 -0
  166. package/template/src/components/molecules/RememberMe.tsx +58 -0
  167. package/template/src/components/molecules/SearchBar.tsx +46 -0
  168. package/template/src/components/molecules/index.ts +12 -0
  169. package/template/src/constants/apiConstant.ts +12 -0
  170. package/template/src/constants/fontFamily.ts +8 -0
  171. package/template/src/constants/imagePath.ts +25 -0
  172. package/template/src/constants/index.ts +3 -0
  173. package/template/src/constants/storageKeys.ts +5 -0
  174. package/template/src/models/ApiErrorResponse.ts +19 -0
  175. package/template/src/models/HomeData.ts +17 -0
  176. package/template/src/models/User.ts +11 -0
  177. package/template/src/navigations/AuthStack.tsx +20 -0
  178. package/template/src/navigations/MainStack.tsx +19 -0
  179. package/template/src/navigations/Routes.tsx +22 -0
  180. package/template/src/navigations/navigationProps.ts +8 -0
  181. package/template/src/redux/hooks.ts +10 -0
  182. package/template/src/redux/reducers/auth.ts +43 -0
  183. package/template/src/redux/reducers/common.ts +24 -0
  184. package/template/src/redux/reducers/index.ts +31 -0
  185. package/template/src/redux/reducers/product.ts +37 -0
  186. package/template/src/redux/reducers/settings.ts +55 -0
  187. package/template/src/redux/store.ts +19 -0
  188. package/template/src/redux/types.ts +6 -0
  189. package/template/src/screens/Home/Home.tsx +65 -0
  190. package/template/src/screens/Login/Login.tsx +35 -0
  191. package/template/src/screens/Login/components/LoginForm.tsx +88 -0
  192. package/template/src/screens/Login/hooks/useLogin.ts +38 -0
  193. package/template/src/screens/Login/styles.ts +17 -0
  194. package/template/src/screens/Login/types.ts +10 -0
  195. package/template/src/screens/Onboarding/Onboarding.tsx +87 -0
  196. package/template/src/screens/Onboarding/styles.ts +25 -0
  197. package/template/src/screens/PostDetails/PostDetails.tsx +168 -0
  198. package/template/src/screens/PostDetails/styles.ts +82 -0
  199. package/template/src/screens/Signup/Signup.tsx +32 -0
  200. package/template/src/screens/Signup/components/SignupForm.tsx +113 -0
  201. package/template/src/screens/Signup/hooks/useSignup.ts +38 -0
  202. package/template/src/screens/Signup/styles.ts +18 -0
  203. package/template/src/screens/Signup/type.ts +12 -0
  204. package/template/src/screens/index.ts +5 -0
  205. package/template/src/services/apiService.ts +144 -0
  206. package/template/src/services/authService.ts +79 -0
  207. package/template/src/services/productService.ts +45 -0
  208. package/template/src/services/statusHandler.ts +17 -0
  209. package/template/src/styles/breakpoints.ts +11 -0
  210. package/template/src/styles/themes.ts +45 -0
  211. package/template/src/styles/unistyles.ts +25 -0
  212. package/template/src/translations/ar.json +47 -0
  213. package/template/src/translations/en.json +47 -0
  214. package/template/src/translations/fr.json +47 -0
  215. package/template/src/translations/index.ts +32 -0
  216. package/template/src/typings/env.d.ts +5 -0
  217. package/template/src/typings/global.d.ts +3 -0
  218. package/template/src/utils/handleLocalStorage.ts +31 -0
  219. package/template/src/utils/i18nHelpers.ts +20 -0
  220. package/template/src/utils/index.ts +66 -0
  221. package/template/src/utils/scaling.ts +13 -0
  222. package/template/src/utils/themeHelpers.ts +10 -0
  223. package/template/src/utils/validationForm.ts +23 -0
  224. package/template/src/utils/validations.ts +69 -0
  225. package/template/tsconfig.json +22 -0
  226. package/template/yarn.lock +7728 -0
  227. 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,8 @@
1
+ import React from "react";
2
+ import { Image as RNImage } from "react-native";
3
+ import type { ImageProps } from "react-native";
4
+
5
+ const RemoteImage: React.FC<ImageProps> = ({ ...rest }) => (
6
+ <RNImage {...rest} />
7
+ );
8
+ export default React.memo(RemoteImage);
@@ -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);