@holper/react-native-holper-storybook 0.6.101 → 0.7.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 (210) hide show
  1. package/.expo/README.md +8 -0
  2. package/.nvmrc +1 -0
  3. package/.prettierignore +5 -0
  4. package/.storybook/index.jsx +11 -0
  5. package/.storybook/main.js +8 -0
  6. package/.storybook/preview.jsx +51 -0
  7. package/.storybook/storybook.requires.js +43 -0
  8. package/.yarn/releases/yarn-4.5.0.cjs +925 -0
  9. package/.yarnrc.yml +3 -0
  10. package/App.jsx +29 -0
  11. package/LICENSE +21 -0
  12. package/{readme.md → README.md} +18 -19
  13. package/app.config.js +77 -0
  14. package/assets/adaptive-icon.png +0 -0
  15. package/assets/favicon.png +0 -0
  16. package/assets/fonts/Poppins-Bold.ttf +0 -0
  17. package/assets/fonts/Poppins-Regular.ttf +0 -0
  18. package/assets/fonts/Poppins-SemiBold.ttf +0 -0
  19. package/assets/icon.png +0 -0
  20. package/assets/splash.png +0 -0
  21. package/babel.config.js +7 -0
  22. package/build.sh +11 -0
  23. package/components/Button/index.tsx +66 -0
  24. package/{lib/components/Button/style.js → components/Button/style.ts} +8 -7
  25. package/components/Card/index.tsx +33 -0
  26. package/{lib/components/Card/style.js → components/Card/style.ts} +5 -4
  27. package/{lib/components/ConfirmationModal/index.js → components/ConfirmationModal/index.tsx} +25 -79
  28. package/{lib/components/ConfirmationModal/style.js → components/ConfirmationModal/style.tsx} +14 -13
  29. package/{lib/components/Container/index.js → components/Container/index.tsx} +7 -28
  30. package/{lib/components/Container/style.js → components/Container/style.ts} +6 -5
  31. package/{lib/components/CustomChatView/index.js → components/CustomChatView/index.tsx} +22 -30
  32. package/{lib/components/CustomChatView/style.js → components/CustomChatView/style.ts} +1 -1
  33. package/components/DeckSwiper/index.tsx +90 -0
  34. package/{lib/components/DeckSwiper/style.js → components/DeckSwiper/style.ts} +13 -12
  35. package/components/DonutCountdown/index.tsx +86 -0
  36. package/components/DonutCountdown/style.ts +8 -0
  37. package/components/FloatingContainer/index.tsx +35 -0
  38. package/{lib/components/FloatingContainer/style.js → components/FloatingContainer/style.ts} +7 -6
  39. package/components/Footer/index.tsx +35 -0
  40. package/{lib/components/Footer/style.js → components/Footer/style.ts} +4 -3
  41. package/components/Header/index.tsx +21 -0
  42. package/{lib/components/Header/style.js → components/Header/style.ts} +4 -3
  43. package/{lib/components/ImagePicker/index.js → components/ImagePicker/index.tsx} +3 -12
  44. package/components/ImageResponsive/index.tsx +24 -0
  45. package/components/ImageResponsive/style.ts +9 -0
  46. package/components/ImageViewer/index.tsx +36 -0
  47. package/{lib/components/ImageViewer/style.js → components/ImageViewer/style.ts} +11 -10
  48. package/{lib/components/Input/index.js → components/Input/index.tsx} +6 -33
  49. package/{lib/components/Input/style.js → components/Input/style.ts} +7 -18
  50. package/{lib/components/InputPin/index.js → components/InputPin/index.tsx} +6 -13
  51. package/{lib/components/InputPin/style.js → components/InputPin/style.ts} +7 -6
  52. package/components/MenuItem/index.tsx +25 -0
  53. package/{lib/components/MenuItem/style.js → components/MenuItem/style.ts} +9 -7
  54. package/{lib/components/NavigationTitle/index.js → components/NavigationTitle/index.tsx} +9 -30
  55. package/{lib/components/NavigationTitle/style.js → components/NavigationTitle/style.ts} +12 -11
  56. package/components/Notification/index.tsx +44 -0
  57. package/{lib/components/Notification/style.js → components/Notification/style.ts} +13 -11
  58. package/components/PreventDoubleClick/index.tsx +28 -0
  59. package/components/Select/index.tsx +51 -0
  60. package/components/Select/style.ts +64 -0
  61. package/{lib/components/SwipeablePanel/index.js → components/SwipeablePanel/index.tsx} +58 -85
  62. package/{lib/components/SwipeablePanel/style.js → components/SwipeablePanel/style.ts} +15 -14
  63. package/components/Switch/index.tsx +30 -0
  64. package/components/TakePicture/confirmPictureModal.tsx +37 -0
  65. package/components/TakePicture/index.tsx +148 -0
  66. package/{lib/components/TakePicture/style.js → components/TakePicture/style.ts} +4 -4
  67. package/components/Text/index.tsx +33 -0
  68. package/{lib/components/Text/style.js → components/Text/style.ts} +4 -2
  69. package/{lib/components/Textarea/index.js → components/Textarea/index.tsx} +5 -24
  70. package/{lib/components/Textarea/style.js → components/Textarea/style.ts} +5 -4
  71. package/components/TimeOutButton/index.tsx +67 -0
  72. package/{lib/components/TimeOutButton/style.js → components/TimeOutButton/style.ts} +4 -3
  73. package/components/Toast/index.tsx +34 -0
  74. package/components/Toast/style.ts +12 -0
  75. package/{lib/components/UploadDocument/index.js → components/UploadDocument/index.tsx} +49 -105
  76. package/{lib/components/UploadDocument/style.js → components/UploadDocument/style.ts} +16 -15
  77. package/components/VirtualKeyboard/index.tsx +75 -0
  78. package/{lib/components/VirtualKeyboard/style.js → components/VirtualKeyboard/style.ts} +9 -8
  79. package/components/index.ts +29 -0
  80. package/{lib/configs/constants.js → configs/constants.ts} +50 -48
  81. package/configs/types.ts +326 -0
  82. package/eas.json +27 -0
  83. package/eslint.config.mjs +205 -0
  84. package/hooks/index.ts +2 -0
  85. package/{lib/hooks/useDebounce.js → hooks/useDebounce.tsx} +6 -4
  86. package/hooks/useLoadFonts.tsx +13 -0
  87. package/index.js +3 -2
  88. package/lib/components/Button/index.tsx +66 -0
  89. package/lib/components/Button/style.ts +111 -0
  90. package/lib/components/Card/index.tsx +33 -0
  91. package/lib/components/Card/style.ts +34 -0
  92. package/lib/components/ConfirmationModal/index.tsx +104 -0
  93. package/lib/components/ConfirmationModal/style.tsx +53 -0
  94. package/lib/components/Container/index.tsx +33 -0
  95. package/lib/components/Container/style.ts +13 -0
  96. package/lib/components/CustomChatView/index.tsx +65 -0
  97. package/lib/components/CustomChatView/style.ts +10 -0
  98. package/lib/components/DeckSwiper/index.tsx +90 -0
  99. package/lib/components/DeckSwiper/style.ts +59 -0
  100. package/lib/components/DonutCountdown/index.tsx +86 -0
  101. package/lib/components/DonutCountdown/style.ts +8 -0
  102. package/lib/components/FloatingContainer/index.tsx +35 -0
  103. package/lib/components/FloatingContainer/style.ts +25 -0
  104. package/lib/components/Footer/index.tsx +35 -0
  105. package/lib/components/Footer/style.ts +40 -0
  106. package/lib/components/Header/index.tsx +21 -0
  107. package/lib/components/Header/style.ts +34 -0
  108. package/lib/components/ImagePicker/index.tsx +18 -0
  109. package/lib/components/ImageResponsive/index.tsx +24 -0
  110. package/lib/components/ImageResponsive/style.ts +9 -0
  111. package/lib/components/ImageViewer/index.tsx +36 -0
  112. package/lib/components/ImageViewer/style.ts +38 -0
  113. package/lib/components/Input/index.tsx +62 -0
  114. package/lib/components/Input/style.ts +91 -0
  115. package/lib/components/InputPin/index.tsx +21 -0
  116. package/lib/components/InputPin/style.ts +22 -0
  117. package/lib/components/MenuItem/index.tsx +25 -0
  118. package/lib/components/MenuItem/style.ts +44 -0
  119. package/lib/components/NavigationTitle/index.tsx +53 -0
  120. package/lib/components/NavigationTitle/style.ts +49 -0
  121. package/lib/components/Notification/index.tsx +44 -0
  122. package/lib/components/Notification/style.ts +50 -0
  123. package/lib/components/PreventDoubleClick/index.tsx +28 -0
  124. package/lib/components/Select/index.tsx +51 -0
  125. package/lib/components/Select/style.ts +64 -0
  126. package/lib/components/SwipeablePanel/index.tsx +208 -0
  127. package/lib/components/SwipeablePanel/style.ts +81 -0
  128. package/lib/components/Switch/index.tsx +30 -0
  129. package/lib/components/TakePicture/confirmPictureModal.tsx +37 -0
  130. package/lib/components/TakePicture/index.tsx +148 -0
  131. package/lib/components/TakePicture/style.ts +95 -0
  132. package/lib/components/Text/index.tsx +33 -0
  133. package/lib/components/Text/style.ts +101 -0
  134. package/lib/components/Textarea/index.tsx +26 -0
  135. package/lib/components/Textarea/style.ts +38 -0
  136. package/lib/components/TimeOutButton/index.tsx +67 -0
  137. package/lib/components/TimeOutButton/style.ts +42 -0
  138. package/lib/components/Toast/index.tsx +34 -0
  139. package/lib/components/Toast/style.ts +12 -0
  140. package/lib/components/UploadDocument/index.tsx +179 -0
  141. package/lib/components/UploadDocument/style.ts +57 -0
  142. package/lib/components/VirtualKeyboard/index.tsx +75 -0
  143. package/lib/components/VirtualKeyboard/style.ts +25 -0
  144. package/lib/components/index.ts +29 -0
  145. package/lib/configs/constants.ts +273 -0
  146. package/lib/configs/types.ts +326 -0
  147. package/lib/hooks/index.ts +2 -0
  148. package/lib/hooks/useDebounce.tsx +24 -0
  149. package/lib/hooks/useLoadFonts.tsx +13 -0
  150. package/lib/index.js +3 -2
  151. package/metro.config.js +11 -0
  152. package/package.json +72 -63
  153. package/prettier.config.mjs +23 -0
  154. package/stories/Button.stories.tsx +181 -0
  155. package/stories/Card.stories.tsx +22 -0
  156. package/stories/Colors.stories.tsx +57 -0
  157. package/stories/ConfirmationModal.stories.tsx +142 -0
  158. package/stories/Container.stories.tsx +105 -0
  159. package/stories/DeckSwiper.stories.tsx +43 -0
  160. package/stories/DonutCountdown.stories.tsx +134 -0
  161. package/stories/FloatingContainer.stories.tsx +139 -0
  162. package/stories/Footer.stories.tsx +65 -0
  163. package/stories/Header.stories.tsx +37 -0
  164. package/stories/ImagePicker.stories.tsx +14 -0
  165. package/stories/ImageResponsive.stories.tsx +18 -0
  166. package/stories/ImageViewer.stories.tsx +24 -0
  167. package/stories/Input.stories.tsx +119 -0
  168. package/stories/InputPin.stories.tsx +40 -0
  169. package/stories/Menu.stories.tsx +53 -0
  170. package/stories/MenuItem.stories.tsx +30 -0
  171. package/stories/NavigationTitle.stories.tsx +51 -0
  172. package/stories/Notification.stories.tsx +58 -0
  173. package/stories/Select.stories.tsx +270 -0
  174. package/stories/SwipeablePanel.stories.tsx +360 -0
  175. package/stories/Switch.stories.tsx +36 -0
  176. package/stories/TakePicture.stories.tsx +59 -0
  177. package/stories/Text.stories.tsx +61 -0
  178. package/stories/Textarea.stories.tsx +48 -0
  179. package/stories/TimeOutButton.stories.tsx +55 -0
  180. package/stories/Toast.stories.tsx +37 -0
  181. package/stories/UploadDocument.stories.tsx +179 -0
  182. package/stories/VirtualKeyboard.stories.tsx +14 -0
  183. package/tsconfig.json +21 -0
  184. package/utilities/ScrollView.tsx +19 -0
  185. package/utilities/index.ts +2 -0
  186. package/utilities/utils.ts +29 -0
  187. package/lib/components/Button/index.js +0 -104
  188. package/lib/components/Card/index.js +0 -49
  189. package/lib/components/DeckSwiper/index.js +0 -118
  190. package/lib/components/FlashMessage/index.js +0 -81
  191. package/lib/components/FloatingContainer/index.js +0 -69
  192. package/lib/components/Footer/index.js +0 -61
  193. package/lib/components/Header/index.js +0 -45
  194. package/lib/components/ImageResponsive/index.js +0 -39
  195. package/lib/components/ImageResponsive/style.js +0 -7
  196. package/lib/components/ImageViewer/index.js +0 -62
  197. package/lib/components/MenuItem/index.js +0 -44
  198. package/lib/components/Notification/index.js +0 -80
  199. package/lib/components/PreventDoubleClick/index.js +0 -21
  200. package/lib/components/Select/index.js +0 -89
  201. package/lib/components/Select/style.js +0 -81
  202. package/lib/components/Switch/index.js +0 -57
  203. package/lib/components/TakePicture/confirmPictureModal.js +0 -64
  204. package/lib/components/TakePicture/index.js +0 -198
  205. package/lib/components/Text/index.js +0 -75
  206. package/lib/components/TimeOutButton/index.js +0 -104
  207. package/lib/components/VirtualKeyboard/index.js +0 -86
  208. package/lib/components/index.js +0 -28
  209. package/lib/configs/loadFonts.js +0 -11
  210. package/lib/hooks/index.js +0 -1
