@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
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { View, TouchableOpacity } from 'react-native';
4
- import Ionicons from 'react-native-vector-icons/Ionicons';
5
- import { Colors } from '../../configs/constants';
6
- import Text from '../Text';
7
- import style from './style';
8
-
9
- const Footer = ({ inverted, tabs }) => {
10
- const renderTab = () =>
11
- tabs.map((tab, index) => (
12
- <TouchableOpacity
13
- key={`tab-${index}`}
14
- style={style.tab}
15
- onPress={tab.onPress}
16
- >
17
- <Ionicons
18
- name={tab.icon}
19
- size={20}
20
- color={inverted ? Colors.white : Colors.darkblue}
21
- />
22
- <Text color={inverted ? 'white' : 'dark'} size='small'>
23
- {tab.text}
24
- </Text>
25
- {tab.badge && tab.badge > 0 && (
26
- <View style={style.badge}>
27
- <Text color='white' size='tiny' weight='semiBold' align='center'>
28
- {tab.badge > 9 ? '+9' : tab.badge}
29
- </Text>
30
- </View>
31
- )}
32
- </TouchableOpacity>
33
- ));
34
-
35
- return (
36
- <View
37
- style={[style.footerContainer, style[inverted ? 'inverted' : 'default']]}
38
- >
39
- {renderTab()}
40
- </View>
41
- );
42
- };
43
-
44
- Footer.defaultProps = {
45
- inverted: false,
46
- tabs: [],
47
- };
48
-
49
- Footer.propTypes = {
50
- inverted: PropTypes.bool,
51
- tabs: PropTypes.arrayOf(
52
- PropTypes.shape({
53
- onPress: PropTypes.func,
54
- text: PropTypes.string,
55
- icon: PropTypes.string,
56
- badge: PropTypes.number,
57
- })
58
- ),
59
- };
60
-
61
- export default Footer;
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { View, TouchableOpacity, Image } from 'react-native';
4
- import Ionicons from 'react-native-vector-icons/Ionicons';
5
- import { Colors } from '../../configs/constants';
6
- import style from './style';
7
-
8
- const Header = ({ inverted, logo, right, onMenuPress }) => (
9
- <View
10
- style={[style.headerContainer, style[inverted ? 'inverted' : 'default']]}
11
- >
12
- <TouchableOpacity onPress={onMenuPress}>
13
- <Ionicons
14
- name='menu-outline'
15
- size={30}
16
- color={inverted ? Colors.white : Colors.darkblue}
17
- />
18
- </TouchableOpacity>
19
- <View style={style.imageContainer}>
20
- <Image
21
- style={style.imageResponsive}
22
- source={logo}
23
- progressiveRenderingEnabled
24
- resizeMode='contain'
25
- />
26
- </View>
27
- {right}
28
- </View>
29
- );
30
-
31
- Header.defaultProps = {
32
- inverted: false,
33
- logo: null,
34
- right: null,
35
- onMenuPress: () => {},
36
- };
37
-
38
- Header.propTypes = {
39
- inverted: PropTypes.bool,
40
- logo: PropTypes.any.isRequired,
41
- right: PropTypes.node,
42
- onMenuPress: PropTypes.func,
43
- };
44
-
45
- export default Header;
@@ -1,39 +0,0 @@
1
- import React, { useState } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Image, View } from 'react-native';
4
- import style from './style';
5
-
6
- const ImageResponsive = ({ source, style: customStyle, avatar, ...props }) => {
7
- const [width, setWidth] = useState(100);
8
-
9
- return (
10
- <View
11
- style={[
12
- customStyle,
13
- avatar ? { borderRadius: width / 2, overflow: 'hidden' } : {},
14
- ]}
15
- >
16
- <Image
17
- style={style.responsiveImage}
18
- source={source}
19
- resizeMode={avatar ? 'cover' : 'contain'}
20
- onLayout={({ nativeEvent }) => setWidth(nativeEvent.layout.width)}
21
- {...props}
22
- />
23
- </View>
24
- );
25
- };
26
-
27
- ImageResponsive.defaultProps = {
28
- style: {},
29
- source: null,
30
- avatar: false,
31
- };
32
-
33
- ImageResponsive.propTypes = {
34
- style: PropTypes.any,
35
- source: PropTypes.any.isRequired,
36
- avatar: PropTypes.bool,
37
- };
38
-
39
- export default ImageResponsive;
@@ -1,7 +0,0 @@
1
- export default {
2
- responsiveImage: {
3
- height: undefined,
4
- width: undefined,
5
- flex: 1
6
- }
7
- };
@@ -1,62 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- View,
4
- Modal,
5
- TouchableOpacity,
6
- ActivityIndicator,
7
- Image,
8
- } from 'react-native';
9
- import Ionicons from 'react-native-vector-icons/Ionicons';
10
- import ImageResponsive from '../ImageResponsive';
11
- import { Colors } from '../../configs/constants';
12
- import style from './style';
13
- import PropTypes from 'prop-types';
14
-
15
- const ImageViewer = ({ source, style: imageStyle, ...props }) => {
16
- const [loading, setLoading] = useState(true);
17
- const [visible, setVisible] = useState(false);
18
-
19
- return (
20
- <>
21
- <TouchableOpacity onPress={() => setVisible(true)}>
22
- <ImageResponsive source={source} style={imageStyle} {...props} />
23
- </TouchableOpacity>
24
-
25
- <Modal
26
- animationType='slide'
27
- transparent={true}
28
- visible={visible}
29
- onRequestClose={() => {}}
30
- >
31
- <View style={style.container}>
32
- <TouchableOpacity
33
- onPress={() => setVisible(false)}
34
- style={style.closeIcon}
35
- >
36
- <Ionicons name='close-outline' size={24} color={Colors.darkblue} />
37
- </TouchableOpacity>
38
-
39
- <ImageResponsive
40
- source={source}
41
- style={style.body}
42
- onLoadEnd={() => setLoading(false)}
43
- />
44
-
45
- {loading && <ActivityIndicator style={style.activityIndicator} />}
46
- </View>
47
- </Modal>
48
- </>
49
- );
50
- };
51
-
52
- ImageViewer.defaultProps = {
53
- source: null,
54
- style: {},
55
- };
56
-
57
- ImageViewer.propTypes = {
58
- source: PropTypes.any.isRequired,
59
- style: PropTypes.any,
60
- };
61
-
62
- export default ImageViewer;
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { TouchableOpacity, View } from 'react-native';
4
- import Feather from 'react-native-vector-icons/Feather';
5
- import Text from '../Text';
6
- import { Colors } from '../../configs/constants';
7
- import style from './style';
8
-
9
- const MenuItem = ({icon, text, disabled, onPress, last}) => (
10
- <TouchableOpacity
11
- style={[
12
- style.menuItem,
13
- last ? style.last : {},
14
- disabled ? style.disabled : {}
15
- ]}
16
- onPress={onPress}
17
- disabled={disabled}
18
- >
19
- <View style={style.left}>
20
- {icon}
21
- <Text size='large' style={style.text}>{text}</Text>
22
- </View>
23
-
24
- <Feather name='chevron-right' size={15} color={Colors.darkblue} style={style.rightIcon} />
25
- </TouchableOpacity>
26
- );
27
-
28
- MenuItem.defaultProps = {
29
- icon: null,
30
- text: '',
31
- last: false,
32
- disabled: false,
33
- onPress: () => {}
34
- };
35
-
36
- MenuItem.propTypes = {
37
- icon: PropTypes.node,
38
- text: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
39
- last: PropTypes.bool,
40
- disabled: PropTypes.bool,
41
- onPress: PropTypes.func
42
- };
43
-
44
- export default MenuItem;
@@ -1,80 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { TouchableOpacity, View } from 'react-native';
4
- import Text from '../Text';
5
- import ImageResponsive from '../ImageResponsive';
6
- import { Colors } from '../../configs/constants';
7
- import Ionicons from 'react-native-vector-icons/Ionicons';
8
- import moment from 'moment';
9
- import style from './style';
10
-
11
- const Notification = ({
12
- first,
13
- active,
14
- hideAvatar,
15
- avatar,
16
- title,
17
- description,
18
- date = moment().fromNow(),
19
- onPress,
20
- }) => {
21
- return (
22
- <TouchableOpacity
23
- style={[
24
- style.container,
25
- first ? style.first : {},
26
- active ? style.active : {},
27
- ]}
28
- onPress={onPress}
29
- >
30
- {!hideAvatar && (
31
- <ImageResponsive source={avatar} avatar style={style.avatar} />
32
- )}
33
- <View style={style.textContainer}>
34
- <View style={style.text}>
35
- <View style={style.textInner}>
36
- <Text weight='semiBold'>{title}</Text>
37
- {active && (
38
- <Ionicons
39
- name='ellipse'
40
- color={Colors.green}
41
- size={12}
42
- style={style.icon}
43
- />
44
- )}
45
- </View>
46
- <Text color='light' size='tiny' style={style.time}>
47
- {moment(date).fromNow()}
48
- </Text>
49
- </View>
50
- <Text color='light' size='small' ellipsizeMode='tail' numberOfLines={3}>
51
- {description}
52
- </Text>
53
- </View>
54
- </TouchableOpacity>
55
- );
56
- };
57
-
58
- Notification.defaultProps = {
59
- first: false,
60
- active: false,
61
- hideAvatar: false,
62
- avatar: null,
63
- title: '',
64
- description: '',
65
- date: moment().fromNow(),
66
- onPress: () => {},
67
- };
68
-
69
- Notification.propTypes = {
70
- first: PropTypes.bool,
71
- active: PropTypes.bool,
72
- hideAvatar: PropTypes.bool,
73
- avatar: PropTypes.any,
74
- title: PropTypes.string,
75
- description: PropTypes.string,
76
- date: PropTypes.instanceOf(moment),
77
- onPress: PropTypes.func,
78
- };
79
-
80
- export default Notification;
@@ -1,21 +0,0 @@
1
- import React, { PureComponent } from 'react';
2
- import { debounce } from 'lodash';
3
-
4
- const withPreventDoubleClick = (WrappedComponent) => {
5
- class PreventDoubleClick extends PureComponent {
6
- debouncedOnPress = () => {
7
- this.props.onPress && this.props.onPress();
8
- }
9
-
10
- onPress = debounce(this.debouncedOnPress, 300, { leading: true, trailing: false });
11
-
12
- render() {
13
- return <WrappedComponent {...this.props} onPress={this.onPress} />;
14
- }
15
- }
16
-
17
- PreventDoubleClick.displayName = `withPreventDoubleClick(${WrappedComponent.displayName ||WrappedComponent.name})`
18
- return PreventDoubleClick;
19
- }
20
-
21
- export default withPreventDoubleClick;
@@ -1,89 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { View } from 'react-native';
3
- import PropTypes from 'prop-types';
4
- import DropDownPicker from 'react-native-dropdown-picker';
5
- import style, {
6
- includesSelect,
7
- placeholderStyle,
8
- listItemLabelStyle,
9
- listItemContainerStyle,
10
- selectedItemLabelStyle,
11
- textStyle,
12
- } from './style';
13
- import { useEffect } from 'react';
14
-
15
- const Select = ({
16
- value,
17
- onValueChange,
18
- items = [],
19
- variant = 'default',
20
- disabled,
21
- fitToContainer,
22
- placeholder,
23
- }) => {
24
- const [open, setOpen] = useState(false);
25
- const [val, setVal] = useState(value);
26
-
27
- useEffect(() => {
28
- setVal(value);
29
- }, [value]);
30
-
31
- return (
32
- <View
33
- style={[
34
- style.container,
35
- disabled ? style.disabled : {},
36
- fitToContainer ? style.fit : {},
37
- ]}
38
- >
39
- <DropDownPicker
40
- style={includesSelect[variant]}
41
- open={open}
42
- value={val}
43
- items={items}
44
- setOpen={setOpen}
45
- setValue={setVal}
46
- onSelectItem={(selected) => onValueChange(selected.value)}
47
- disabled={disabled}
48
- placeholder={placeholder}
49
- placeholderStyle={placeholderStyle}
50
- listItemLabelStyle={listItemLabelStyle}
51
- listItemContainerStyle={listItemContainerStyle}
52
- selectedItemLabelStyle={selectedItemLabelStyle}
53
- listMode='MODAL'
54
- textStyle={textStyle}
55
- dropDownContainerStyle={{
56
- ...includesSelect[variant],
57
- height: 'auto',
58
- }}
59
- />
60
- </View>
61
- );
62
- };
63
-
64
- Select.defaultProps = {
65
- variant: 'default',
66
- placeholder: ' ',
67
- disabled: false,
68
- fitToContainer: false,
69
- onValueChange: () => {},
70
- value: null,
71
- items: [],
72
- };
73
-
74
- Select.propTypes = {
75
- variant: PropTypes.oneOf(['default', 'completed', 'error']),
76
- placeholder: PropTypes.string.isRequired,
77
- disabled: PropTypes.bool,
78
- fitToContainer: PropTypes.bool,
79
- onValueChange: PropTypes.func,
80
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
81
- items: PropTypes.arrayOf(
82
- PropTypes.shape({
83
- label: PropTypes.string,
84
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
85
- })
86
- ),
87
- };
88
-
89
- export default Select;
@@ -1,81 +0,0 @@
1
- import { Dimensions } from 'react-native';
2
- import { Colors, borderRadius } from '../../configs/constants';
3
-
4
- const { width } = Dimensions.get('window');
5
-
6
- export default {
7
- container: {
8
- width: width - 60,
9
- position: 'relative',
10
- },
11
- fit: {
12
- width: '100%',
13
- position: 'relative',
14
- },
15
- selectIcon: {
16
- marginTop: 20,
17
- marginRight: 15,
18
- },
19
- disabled: {
20
- opacity: 0.5,
21
- },
22
- };
23
-
24
- const fontStyle = {
25
- color: Colors.darkblue,
26
- fontFamily: 'poppins_regular',
27
- };
28
-
29
- const basicStyle = {
30
- height: 50,
31
- width: '100%',
32
- borderRadius,
33
- borderWidth: 1,
34
- paddingHorizontal: 10,
35
- backgroundColor: Colors.white,
36
- marginVertical: 6,
37
- ...fontStyle,
38
- };
39
-
40
- export const includesSelect = {
41
- default: {
42
- ...basicStyle,
43
- borderColor: Colors.midblue,
44
- },
45
- completed: {
46
- ...basicStyle,
47
- borderColor: Colors.green,
48
- },
49
- error: {
50
- ...basicStyle,
51
- borderColor: Colors.red,
52
- color: Colors.red,
53
- },
54
- };
55
-
56
- export const placeholderStyle = {
57
- fontSize: 16,
58
- ...fontStyle,
59
- color: Colors.midblue,
60
- };
61
-
62
- export const listItemLabelStyle = {
63
- ...fontStyle,
64
- fontSize: 18,
65
- paddingHorizontal: 20,
66
- };
67
-
68
- export const listItemContainerStyle = {
69
- height: 55,
70
- borderBottomWidth: 1,
71
- borderBottomColor: Colors.gray,
72
- };
73
-
74
- export const selectedItemLabelStyle = {
75
- fontFamily: 'poppins_semiBold',
76
- };
77
-
78
- export const textStyle = {
79
- ...fontStyle,
80
- fontSize: 16,
81
- };
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Switch as RNSwitch, Platform } from 'react-native';
4
- import { Colors } from '../../configs/constants';
5
-
6
- const Switch = ({ value, size = 'medium', ...props }) => (
7
- <RNSwitch
8
- trackColor={{
9
- false: Colors.lightblue,
10
- true: Colors.lightblue,
11
- }}
12
- thumbColor={value ? Colors.green : Colors.midblue}
13
- ios_backgroundColor={Colors.white}
14
- value={value}
15
- style={{
16
- transform: [
17
- {
18
- scaleX:
19
- size === 'small'
20
- ? Platform.OS === 'ios'
21
- ? 0.5
22
- : 0.7
23
- : Platform.OS === 'ios'
24
- ? 0.7
25
- : 0.9,
26
- },
27
- {
28
- scaleY:
29
- size === 'small'
30
- ? Platform.OS === 'ios'
31
- ? 0.5
32
- : 0.7
33
- : Platform.OS === 'ios'
34
- ? 0.7
35
- : 0.9,
36
- },
37
- ],
38
- }}
39
- {...props}
40
- />
41
- );
42
-
43
- Switch.defaultProps = {
44
- onValueChange: () => {},
45
- value: false,
46
- disabled: false,
47
- size: 'medium',
48
- };
49
-
50
- Switch.propTypes = {
51
- onValueChange: PropTypes.func,
52
- value: PropTypes.bool,
53
- disabled: PropTypes.bool,
54
- size: PropTypes.oneOf(['medium', 'small']),
55
- };
56
-
57
- export default Switch;
@@ -1,64 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Modal, TouchableOpacity, View } from 'react-native';
4
- import Text from '../Text';
5
- import ImageResponsive from '../ImageResponsive';
6
- import style from './style';
7
-
8
- export const ConfirmPictureModal = ({
9
- avatar,
10
- visible,
11
- onRepeatPhoto,
12
- onUsePhoto,
13
- image,
14
- repeatPictureText,
15
- usePictureText,
16
- }) => {
17
- return (
18
- <Modal
19
- animationType='slide'
20
- transparent={false}
21
- visible={visible}
22
- onRequestClose={() => {}}
23
- >
24
- <View style={style.cameraTakenImageContainer}>
25
- <ImageResponsive
26
- source={{
27
- uri: image ? image.uri : null,
28
- cache: 'only-if-cached',
29
- }}
30
- style={avatar ? style.cameraTakenImage : style.cameraContainer}
31
- />
32
-
33
- <View style={style.cameraRetakePhoto}>
34
- <TouchableOpacity onPress={onRepeatPhoto}>
35
- <Text style={style.cameraRetakePhotoText}>{repeatPictureText}</Text>
36
- </TouchableOpacity>
37
- <TouchableOpacity onPress={onUsePhoto}>
38
- <Text style={style.cameraRetakePhotoText}>{usePictureText}</Text>
39
- </TouchableOpacity>
40
- </View>
41
- </View>
42
- </Modal>
43
- );
44
- };
45
-
46
- ConfirmPictureModal.defaultProps = {
47
- visible: false,
48
- avatar: false,
49
- repeatPictureText: ' ',
50
- usePictureText: ' ',
51
- image: null,
52
- onRepeatPhoto: () => {},
53
- onUsePhoto: () => {},
54
- };
55
-
56
- ConfirmPictureModal.propTypes = {
57
- visible: PropTypes.bool.isRequired,
58
- avatar: PropTypes.bool,
59
- repeatPictureText: PropTypes.string.isRequired,
60
- usePictureText: PropTypes.string.isRequired,
61
- image: PropTypes.object,
62
- onRepeatPhoto: PropTypes.func.isRequired,
63
- onUsePhoto: PropTypes.func.isRequired,
64
- };