From cb65e181d120d2d9ff0672e12fc2db3b16d85d1c Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Wed, 16 Oct 2024 16:18:13 +0530 Subject: Add ProductScannerScreen with barcode scanning and add-to-cart --- src/screens/ProductScannerScreen.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/screens/ProductScannerScreen.js (limited to 'src/screens') diff --git a/src/screens/ProductScannerScreen.js b/src/screens/ProductScannerScreen.js new file mode 100644 index 0000000..95d5865 --- /dev/null +++ b/src/screens/ProductScannerScreen.js @@ -0,0 +1,29 @@ +import React, { useState } from 'react'; +import { View, Text, Button } from 'react-native'; +import BarcodeScanner from '../../components/BarcodeScanner'; + +const ProductScannerScreen = ({ navigation }) => { + const [scannedProduct, setScannedProduct] = useState(null); + + const handleScan = (product) => setScannedProduct(product); + + const handleAddToCart = () => { + // Add product to cart and navigate to cart screen + navigation.navigate('Cart'); + }; + + return ( + + + {scannedProduct && ( + + {scannedProduct.name} + {scannedProduct.price} +