@@ -0,0 +1,62 @@
1
+ import { Text, TextInput, View } from 'react-native';
2
+
3
+ import { Colors } from '../../configs/constants';
4
+ import style from './style';
5
+
6
+ import type { InputProps } from '../../configs/types';
7
+
8
+ const Input = ({
9
+ variant = 'default',
10
+ size = 'fixed',
11
+ disabled,
12
+ leftIcon,
13
+ leftIconWide,
14
+ showLabel,
15
+ label,
16
+ count,
17
+ rightIcon,
18
+ value,
19
+ maxLength = 100,
20
+ ...props
21
+ }: InputProps) => (
22
+ <View style={style.container}>
23
+ {showLabel && <Text style={style.label}>{label}</Text>}
24
+ <View style={style.inputWrapper}>
25
+ <TextInput
26
+ style={[
27
+ style.input,
28
+ style[variant],
29
+ style[`${size}Size`],
30
+ leftIcon ? style.leftIcon : {},
31
+ leftIconWide ? style.leftIconWide : {},
32
+ disabled ? style.disabled : {},
33
+ ]}
34
+ editable={!disabled}
35
+ allowFontScaling={false}
36
+ placeholderTextColor={Colors.midblue}
37
+ value={value}
38
+ maxLength={maxLength}
39
+ {...props}
40
+ />
41
+ {leftIcon && (
42
+ <View
43
+ style={[
44
+ style.leftIconContainer,
45
+ leftIconWide ? style.leftWideIconContainer : {},
46
+ disabled ? style.disabled : {},
47
+ ]}
48
+ >
49
+ {leftIcon}
50
+ </View>
51
+ )}
52
+ {rightIcon && <View style={style.rightIconContainer}>{rightIcon}</View>}
53
+ </View>
54
+ {count && (
55
+ <Text style={style.count}>
56
+ {value?.length || 0}/{maxLength}
57
+ </Text>
58
+ )}
59
+ </View>
60
+ );
61
+
62
+ export default Input;
@@ -0,0 +1,91 @@
1
+ import { Dimensions, StyleSheet } from 'react-native';
2
+
3
+ import { borderRadius, Colors } from '../../configs/constants';
4
+
5
+ const { width } = Dimensions.get('window');
6
+
7
+ export default StyleSheet.create({
8
+ container: {
9
+ marginVertical: 8,
10
+ },
11
+ label: {
12
+ marginBottom: 4,
13
+ fontSize: 14,
14
+ fontFamily: 'poppins_regular',
15
+ color: Colors.darkblue,
16
+ fontWeight: 'bold',
17
+ },
18
+ inputWrapper: {
19
+ position: 'relative',
20
+ },
21
+ input: {
22
+ height: 50,
23
+ borderRadius,
24
+ borderWidth: 1,
25
+ paddingHorizontal: 20,
26
+ color: Colors.darkblue,
27
+ fontFamily: 'poppins_regular',
28
+ backgroundColor: Colors.white,
29
+ marginVertical: 6,
30
+ },
31
+ fixedSize: {
32
+ width: width - 60,
33
+ },
34
+ fitSize: {
35
+ width: '100%',
36
+ },
37
+ default: {
38
+ borderColor: Colors.midblue,
39
+ },
40
+ completed: {
41
+ borderColor: Colors.green,
42
+ },
43
+ error: {
44
+ borderColor: Colors.red,
45
+ color: Colors.red,
46
+ },
47
+ disabled: {
48
+ opacity: 0.5,
49
+ },
50
+ leftIcon: {
51
+ paddingLeft: 40,
52
+ },
53
+ rightIcon: {
54
+ paddingRight: 40,
55
+ },
56
+ leftIconWide: {
57
+ paddingLeft: 70,
58
+ },
59
+ rightIconWide: {
60
+ paddingRight: 70,
61
+ },
62
+ rightIconContainer: {
63
+ position: 'absolute',
64
+ right: 10,
65
+ top: 10,
66
+ height: 42,
67
+ justifyContent: 'center',
68
+ },
69
+ leftIconContainer: {
70
+ position: 'absolute',
71
+ left: 10,
72
+ top: 10,
73
+ height: 42,
74
+ justifyContent: 'center',
75
+ },
76
+ rightWideIconContainer: {
77
+ paddingLeft: 2,
78
+ borderLeftWidth: 1,
79
+ },
80
+ leftWideIconContainer: {
81
+ paddingRight: 2,
82
+ borderRightWidth: 1,
83
+ },
84
+ count: {
85
+ textAlign: 'right',
86
+ fontSize: 12,
87
+ color: Colors.gray,
88
+ fontFamily: 'poppins_regular',
89
+ width: '100%',
90
+ },
91
+ });
@@ -0,0 +1,21 @@
1
+ import { times } from 'lodash';
2
+ import { View } from 'react-native';
3
+
4
+ import Text from '../Text';
5
+ import style from './style';
6
+
7
+ import type { InputPinProps } from '../../configs/types';
8
+
9
+ const InputPin = ({ values = [] }: InputPinProps) => (
10
+ <View style={style.container}>
11
+ {times(4, (index) => (
12
+ <View style={style.input} key={`value-${index}`}>
13
+ <Text size="large" weight="semiBold">
14
+ {values[index]}
15
+ </Text>
16
+ </View>
17
+ ))}
18
+ </View>
19
+ );
20
+
21
+ export default InputPin;
@@ -0,0 +1,22 @@
1
+ import { Dimensions, StyleSheet } from 'react-native';
2
+
3
+ import { Colors } from '../../configs/constants';
4
+
5
+ const { width } = Dimensions.get('window');
6
+
7
+ export default StyleSheet.create({
8
+ container: {
9
+ flexDirection: 'row',
10
+ justifyContent: 'space-between',
11
+ width: width - 60,
12
+ },
13
+ input: {
14
+ borderColor: Colors.gray,
15
+ borderWidth: 1,
16
+ borderRadius: 15,
17
+ width: width / 6,
18
+ height: width / 6,
19
+ justifyContent: 'center',
20
+ alignItems: 'center',
21
+ },
22
+ });
@@ -0,0 +1,25 @@
1
+ import { Feather } from '@expo/vector-icons';
2
+ import { TouchableOpacity, View } from 'react-native';
3
+
4
+ import { Colors } from '../../configs/constants';
5
+ import Text from '../Text';
6
+ import style from './style';
7
+
8
+ import type { MenuItemProps } from '../../configs/types';
9
+
10
+ const MenuItem = ({ icon, text, disabled, onPress, last }: MenuItemProps) => (
11
+ <TouchableOpacity
12
+ style={[style.menuItem, last ? style.last : {}, disabled ? style.disabled : {}]}
13
+ onPress={onPress}
14
+ disabled={disabled}
15
+ >
16
+ <View style={style.left}>
17
+ {icon}
18
+ <Text style={style.text}>{text}</Text>
19
+ </View>
20
+
21
+ <Feather name="chevron-right" size={16} color={Colors.darkblue} style={style.rightIcon} />
22
+ </TouchableOpacity>
23
+ );
24
+
25
+ export default MenuItem;
@@ -0,0 +1,44 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ import { Colors } from '../../configs/constants';
4
+
5
+ export default StyleSheet.create({
6
+ // Default MenuItem
7
+ menuItem: {
8
+ backgroundColor: Colors.white,
9
+ width: '100%',
10
+ height: 50,
11
+ paddingHorizontal: 8,
12
+ paddingVertical: 6,
13
+ flexDirection: 'row',
14
+ justifyContent: 'space-between',
15
+ alignItems: 'center',
16
+ borderBottomWidth: 1,
17
+ borderBottomColor: Colors.lightblue,
18
+ },
19
+ left: {
20
+ flexDirection: 'row',
21
+ justifyContent: 'flex-start',
22
+ alignItems: 'center',
23
+ },
24
+ text: {
25
+ marginLeft: 10,
26
+ },
27
+ rightIcon: {
28
+ height: 20,
29
+ width: 20,
30
+ backgroundColor: Colors.lightblue,
31
+ borderRadius: 10,
32
+ paddingLeft: 3,
33
+ paddingTop: 2,
34
+ overflow: 'hidden',
35
+ justifyContent: 'center',
36
+ alignItems: 'center',
37
+ },
38
+ last: {
39
+ borderBottomColor: Colors.transparent,
40
+ },
41
+ disabled: {
42
+ opacity: 0.5,
43
+ },
44
+ });
@@ -0,0 +1,53 @@
1
+ import { Ionicons } from '@expo/vector-icons';
2
+ import { TouchableOpacity, View } from 'react-native';
3
+
4
+ import { Colors } from '../../configs/constants';
5
+ import Text from '../Text';
6
+ import style from './style';
7
+
8
+ import type { NavigationTitleProps } from '../../configs/types';
9
+
10
+ const NavigationTitle = ({
11
+ type = 'close',
12
+ title,
13
+ noShadow,
14
+ xlarge,
15
+ blockNavigation,
16
+ onPress,
17
+ }: NavigationTitleProps) => (
18
+ <View
19
+ style={[
20
+ style.container,
21
+ type === 'close' ? style.containerClose : style.containerBack,
22
+ noShadow ? style.noShadow : {},
23
+ ]}
24
+ >
25
+ {!blockNavigation && (
26
+ <>
27
+ {type === 'back' && (
28
+ <TouchableOpacity onPress={onPress} style={style.buttonBack}>
29
+ <Ionicons name="arrow-back-outline" size={20} color={Colors.darkblue} />
30
+ </TouchableOpacity>
31
+ )}
32
+ </>
33
+ )}
34
+ {typeof title === 'string' ? (
35
+ <Text size={xlarge ? 'extra-large' : 'large'} weight="semiBold">
36
+ {title}
37
+ </Text>
38
+ ) : (
39
+ <>{title}</>
40
+ )}
41
+ {!blockNavigation && (
42
+ <>
43
+ {type === 'close' && (
44
+ <TouchableOpacity onPress={onPress} style={style.button}>
45
+ <Ionicons name="close-outline" size={24} color={Colors.darkblue} />
46
+ </TouchableOpacity>
47
+ )}
48
+ </>
49
+ )}
50
+ </View>
51
+ );
52
+
53
+ export default NavigationTitle;
@@ -0,0 +1,49 @@
1
+ import { Dimensions, StyleSheet } from 'react-native';
2
+
3
+ import { Colors } from '../../configs/constants';
4
+
5
+ const { width } = Dimensions.get('window');
6
+
7
+ export default StyleSheet.create({
8
+ container: {
9
+ flexDirection: 'row',
10
+ alignItems: 'center',
11
+ height: 60,
12
+ backgroundColor: Colors.white,
13
+ paddingHorizontal: 20,
14
+ borderRadius: 10,
15
+ width,
16
+ shadowOffset: { width: 0, height: 3 },
17
+ shadowOpacity: 0.4,
18
+ shadowRadius: 3,
19
+ elevation: 5,
20
+ shadowColor: Colors.lightblue,
21
+ },
22
+ noShadow: {
23
+ shadowOpacity: 0,
24
+ elevation: 0,
25
+ },
26
+ containerClose: {
27
+ justifyContent: 'space-between',
28
+ },
29
+ containerBack: {
30
+ justifyContent: 'flex-start',
31
+ },
32
+ button: {
33
+ height: 30,
34
+ width: 30,
35
+ borderRadius: 15,
36
+ backgroundColor: Colors.lightblue,
37
+ alignItems: 'center',
38
+ justifyContent: 'center',
39
+ },
40
+ buttonBack: {
41
+ height: 30,
42
+ width: 30,
43
+ borderRadius: 15,
44
+ marginRight: 10,
45
+ backgroundColor: Colors.lightblue,
46
+ alignItems: 'center',
47
+ justifyContent: 'center',
48
+ },
49
+ });
@@ -0,0 +1,44 @@
1
+ import { Ionicons } from '@expo/vector-icons';
2
+ import dayjs from 'dayjs';
3
+ import relativeTime from 'dayjs/plugin/relativeTime';
4
+ import { TouchableOpacity, View } from 'react-native';
5
+
6
+ import { Colors } from '../../configs/constants';
7
+ import ImageResponsive from '../ImageResponsive';
8
+ import Text from '../Text';
9
+ import style from './style';
10
+
11
+ import type { NotificationProps } from '../../configs/types';
12
+
13
+ dayjs.extend(relativeTime);
14
+
15
+ const Notification = ({
16
+ first,
17
+ active,
18
+ hideAvatar,
19
+ avatar,
20
+ title,
21
+ description,
22
+ date = dayjs().fromNow(),
23
+ onPress,
24
+ }: NotificationProps) => (
25
+ <TouchableOpacity style={[style.container, first ? style.first : {}, active ? style.active : {}]} onPress={onPress}>
26
+ {!hideAvatar && <ImageResponsive source={avatar} avatar style={style.avatar} />}
27
+ <View style={style.textContainer}>
28
+ <View style={style.text}>
29
+ <View style={style.textInner}>
30
+ <Text weight="semiBold">{title}</Text>
31
+ {active && <Ionicons name="ellipse" color={Colors.green} size={12} style={style.icon} />}
32
+ </View>
33
+ <Text color="light" size="tiny" style={style.time}>
34
+ {dayjs(date).fromNow()}
35
+ </Text>
36
+ </View>
37
+ <Text color="light" size="small" ellipsizeMode="tail" numberOfLines={3}>
38
+ {description}
39
+ </Text>
40
+ </View>
41
+ </TouchableOpacity>
42
+ );
43
+
44
+ export default Notification;
@@ -0,0 +1,50 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ import { Colors } from '../../configs/constants';
4
+
5
+ export default StyleSheet.create({
6
+ container: {
7
+ flexDirection: 'row',
8
+ alignItems: 'center',
9
+ borderBottomWidth: 1,
10
+ borderBottomColor: Colors.lightblue,
11
+ paddingVertical: 8,
12
+ borderLeftWidth: 6,
13
+ borderLeftColor: Colors.transparent,
14
+ paddingHorizontal: 10,
15
+ },
16
+ first: {
17
+ borderTopWidth: 1,
18
+ borderTopColor: Colors.lightblue,
19
+ },
20
+ active: {
21
+ borderLeftColor: Colors.green,
22
+ },
23
+ avatar: {
24
+ height: 60,
25
+ width: 60,
26
+ borderWidth: 1,
27
+ borderColor: Colors.lightblue,
28
+ marginRight: 15,
29
+ },
30
+ textContainer: {
31
+ flex: 1,
32
+ justifyContent: 'space-evenly',
33
+ height: 60,
34
+ },
35
+ text: {
36
+ flexDirection: 'row',
37
+ justifyContent: 'space-between',
38
+ },
39
+ textInner: {
40
+ flexDirection: 'row',
41
+ alignItems: 'center',
42
+ },
43
+ time: {
44
+ alignSelf: 'flex-start',
45
+ },
46
+ icon: {
47
+ marginLeft: 5,
48
+ marginTop: 2,
49
+ },
50
+ });
@@ -0,0 +1,28 @@
1
+ import type { ComponentType } from 'react';
2
+
3
+ import { debounce } from 'lodash';
4
+ import { PureComponent } from 'react';
5
+
6
+ import type { withPreventDoubleClickProps } from '../../configs/types';
7
+
8
+ function withPreventDoubleClick<P extends withPreventDoubleClickProps>(WrappedComponent: ComponentType<P>) {
9
+ class PreventDoubleClick extends PureComponent<P> {
10
+ debouncedOnPress = () => {
11
+ if (this.props.onPress) {
12
+ this.props.onPress();
13
+ }
14
+ };
15
+
16
+ onPress = debounce(this.debouncedOnPress, 300, { leading: true, trailing: false });
17
+ static displayName: string;
18
+
19
+ render() {
20
+ return <WrappedComponent {...this.props} onPress={this.onPress} />;
21
+ }
22
+ }
23
+
24
+ PreventDoubleClick.displayName = `withPreventDoubleClick(${WrappedComponent.displayName || WrappedComponent.name})`;
25
+ return PreventDoubleClick;
26
+ }
27
+
28
+ export default withPreventDoubleClick;
@@ -0,0 +1,51 @@
1
+ import { Feather } from '@expo/vector-icons';
2
+ import { View } from 'react-native';
3
+ import RNPickerSelect from 'react-native-picker-select';
4
+
5
+ import style from './style';
6
+
7
+ import type { SelectProps } from '../../configs/types';
8
+
9
+ const Select = ({
10
+ disabled,
11
+ fitToContainer,
12
+ items = [],
13
+ onValueChange,
14
+ placeholder,
15
+ value = '',
16
+ variant = 'default',
17
+ }: SelectProps) => (
18
+ <View style={[style.container, disabled ? style.disabled : {}, fitToContainer ? style.fit : {}]}>
19
+ <RNPickerSelect
20
+ value={value}
21
+ onValueChange={(val) => onValueChange?.(val)}
22
+ disabled={disabled}
23
+ placeholder={{
24
+ label: placeholder,
25
+ value: '',
26
+ color: style.placeholderStyle.color,
27
+ }}
28
+ items={items}
29
+ Icon={() => <Feather name="chevron-down" size={24} style={style.iconStyle} />}
30
+ useNativeAndroidPickerStyle={false}
31
+ pickerProps={{ mode: 'dropdown', enabled: !disabled, itemStyle: style.itemStyle }}
32
+ style={{
33
+ inputIOSContainer: { pointerEvents: 'none', ...style.basicStyle, ...style[`${variant}Container`] },
34
+ inputAndroidContainer: { ...style.basicStyle, ...style[`${variant}Container`] },
35
+ inputIOS: {
36
+ ...style.fontStyle,
37
+ ...(variant === 'error' ? style.errorFontStyle : {}),
38
+ },
39
+ inputAndroid: {
40
+ ...style.fontStyle,
41
+ ...(variant === 'error' ? style.errorFontStyle : {}),
42
+ },
43
+ placeholder: style.placeholderStyle,
44
+ chevronUp: style.selectIcon,
45
+ chevronDown: style.selectIcon,
46
+ }}
47
+ />
48
+ </View>
49
+ );
50
+
51
+ export default Select;
@@ -0,0 +1,64 @@
1
+ import { Dimensions, StyleSheet } from 'react-native';
2
+
3
+ import { borderRadius, Colors } from '../../configs/constants';
4
+
5
+ const { width } = Dimensions.get('window');
6
+
7
+ export default StyleSheet.create({
8
+ container: {
9
+ width: width - 60,
10
+ position: 'relative',
11
+ },
12
+ fit: {
13
+ width: '100%',
14
+ position: 'relative',
15
+ },
16
+ selectIcon: {
17
+ marginTop: 20,
18
+ marginRight: 15,
19
+ },
20
+ disabled: {
21
+ opacity: 0.5,
22
+ },
23
+ basicStyle: {
24
+ height: 50,
25
+ width: '100%',
26
+ borderRadius,
27
+ borderWidth: 1,
28
+ paddingHorizontal: 10,
29
+ backgroundColor: Colors.white,
30
+ marginVertical: 6,
31
+ },
32
+ defaultContainer: {
33
+ borderColor: Colors.midblue,
34
+ },
35
+ completedContainer: {
36
+ borderColor: Colors.green,
37
+ },
38
+ errorContainer: {
39
+ borderColor: Colors.red,
40
+ },
41
+ fontStyle: {
42
+ flex: 1,
43
+ color: Colors.darkblue,
44
+ fontFamily: 'poppins_regular',
45
+ },
46
+ errorFontStyle: {
47
+ color: Colors.red,
48
+ },
49
+ placeholderStyle: {
50
+ fontSize: 14,
51
+ fontFamily: 'poppins_regular',
52
+ color: Colors.midblue,
53
+ },
54
+ iconStyle: {
55
+ marginRight: 10,
56
+ marginTop: 12,
57
+ color: Colors.darkblue,
58
+ },
59
+ itemStyle: {
60
+ color: Colors.darkblue,
61
+ fontFamily: 'poppins_regular',
62
+ fontSize: 16,
63
+ },
64
+ });