diff options
-rw-r--r-- | src/components/QuantityAdjuster.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/components/QuantityAdjuster.js b/src/components/QuantityAdjuster.js index e69de29..273e409 100644 --- a/src/components/QuantityAdjuster.js +++ b/src/components/QuantityAdjuster.js @@ -0,0 +1,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; |