blob: 273e409d6c9d97287487b5ed1e6fdfa3ad6bcfd2 (
plain) (
tree)
|
|
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;
|