import React, { useContext } from 'react'; import { View, Text, Button, StyleSheet, ScrollView } from 'react-native'; import { CartContext } from '../../context/CartContext'; import emailService from '../../services/emailService'; const CheckoutScreen = ({ navigation }) => { const { cart } = useContext(CartContext); const handlePayment = async () => { // Simulate payment processing alert('Payment successful!'); await emailService.sendInvoice(cart); 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).toFixed(2)} ))} Total: ${totalAmount.toFixed(2)}