From 6a76594f71ffba95a3480e57f4a4243e212e09ba Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Thu, 17 Oct 2024 20:39:35 +0530 Subject: Added styling to the Cart and Checkout page --- src/screens/Checkout/CheckoutScreen.js | 75 +++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 5 deletions(-) (limited to 'src/screens/Checkout/CheckoutScreen.js') diff --git a/src/screens/Checkout/CheckoutScreen.js b/src/screens/Checkout/CheckoutScreen.js index a8645d2..4cd8938 100644 --- a/src/screens/Checkout/CheckoutScreen.js +++ b/src/screens/Checkout/CheckoutScreen.js @@ -1,5 +1,5 @@ import React, { useContext } from 'react'; -import { View, Text, Button } from 'react-native'; +import { View, Text, Button, StyleSheet, ScrollView } from 'react-native'; import { CartContext } from '../../context/CartContext'; import emailService from '../../services/emailService'; @@ -13,14 +13,79 @@ const CheckoutScreen = ({ navigation }) => { navigation.navigate('Invoice'); }; + const totalAmount = cart.reduce((total, item) => total + item.price * item.quantity, 0); + return ( - + + Checkout {cart.map((item, index) => ( - {item.name} - ${item.price * item.quantity} + + {item.name} + ${(item.price * item.quantity).toFixed(2)} + ))} -