From 5d6b82fd07ad6ef34e26443d0e363d8401cb489f Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Wed, 16 Oct 2024 16:18:13 +0530 Subject: Add CheckoutScreen with payment and invoice email --- src/screens/Checkout/CheckoutScreen.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/screens/Checkout/CheckoutScreen.js (limited to 'src/screens/Checkout') diff --git a/src/screens/Checkout/CheckoutScreen.js b/src/screens/Checkout/CheckoutScreen.js new file mode 100644 index 0000000..a8645d2 --- /dev/null +++ b/src/screens/Checkout/CheckoutScreen.js @@ -0,0 +1,26 @@ +import React, { useContext } from 'react'; +import { View, Text, Button } 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'); + }; + + return ( + + {cart.map((item, index) => ( + {item.name} - ${item.price * item.quantity} + ))} +