@holper/react-native-holper-storybook 0.6.25 → 0.6.27
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/lib/components/Select/index.js +51 -30
- package/package.json +2 -1
|
@@ -1,39 +1,60 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { View
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import Picker from
|
|
5
|
-
import Ionicons from
|
|
6
|
-
import { Colors } from
|
|
7
|
-
import style from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import Picker from "react-native-picker-select";
|
|
5
|
+
import Ionicons from "react-native-vector-icons/Ionicons";
|
|
6
|
+
import { Colors } from "../../configs/constants";
|
|
7
|
+
import style from "./style";
|
|
8
8
|
|
|
9
|
-
const Select = ({
|
|
10
|
-
|
|
9
|
+
const Select = ({
|
|
10
|
+
value,
|
|
11
|
+
onValueChange,
|
|
12
|
+
items,
|
|
13
|
+
variant,
|
|
14
|
+
disabled,
|
|
15
|
+
fitToContainer,
|
|
16
|
+
placeholder,
|
|
17
|
+
}) => (
|
|
18
|
+
<View
|
|
19
|
+
style={[
|
|
20
|
+
style.container,
|
|
21
|
+
disabled ? style.disabled : {},
|
|
22
|
+
fitToContainer ? style.fit : {},
|
|
23
|
+
]}
|
|
24
|
+
>
|
|
11
25
|
<Picker
|
|
12
26
|
style={includesSelect[variant]}
|
|
13
|
-
placeholder={{label: placeholder}}
|
|
27
|
+
placeholder={{ label: placeholder }}
|
|
14
28
|
value={value}
|
|
15
29
|
onValueChange={onValueChange}
|
|
16
30
|
placeholderTextColor={Colors.midblue}
|
|
17
31
|
useNativeAndroidPickerStyle={false}
|
|
18
32
|
items={items}
|
|
19
33
|
disabled={disabled}
|
|
20
|
-
Icon={() =>
|
|
34
|
+
Icon={() => (
|
|
35
|
+
<Ionicons
|
|
36
|
+
name="chevron-down-outline"
|
|
37
|
+
size={20}
|
|
38
|
+
style={style.selectIcon}
|
|
39
|
+
color={Colors.darkgray}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
21
42
|
/>
|
|
22
43
|
</View>
|
|
23
44
|
);
|
|
24
45
|
|
|
25
46
|
Select.defaultProps = {
|
|
26
|
-
variant:
|
|
27
|
-
placeholder:
|
|
47
|
+
variant: "default",
|
|
48
|
+
placeholder: " ",
|
|
28
49
|
disabled: false,
|
|
29
50
|
fitToContainer: false,
|
|
30
51
|
onValueChange: () => {},
|
|
31
52
|
value: null,
|
|
32
|
-
items: []
|
|
53
|
+
items: [],
|
|
33
54
|
};
|
|
34
55
|
|
|
35
56
|
Select.propTypes = {
|
|
36
|
-
variant: PropTypes.oneOf([
|
|
57
|
+
variant: PropTypes.oneOf(["default", "completed", "error"]),
|
|
37
58
|
placeholder: PropTypes.string.isRequired,
|
|
38
59
|
disabled: PropTypes.bool,
|
|
39
60
|
fitToContainer: PropTypes.bool,
|
|
@@ -42,56 +63,56 @@ Select.propTypes = {
|
|
|
42
63
|
items: PropTypes.arrayOf(
|
|
43
64
|
PropTypes.shape({
|
|
44
65
|
label: PropTypes.string,
|
|
45
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
66
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
46
67
|
})
|
|
47
|
-
)
|
|
68
|
+
),
|
|
48
69
|
};
|
|
49
70
|
|
|
50
71
|
const basicStyle = {
|
|
51
72
|
height: 50,
|
|
52
|
-
width:
|
|
73
|
+
width: "100%",
|
|
53
74
|
borderRadius: 25,
|
|
54
75
|
borderWidth: 1,
|
|
55
76
|
paddingHorizontal: 20,
|
|
56
77
|
color: Colors.darkblue,
|
|
57
|
-
fontFamily:
|
|
78
|
+
fontFamily: "poppins_regular",
|
|
58
79
|
backgroundColor: Colors.white,
|
|
59
|
-
marginVertical: 6
|
|
80
|
+
marginVertical: 6,
|
|
60
81
|
};
|
|
61
82
|
|
|
62
83
|
const includesSelect = {
|
|
63
84
|
default: {
|
|
64
85
|
inputIOS: {
|
|
65
86
|
...basicStyle,
|
|
66
|
-
borderColor: Colors.lightblue
|
|
87
|
+
borderColor: Colors.lightblue,
|
|
67
88
|
},
|
|
68
89
|
inputAndroid: {
|
|
69
90
|
...basicStyle,
|
|
70
|
-
borderColor: Colors.lightblue
|
|
71
|
-
}
|
|
91
|
+
borderColor: Colors.lightblue,
|
|
92
|
+
},
|
|
72
93
|
},
|
|
73
94
|
completed: {
|
|
74
95
|
inputIOS: {
|
|
75
96
|
...basicStyle,
|
|
76
|
-
borderColor: Colors.green
|
|
97
|
+
borderColor: Colors.green,
|
|
77
98
|
},
|
|
78
99
|
inputAndroid: {
|
|
79
100
|
...basicStyle,
|
|
80
|
-
borderColor: Colors.green
|
|
81
|
-
}
|
|
101
|
+
borderColor: Colors.green,
|
|
102
|
+
},
|
|
82
103
|
},
|
|
83
104
|
error: {
|
|
84
105
|
inputIOS: {
|
|
85
106
|
...basicStyle,
|
|
86
107
|
borderColor: Colors.red,
|
|
87
|
-
color: Colors.red
|
|
108
|
+
color: Colors.red,
|
|
88
109
|
},
|
|
89
110
|
inputAndroid: {
|
|
90
111
|
...basicStyle,
|
|
91
112
|
borderColor: Colors.red,
|
|
92
|
-
color: Colors.red
|
|
93
|
-
}
|
|
113
|
+
color: Colors.red,
|
|
114
|
+
},
|
|
94
115
|
},
|
|
95
|
-
}
|
|
116
|
+
};
|
|
96
117
|
|
|
97
118
|
export default Select;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"main": "lib/index.js",
|
|
3
3
|
"name": "@holper/react-native-holper-storybook",
|
|
4
4
|
"description": "A component library for Holper projects",
|
|
5
|
-
"version": "0.6.
|
|
5
|
+
"version": "0.6.27",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@react-native-async-storage/async-storage": "1.17.11",
|
|
31
|
+
"@react-native-picker/picker": "2.4.8",
|
|
31
32
|
"deprecated-react-native-prop-types": "^2.3.0",
|
|
32
33
|
"expo": "^48.0.6",
|
|
33
34
|
"expo-asset": "~8.9.1",
|