@momo-kits/stepper 0.0.12 → 0.0.13
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 +5 -5
- package/Stepper.web.js +11 -11
- package/package.json +1 -1
package/Stepper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
View, StyleSheet
|
|
3
|
+
View, StyleSheet, TextInput
|
|
4
4
|
} from 'react-native';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import {
|
|
@@ -180,7 +180,7 @@ export default class Quantity extends Component {
|
|
|
180
180
|
render() {
|
|
181
181
|
const { value } = this.state;
|
|
182
182
|
const {
|
|
183
|
-
style, max, valueStyle, size, tintColor, isIncreaseValue, isSingle, iconStyle
|
|
183
|
+
style, max, valueStyle, size, tintColor, isIncreaseValue, isSingle, iconStyle, isInput
|
|
184
184
|
} = this.props;
|
|
185
185
|
const { min } = this.props || 1;
|
|
186
186
|
if (isSingle && value === 0) {
|
|
@@ -210,7 +210,7 @@ export default class Quantity extends Component {
|
|
|
210
210
|
<View style={[styles.numberBox, getStyle(size).size, valueStyle]}>
|
|
211
211
|
{
|
|
212
212
|
isInput ? <TextInput
|
|
213
|
-
style={[{textAlignVertical: 'center'}, getSize(
|
|
213
|
+
style={[{textAlignVertical: 'center'}, getSize(size).size]}
|
|
214
214
|
underlineColorAndroid="transparent"
|
|
215
215
|
value={value.toString()}
|
|
216
216
|
textAlign='center'
|
|
@@ -236,13 +236,13 @@ const IconButton = ({
|
|
|
236
236
|
disabled, onPress, icon, size, tintColor, style
|
|
237
237
|
}) => (
|
|
238
238
|
<TouchableOpacity
|
|
239
|
-
style={[getStyle(
|
|
239
|
+
style={[getStyle(size).size, styles.button, style]}// disabled && styles.disabledBox
|
|
240
240
|
disabled={disabled}
|
|
241
241
|
onPress={onPress}
|
|
242
242
|
>
|
|
243
243
|
<Image
|
|
244
244
|
source={icon}
|
|
245
|
-
style={[getStyle(
|
|
245
|
+
style={[getStyle(size).icon, { tintColor }, disabled && styles.disabledIcon]}
|
|
246
246
|
/>
|
|
247
247
|
</TouchableOpacity>
|
|
248
248
|
);
|
package/Stepper.web.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
View, StyleSheet, TouchableOpacity, Image
|
|
3
|
+
View, StyleSheet, TouchableOpacity, Image, TextInput
|
|
4
4
|
} from 'react-native';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Text from '../../core/components/typography';
|
|
7
7
|
import Colors from '../../core/colors';
|
|
8
|
-
import ValueUtil from '../../core/utils/ValueUtil';
|
|
9
8
|
|
|
10
9
|
const minus = 'https://img.mservice.io/momo_app_v2/new_version/img/appx_icon/24_navigation_minus_circle.png';
|
|
11
10
|
const plus = 'https://img.mservice.io/momo_app_v2/new_version/img/appx_icon/24_navigation_plus_circle.png';
|
|
@@ -180,7 +179,7 @@ export default class Quantity extends Component {
|
|
|
180
179
|
render() {
|
|
181
180
|
const { value } = this.state;
|
|
182
181
|
const {
|
|
183
|
-
style, max, valueStyle, size, tintColor, isIncreaseValue, isSingle, iconStyle
|
|
182
|
+
style, max, valueStyle, size, tintColor, isIncreaseValue, isSingle, iconStyle, isInput
|
|
184
183
|
} = this.props;
|
|
185
184
|
const { min } = this.props || 1;
|
|
186
185
|
if (isSingle && value === 0) {
|
|
@@ -202,15 +201,15 @@ export default class Quantity extends Component {
|
|
|
202
201
|
<IconButton
|
|
203
202
|
style={iconStyle}
|
|
204
203
|
tintColor={tintColor}
|
|
205
|
-
|
|
204
|
+
size={size}
|
|
206
205
|
disabled={value === min}
|
|
207
206
|
onPress={this.onPress(false)}
|
|
208
207
|
icon={minus}
|
|
209
208
|
/>
|
|
210
|
-
<View style={[styles.numberBox, getStyle(
|
|
209
|
+
<View style={[styles.numberBox, getStyle(size).size, valueStyle]}>
|
|
211
210
|
{
|
|
212
211
|
isInput ? <TextInput
|
|
213
|
-
style={[{textAlignVertical: 'center'}, getSize(
|
|
212
|
+
style={[{textAlignVertical: 'center'}, getSize(size).size]}
|
|
214
213
|
underlineColorAndroid="transparent"
|
|
215
214
|
value={value.toString()}
|
|
216
215
|
textAlign='center'
|
|
@@ -222,7 +221,7 @@ export default class Quantity extends Component {
|
|
|
222
221
|
<IconButton
|
|
223
222
|
tintColor={tintColor}
|
|
224
223
|
style={iconStyle}
|
|
225
|
-
|
|
224
|
+
size={size}
|
|
226
225
|
disabled={(value >= max || !isIncreaseValue)}
|
|
227
226
|
onPress={this.onPress(true)}
|
|
228
227
|
icon={plus}
|
|
@@ -236,19 +235,19 @@ const IconButton = ({
|
|
|
236
235
|
disabled, onPress, icon, size, tintColor, style
|
|
237
236
|
}) => (
|
|
238
237
|
<TouchableOpacity
|
|
239
|
-
style={[getStyle(
|
|
238
|
+
style={[getStyle(size).size, styles.button, style]}// disabled && styles.disabledBox
|
|
240
239
|
disabled={disabled}
|
|
241
240
|
onPress={onPress}
|
|
242
241
|
>
|
|
243
242
|
<Image
|
|
244
243
|
source={icon}
|
|
245
|
-
style={[getStyle(
|
|
244
|
+
style={[getStyle(size).icon, { tintColor }, disabled && styles.disabledIcon]}
|
|
246
245
|
/>
|
|
247
246
|
</TouchableOpacity>
|
|
248
247
|
);
|
|
249
248
|
|
|
250
249
|
Quantity.propTypes = {
|
|
251
|
-
|
|
250
|
+
size: PropTypes.oneOf(['large', 'medium', 'small']),
|
|
252
251
|
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
253
252
|
valueStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
254
253
|
min: PropTypes.number,
|
|
@@ -272,7 +271,8 @@ Quantity.defaultProps = {
|
|
|
272
271
|
isIncreaseValue: true,
|
|
273
272
|
isDecreaseValue: true,
|
|
274
273
|
isSingle: false,
|
|
275
|
-
|
|
274
|
+
size: 'medium',
|
|
276
275
|
tintColor: Colors.pink_05_b,
|
|
277
276
|
isInput: false
|
|
278
277
|
};
|
|
278
|
+
|