diff options
Diffstat (limited to 'src/screens')
-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; |