blob: 273e409d6c9d97287487b5ed1e6fdfa3ad6bcfd2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import React from 'react';
import { View, Button, Text, StyleSheet } from 'react-native';
const QuantityAdjuster = ({ quantity, onChange }) => (
<View style={styles.container}>
<Button title="-" onPress={() => onChange(quantity > 1 ? quantity - 1 : 1)} />
<Text style={styles.quantity}>{quantity}</Text>
<Button title="+" onPress={() => onChange(quantity + 1)} />
</View>
);
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
},
quantity: {
marginHorizontal: 10,
fontSize: 18,
},
});
export default QuantityAdjuster;
|