diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-16 16:18:13 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-10-16 16:18:13 +0530 |
commit | 035d1e036359e8e590f2e17c0390e5d3ffec1728 (patch) | |
tree | a90668f34811a8bdd3023b0e65a535bde2c4f8d2 | |
parent | da8bdf358b241304d8f4430bcaea93ada605f904 (diff) | |
download | mall-app-035d1e036359e8e590f2e17c0390e5d3ffec1728.tar.gz mall-app-035d1e036359e8e590f2e17c0390e5d3ffec1728.tar.bz2 mall-app-035d1e036359e8e590f2e17c0390e5d3ffec1728.zip |
Add CartScreen with quantity adjustment functionality
-rw-r--r-- | src/screens/Cart/CartScreen.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/screens/Cart/CartScreen.js b/src/screens/Cart/CartScreen.js new file mode 100644 index 0000000..392e665 --- /dev/null +++ b/src/screens/Cart/CartScreen.js @@ -0,0 +1,23 @@ +import React, { useContext } from 'react'; +import { View, Text, Button } from 'react-native'; +import { CartContext } from '../../context/CartContext'; + +const CartScreen = ({ navigation }) => { + const { cart, updateQuantity } = useContext(CartContext); + + const handleCheckout = () => navigation.navigate('Checkout'); + + return ( + <View> + {cart.map((item, index) => ( + <View key={index}> + <Text>{item.name} - Quantity: {item.quantity}</Text> + <Button title="Increase Quantity" onPress={() => updateQuantity(item.id, item.quantity + 1)} /> + </View> + ))} + <Button title="Proceed to Checkout" onPress={handleCheckout} /> + </View> + ); +}; + +export default CartScreen; |