summaryrefslogtreecommitdiffstats
path: root/src/screens/ProductScannerScreen.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/screens/ProductScannerScreen.js')
-rw-r--r--src/screens/ProductScannerScreen.js29
1 files changed, 29 insertions, 0 deletions
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 (
+ <View>
+ <BarcodeScanner onScan={handleScan} />
+ {scannedProduct && (
+ <View>
+ <Text>{scannedProduct.name}</Text>
+ <Text>{scannedProduct.price}</Text>
+ <Button title="Add to Cart" onPress={handleAddToCart} />
+ </View>
+ )}
+ </View>
+ );
+};
+
+export default ProductScannerScreen;