@momo-kits/stepper 0.0.62-alpha.3 → 0.0.62-alpha.32
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/Stepper.js +20 -7
- package/package.json +1 -1
package/Stepper.js
CHANGED
|
@@ -41,7 +41,10 @@ const Quantity = (props) => {
|
|
|
41
41
|
height: 28,
|
|
42
42
|
borderRadius: Radius.M + Radius.XXS,
|
|
43
43
|
},
|
|
44
|
-
icon: {
|
|
44
|
+
icon: {
|
|
45
|
+
width: 24,
|
|
46
|
+
height: 24,
|
|
47
|
+
},
|
|
45
48
|
input: {
|
|
46
49
|
minWidth: 28,
|
|
47
50
|
minHeight: 24,
|
|
@@ -59,7 +62,10 @@ const Quantity = (props) => {
|
|
|
59
62
|
height: 36,
|
|
60
63
|
borderRadius: Radius.L + Radius.XXS,
|
|
61
64
|
},
|
|
62
|
-
icon: {
|
|
65
|
+
icon: {
|
|
66
|
+
width: 24,
|
|
67
|
+
height: 24,
|
|
68
|
+
},
|
|
63
69
|
input: {
|
|
64
70
|
minWidth: 32,
|
|
65
71
|
minHeight: 26,
|
|
@@ -86,8 +92,9 @@ const Quantity = (props) => {
|
|
|
86
92
|
}
|
|
87
93
|
if (newValue < min) newValue = min;
|
|
88
94
|
|
|
89
|
-
if (onDecreasePress && typeof onDecreasePress === 'function')
|
|
95
|
+
if (onDecreasePress && typeof onDecreasePress === 'function') {
|
|
90
96
|
onDecreasePress(newValue);
|
|
97
|
+
}
|
|
91
98
|
|
|
92
99
|
setValue(newValue);
|
|
93
100
|
};
|
|
@@ -99,22 +106,26 @@ const Quantity = (props) => {
|
|
|
99
106
|
}
|
|
100
107
|
if (newValue > max) newValue = max;
|
|
101
108
|
|
|
102
|
-
if (onIncreasePress && typeof onIncreasePress === 'function')
|
|
109
|
+
if (onIncreasePress && typeof onIncreasePress === 'function') {
|
|
103
110
|
onIncreasePress(newValue);
|
|
111
|
+
}
|
|
104
112
|
|
|
105
113
|
setValue(newValue);
|
|
106
114
|
};
|
|
107
115
|
|
|
108
116
|
const onPressButton = (type) => {
|
|
109
|
-
if (type === 'plus')
|
|
110
|
-
|
|
117
|
+
if (type === 'plus') {
|
|
118
|
+
onIncrease();
|
|
119
|
+
} else {
|
|
120
|
+
onDecrease();
|
|
121
|
+
}
|
|
111
122
|
};
|
|
112
123
|
const renderButton = (type, size, icon) => {
|
|
113
124
|
let disabledStatus = props.disabled;
|
|
114
125
|
if (type === 'plus' && value === max) disabledStatus = true;
|
|
115
126
|
if (type === 'minus' && value === min) disabledStatus = true;
|
|
116
127
|
|
|
117
|
-
if (onPressButton)
|
|
128
|
+
if (onPressButton) {
|
|
118
129
|
return (
|
|
119
130
|
<TouchableOpacity
|
|
120
131
|
disabled={disabledStatus}
|
|
@@ -130,6 +141,7 @@ const Quantity = (props) => {
|
|
|
130
141
|
/>
|
|
131
142
|
</TouchableOpacity>
|
|
132
143
|
);
|
|
144
|
+
}
|
|
133
145
|
};
|
|
134
146
|
|
|
135
147
|
const onChangeText = (value) => {
|
|
@@ -205,6 +217,7 @@ const styles = StyleSheet.create({
|
|
|
205
217
|
justifyContent: 'center',
|
|
206
218
|
alignItems: 'center',
|
|
207
219
|
paddingHorizontal: Spacing.XS,
|
|
220
|
+
paddingVertical: Spacing.ZERO,
|
|
208
221
|
},
|
|
209
222
|
inputContainer: {
|
|
210
223
|
alignItems: 'center',
|