@holper/react-native-holper-storybook 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -3
- package/lib/components/Button/index.js +104 -0
- package/lib/components/Button/{style.ts → style.js} +7 -8
- package/lib/components/Card/index.js +49 -0
- package/lib/components/Card/{style.ts → style.js} +4 -5
- package/lib/components/ConfirmationModal/{index.tsx → index.js} +79 -25
- package/lib/components/ConfirmationModal/{style.tsx → style.js} +13 -14
- package/lib/components/Container/{index.tsx → index.js} +28 -7
- package/lib/components/Container/{style.ts → style.js} +5 -6
- package/lib/components/CustomChatView/{index.tsx → index.js} +30 -22
- package/lib/components/CustomChatView/{style.ts → style.js} +1 -1
- package/lib/components/DeckSwiper/index.js +118 -0
- package/lib/components/DeckSwiper/{style.ts → style.js} +12 -13
- package/lib/components/FlashMessage/index.js +83 -0
- package/lib/components/FloatingContainer/index.js +69 -0
- package/lib/components/FloatingContainer/{style.ts → style.js} +6 -7
- package/lib/components/Footer/index.js +61 -0
- package/lib/components/Footer/{style.ts → style.js} +3 -4
- package/lib/components/Header/index.js +45 -0
- package/lib/components/Header/{style.ts → style.js} +3 -4
- package/lib/components/ImagePicker/{index.tsx → index.js} +12 -3
- package/lib/components/ImageResponsive/index.js +39 -0
- package/lib/components/ImageResponsive/style.js +7 -0
- package/lib/components/ImageViewer/index.js +62 -0
- package/lib/components/ImageViewer/{style.ts → style.js} +3 -4
- package/lib/components/Input/{index.tsx → index.js} +33 -6
- package/lib/components/Input/{style.ts → style.js} +18 -7
- package/lib/components/InputPin/{index.tsx → index.js} +13 -6
- package/lib/components/InputPin/{style.ts → style.js} +6 -7
- package/lib/components/MenuItem/index.js +44 -0
- package/lib/components/MenuItem/{style.ts → style.js} +7 -9
- package/lib/components/NavigationTitle/{index.tsx → index.js} +30 -9
- package/lib/components/NavigationTitle/{style.ts → style.js} +11 -12
- package/lib/components/Notification/index.js +80 -0
- package/lib/components/Notification/{style.ts → style.js} +11 -13
- package/lib/components/PreventDoubleClick/index.js +21 -0
- package/lib/components/Select/index.js +89 -0
- package/lib/components/Select/style.js +81 -0
- package/lib/components/SwipeablePanel/{index.tsx → index.js} +85 -58
- package/lib/components/SwipeablePanel/{style.ts → style.js} +14 -15
- package/lib/components/Switch/index.js +57 -0
- package/lib/components/TakePicture/{confirmPictureModal.tsx → confirmPictureModal.js} +33 -9
- package/lib/components/TakePicture/index.js +198 -0
- package/lib/components/TakePicture/{style.ts → style.js} +4 -4
- package/lib/components/Text/index.js +75 -0
- package/lib/components/Text/{style.ts → style.js} +2 -4
- package/lib/components/Textarea/{index.tsx → index.js} +24 -5
- package/lib/components/Textarea/{style.ts → style.js} +4 -5
- package/lib/components/TimeOutButton/index.js +104 -0
- package/lib/components/TimeOutButton/{style.ts → style.js} +3 -4
- package/lib/components/UploadDocument/index.js +222 -0
- package/lib/components/UploadDocument/{style.ts → style.js} +15 -16
- package/lib/components/VirtualKeyboard/index.js +86 -0
- package/lib/components/VirtualKeyboard/{style.ts → style.js} +8 -9
- package/lib/components/index.js +28 -0
- package/lib/configs/constants.js +276 -0
- package/lib/configs/loadFonts.js +11 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/{useDebounce.tsx → useDebounce.js} +4 -6
- package/lib/index.js +2 -3
- package/package.json +58 -72
- package/{README.md → readme.md} +20 -19
- package/LICENSE +0 -21
- package/lib/components/Button/index.tsx +0 -66
- package/lib/components/Card/index.tsx +0 -33
- package/lib/components/DeckSwiper/index.tsx +0 -90
- package/lib/components/DonutCountdown/index.tsx +0 -86
- package/lib/components/DonutCountdown/style.ts +0 -8
- package/lib/components/FloatingContainer/index.tsx +0 -35
- package/lib/components/Footer/index.tsx +0 -35
- package/lib/components/Header/index.tsx +0 -21
- package/lib/components/ImageResponsive/index.tsx +0 -24
- package/lib/components/ImageResponsive/style.ts +0 -9
- package/lib/components/ImageViewer/index.tsx +0 -36
- package/lib/components/MenuItem/index.tsx +0 -25
- package/lib/components/Notification/index.tsx +0 -44
- package/lib/components/PreventDoubleClick/index.tsx +0 -28
- package/lib/components/Select/index.tsx +0 -51
- package/lib/components/Select/style.ts +0 -64
- package/lib/components/Switch/index.tsx +0 -30
- package/lib/components/TakePicture/index.tsx +0 -148
- package/lib/components/Text/index.tsx +0 -33
- package/lib/components/TimeOutButton/index.tsx +0 -67
- package/lib/components/Toast/index.tsx +0 -34
- package/lib/components/Toast/style.ts +0 -12
- package/lib/components/UploadDocument/index.tsx +0 -179
- package/lib/components/VirtualKeyboard/index.tsx +0 -75
- package/lib/components/index.ts +0 -29
- package/lib/configs/constants.ts +0 -273
- package/lib/configs/types.ts +0 -326
- package/lib/hooks/index.ts +0 -2
- package/lib/hooks/useLoadFonts.tsx +0 -13
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View, TextInput, Text } from 'react-native';
|
|
4
4
|
import style from './style';
|
|
5
|
-
|
|
6
|
-
import type { InputProps } from '../../configs/types';
|
|
5
|
+
import { Colors } from '../../configs/constants';
|
|
7
6
|
|
|
8
7
|
const Input = ({
|
|
9
8
|
variant = 'default',
|
|
@@ -18,7 +17,7 @@ const Input = ({
|
|
|
18
17
|
value,
|
|
19
18
|
maxLength = 100,
|
|
20
19
|
...props
|
|
21
|
-
}
|
|
20
|
+
}) => (
|
|
22
21
|
<View style={style.container}>
|
|
23
22
|
{showLabel && <Text style={style.label}>{label}</Text>}
|
|
24
23
|
<View style={style.inputWrapper}>
|
|
@@ -59,4 +58,32 @@ const Input = ({
|
|
|
59
58
|
</View>
|
|
60
59
|
);
|
|
61
60
|
|
|
61
|
+
Input.defaultProps = {
|
|
62
|
+
variant: 'default',
|
|
63
|
+
disabled: false,
|
|
64
|
+
leftIcon: null,
|
|
65
|
+
leftIconWide: false,
|
|
66
|
+
showLabel: false,
|
|
67
|
+
label: '',
|
|
68
|
+
count: false,
|
|
69
|
+
rightIcon: null,
|
|
70
|
+
value: '',
|
|
71
|
+
maxLength: 100,
|
|
72
|
+
size: 'fixed',
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
Input.propTypes = {
|
|
76
|
+
variant: PropTypes.oneOf(['default', 'completed', 'error']),
|
|
77
|
+
size: PropTypes.oneOf(['fixed', 'fit']),
|
|
78
|
+
disabled: PropTypes.bool,
|
|
79
|
+
leftIcon: PropTypes.node,
|
|
80
|
+
leftIconWide: PropTypes.bool,
|
|
81
|
+
showLabel: PropTypes.bool,
|
|
82
|
+
label: PropTypes.string,
|
|
83
|
+
count: PropTypes.bool,
|
|
84
|
+
rightIcon: PropTypes.node,
|
|
85
|
+
value: PropTypes.string,
|
|
86
|
+
maxLength: PropTypes.number,
|
|
87
|
+
};
|
|
88
|
+
|
|
62
89
|
export default Input;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Dimensions
|
|
2
|
-
|
|
3
|
-
import { borderRadius, Colors } from '../../configs/constants';
|
|
1
|
+
import { Dimensions } from 'react-native';
|
|
2
|
+
import { Colors, borderRadius } from '../../configs/constants';
|
|
4
3
|
|
|
5
4
|
const { width } = Dimensions.get('window');
|
|
6
5
|
|
|
7
|
-
export default
|
|
6
|
+
export default {
|
|
8
7
|
container: {
|
|
9
8
|
marginVertical: 8,
|
|
10
9
|
},
|
|
@@ -81,11 +80,23 @@ export default StyleSheet.create({
|
|
|
81
80
|
paddingRight: 2,
|
|
82
81
|
borderRightWidth: 1,
|
|
83
82
|
},
|
|
83
|
+
rightIconContainer: {
|
|
84
|
+
position: 'absolute',
|
|
85
|
+
right: 10,
|
|
86
|
+
top: 10,
|
|
87
|
+
height: 42,
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
},
|
|
84
90
|
count: {
|
|
85
91
|
textAlign: 'right',
|
|
86
92
|
fontSize: 12,
|
|
87
93
|
color: Colors.gray,
|
|
88
94
|
fontFamily: 'poppins_regular',
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
95
|
+
fixedSize: {
|
|
96
|
+
width: width - 80,
|
|
97
|
+
},
|
|
98
|
+
fitSize: {
|
|
99
|
+
width: '100%',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import { View } from 'react-native';
|
|
3
|
-
|
|
4
|
+
import { times } from 'lodash';
|
|
4
5
|
import Text from '../Text';
|
|
5
6
|
import style from './style';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const InputPin = ({ values = [] }: InputPinProps) => (
|
|
8
|
+
const InputPin = ({ values = [] }) => (
|
|
10
9
|
<View style={style.container}>
|
|
11
10
|
{times(4, (index) => (
|
|
12
11
|
<View style={style.input} key={`value-${index}`}>
|
|
13
|
-
<Text size=
|
|
12
|
+
<Text size='large' weight='semiBold'>
|
|
14
13
|
{values[index]}
|
|
15
14
|
</Text>
|
|
16
15
|
</View>
|
|
@@ -18,4 +17,12 @@ const InputPin = ({ values = [] }: InputPinProps) => (
|
|
|
18
17
|
</View>
|
|
19
18
|
);
|
|
20
19
|
|
|
20
|
+
InputPin.defaultProps = {
|
|
21
|
+
values: [],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
InputPin.propTypes = {
|
|
25
|
+
values: PropTypes.arrayOf(PropTypes.number),
|
|
26
|
+
};
|
|
27
|
+
|
|
21
28
|
export default InputPin;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {Dimensions} from 'react-native';
|
|
3
2
|
import { Colors } from '../../configs/constants';
|
|
4
3
|
|
|
5
4
|
const { width } = Dimensions.get('window');
|
|
6
5
|
|
|
7
|
-
export default
|
|
6
|
+
export default {
|
|
8
7
|
container: {
|
|
9
8
|
flexDirection: 'row',
|
|
10
9
|
justifyContent: 'space-between',
|
|
11
|
-
width: width - 60
|
|
10
|
+
width: width - 60
|
|
12
11
|
},
|
|
13
12
|
input: {
|
|
14
13
|
borderColor: Colors.gray,
|
|
@@ -17,6 +16,6 @@ export default StyleSheet.create({
|
|
|
17
16
|
width: width / 6,
|
|
18
17
|
height: width / 6,
|
|
19
18
|
justifyContent: 'center',
|
|
20
|
-
alignItems: 'center'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
19
|
+
alignItems: 'center'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
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,8 +1,6 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
1
|
import { Colors } from '../../configs/constants';
|
|
4
2
|
|
|
5
|
-
export default
|
|
3
|
+
export default {
|
|
6
4
|
// Default MenuItem
|
|
7
5
|
menuItem: {
|
|
8
6
|
backgroundColor: Colors.white,
|
|
@@ -14,7 +12,7 @@ export default StyleSheet.create({
|
|
|
14
12
|
justifyContent: 'space-between',
|
|
15
13
|
alignItems: 'center',
|
|
16
14
|
borderBottomWidth: 1,
|
|
17
|
-
borderBottomColor: Colors.lightblue
|
|
15
|
+
borderBottomColor: Colors.lightblue
|
|
18
16
|
},
|
|
19
17
|
left: {
|
|
20
18
|
flexDirection: 'row',
|
|
@@ -22,7 +20,7 @@ export default StyleSheet.create({
|
|
|
22
20
|
alignItems: 'center',
|
|
23
21
|
},
|
|
24
22
|
text: {
|
|
25
|
-
marginLeft: 10
|
|
23
|
+
marginLeft: 10
|
|
26
24
|
},
|
|
27
25
|
rightIcon: {
|
|
28
26
|
height: 20,
|
|
@@ -36,9 +34,9 @@ export default StyleSheet.create({
|
|
|
36
34
|
alignItems: 'center',
|
|
37
35
|
},
|
|
38
36
|
last: {
|
|
39
|
-
borderBottomColor: Colors.transparent
|
|
37
|
+
borderBottomColor: Colors.transparent
|
|
40
38
|
},
|
|
41
39
|
disabled: {
|
|
42
|
-
opacity: 0.5
|
|
43
|
-
}
|
|
44
|
-
}
|
|
40
|
+
opacity: 0.5
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { Colors } from '../../configs/constants';
|
|
4
|
+
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
5
5
|
import Text from '../Text';
|
|
6
|
+
import { Colors } from '../../configs/constants';
|
|
6
7
|
import style from './style';
|
|
7
8
|
|
|
8
|
-
import type { NavigationTitleProps } from '../../configs/types';
|
|
9
|
-
|
|
10
9
|
const NavigationTitle = ({
|
|
11
10
|
type = 'close',
|
|
12
11
|
title,
|
|
@@ -14,7 +13,7 @@ const NavigationTitle = ({
|
|
|
14
13
|
xlarge,
|
|
15
14
|
blockNavigation,
|
|
16
15
|
onPress,
|
|
17
|
-
}
|
|
16
|
+
}) => (
|
|
18
17
|
<View
|
|
19
18
|
style={[
|
|
20
19
|
style.container,
|
|
@@ -26,13 +25,17 @@ const NavigationTitle = ({
|
|
|
26
25
|
<>
|
|
27
26
|
{type === 'back' && (
|
|
28
27
|
<TouchableOpacity onPress={onPress} style={style.buttonBack}>
|
|
29
|
-
<Ionicons
|
|
28
|
+
<Ionicons
|
|
29
|
+
name='arrow-back-outline'
|
|
30
|
+
size={20}
|
|
31
|
+
color={Colors.darkblue}
|
|
32
|
+
/>
|
|
30
33
|
</TouchableOpacity>
|
|
31
34
|
)}
|
|
32
35
|
</>
|
|
33
36
|
)}
|
|
34
37
|
{typeof title === 'string' ? (
|
|
35
|
-
<Text size={xlarge ? 'extra-large' : 'large'} weight=
|
|
38
|
+
<Text size={xlarge ? 'extra-large' : 'large'} weight='semiBold'>
|
|
36
39
|
{title}
|
|
37
40
|
</Text>
|
|
38
41
|
) : (
|
|
@@ -42,7 +45,7 @@ const NavigationTitle = ({
|
|
|
42
45
|
<>
|
|
43
46
|
{type === 'close' && (
|
|
44
47
|
<TouchableOpacity onPress={onPress} style={style.button}>
|
|
45
|
-
<Ionicons name=
|
|
48
|
+
<Ionicons name='close-outline' size={24} color={Colors.darkblue} />
|
|
46
49
|
</TouchableOpacity>
|
|
47
50
|
)}
|
|
48
51
|
</>
|
|
@@ -50,4 +53,22 @@ const NavigationTitle = ({
|
|
|
50
53
|
</View>
|
|
51
54
|
);
|
|
52
55
|
|
|
56
|
+
NavigationTitle.defaultProps = {
|
|
57
|
+
type: 'close',
|
|
58
|
+
title: ' ',
|
|
59
|
+
noShadow: false,
|
|
60
|
+
xlarge: false,
|
|
61
|
+
blockNavigation: false,
|
|
62
|
+
onPress: () => {},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
NavigationTitle.propTypes = {
|
|
66
|
+
type: PropTypes.oneOf(['close', 'back']),
|
|
67
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
68
|
+
noShadow: PropTypes.bool,
|
|
69
|
+
xlarge: PropTypes.bool,
|
|
70
|
+
blockNavigation: PropTypes.bool,
|
|
71
|
+
onPress: PropTypes.func,
|
|
72
|
+
};
|
|
73
|
+
|
|
53
74
|
export default NavigationTitle;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Dimensions
|
|
2
|
-
|
|
1
|
+
import { Dimensions } from 'react-native';
|
|
3
2
|
import { Colors } from '../../configs/constants';
|
|
4
3
|
|
|
5
4
|
const { width } = Dimensions.get('window');
|
|
6
5
|
|
|
7
|
-
export default
|
|
6
|
+
export default {
|
|
8
7
|
container: {
|
|
9
8
|
flexDirection: 'row',
|
|
10
9
|
alignItems: 'center',
|
|
@@ -14,20 +13,20 @@ export default StyleSheet.create({
|
|
|
14
13
|
borderRadius: 10,
|
|
15
14
|
width,
|
|
16
15
|
shadowOffset: { width: 0, height: 3 },
|
|
17
|
-
shadowOpacity:
|
|
16
|
+
shadowOpacity: 0.4,
|
|
18
17
|
shadowRadius: 3,
|
|
19
18
|
elevation: 5,
|
|
20
|
-
shadowColor: Colors.lightblue
|
|
19
|
+
shadowColor: Colors.lightblue
|
|
21
20
|
},
|
|
22
21
|
noShadow: {
|
|
23
22
|
shadowOpacity: 0,
|
|
24
|
-
elevation: 0
|
|
23
|
+
elevation: 0
|
|
25
24
|
},
|
|
26
25
|
containerClose: {
|
|
27
|
-
justifyContent: 'space-between'
|
|
26
|
+
justifyContent: 'space-between'
|
|
28
27
|
},
|
|
29
28
|
containerBack: {
|
|
30
|
-
justifyContent: 'flex-start'
|
|
29
|
+
justifyContent: 'flex-start'
|
|
31
30
|
},
|
|
32
31
|
button: {
|
|
33
32
|
height: 30,
|
|
@@ -35,7 +34,7 @@ export default StyleSheet.create({
|
|
|
35
34
|
borderRadius: 15,
|
|
36
35
|
backgroundColor: Colors.lightblue,
|
|
37
36
|
alignItems: 'center',
|
|
38
|
-
justifyContent: 'center'
|
|
37
|
+
justifyContent: 'center'
|
|
39
38
|
},
|
|
40
39
|
buttonBack: {
|
|
41
40
|
height: 30,
|
|
@@ -44,6 +43,6 @@ export default StyleSheet.create({
|
|
|
44
43
|
marginRight: 10,
|
|
45
44
|
backgroundColor: Colors.lightblue,
|
|
46
45
|
alignItems: 'center',
|
|
47
|
-
justifyContent: 'center'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
46
|
+
justifyContent: 'center'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
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,8 +1,6 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
1
|
import { Colors } from '../../configs/constants';
|
|
4
2
|
|
|
5
|
-
export default
|
|
3
|
+
export default {
|
|
6
4
|
container: {
|
|
7
5
|
flexDirection: 'row',
|
|
8
6
|
alignItems: 'center',
|
|
@@ -11,11 +9,11 @@ export default StyleSheet.create({
|
|
|
11
9
|
paddingVertical: 8,
|
|
12
10
|
borderLeftWidth: 6,
|
|
13
11
|
borderLeftColor: Colors.transparent,
|
|
14
|
-
paddingHorizontal: 10
|
|
12
|
+
paddingHorizontal: 10
|
|
15
13
|
},
|
|
16
14
|
first: {
|
|
17
15
|
borderTopWidth: 1,
|
|
18
|
-
borderTopColor: Colors.lightblue
|
|
16
|
+
borderTopColor: Colors.lightblue
|
|
19
17
|
},
|
|
20
18
|
active: {
|
|
21
19
|
borderLeftColor: Colors.green,
|
|
@@ -25,26 +23,26 @@ export default StyleSheet.create({
|
|
|
25
23
|
width: 60,
|
|
26
24
|
borderWidth: 1,
|
|
27
25
|
borderColor: Colors.lightblue,
|
|
28
|
-
marginRight: 15
|
|
26
|
+
marginRight: 15
|
|
29
27
|
},
|
|
30
28
|
textContainer: {
|
|
31
29
|
flex: 1,
|
|
32
30
|
justifyContent: 'space-evenly',
|
|
33
|
-
height: 60
|
|
31
|
+
height: 60
|
|
34
32
|
},
|
|
35
33
|
text: {
|
|
36
34
|
flexDirection: 'row',
|
|
37
|
-
justifyContent: 'space-between'
|
|
35
|
+
justifyContent: 'space-between'
|
|
38
36
|
},
|
|
39
37
|
textInner: {
|
|
40
38
|
flexDirection: 'row',
|
|
41
|
-
alignItems: 'center'
|
|
39
|
+
alignItems: 'center'
|
|
42
40
|
},
|
|
43
41
|
time: {
|
|
44
|
-
alignSelf: 'flex-start'
|
|
42
|
+
alignSelf: 'flex-start'
|
|
45
43
|
},
|
|
46
44
|
icon: {
|
|
47
45
|
marginLeft: 5,
|
|
48
|
-
marginTop: 2
|
|
49
|
-
}
|
|
50
|
-
}
|
|
46
|
+
marginTop: 2
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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;
|
|
@@ -0,0 +1,89 @@
|
|
|
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;
|