From 2d9fbd186bbb27e00b934e5f7a99039467f9c664 Mon Sep 17 00:00:00 2001 From: Aleksandar Date: Thu, 11 Dec 2025 13:19:09 +0100 Subject: [PATCH] fix: disable barcode scanner on web platform --- apps/mobile/src/components/ScanFoodModal.tsx | 44 ++++++++++++++------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/apps/mobile/src/components/ScanFoodModal.tsx b/apps/mobile/src/components/ScanFoodModal.tsx index dfaa5c0..b90db2c 100644 --- a/apps/mobile/src/components/ScanFoodModal.tsx +++ b/apps/mobile/src/components/ScanFoodModal.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { View, Text, StyleSheet, Modal, TouchableOpacity, TextInput, Alert } from 'react-native'; +import { View, Text, StyleSheet, Modal, TouchableOpacity, TextInput, Alert, Platform } from 'react-native'; import { CameraView, useCameraPermissions } from 'expo-camera'; import { Ionicons } from '@expo/vector-icons'; import { LinearGradient } from 'expo-linear-gradient'; @@ -111,19 +111,25 @@ export function ScanFoodModal({ visible, onClose, onAddFood }: ScanFoodModalProp - - - - Position barcode within frame + {Platform.OS === 'web' ? ( + + Barcode scanning is only available on mobile devices - + ) : ( + + + + Position barcode within frame + + + )} ) : ( @@ -230,6 +236,18 @@ const styles = StyleSheet.create({ camera: { flex: 1, }, + webPlaceholder: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: '#1a1a1a', + }, + webText: { + color: '#999', + fontSize: 16, + textAlign: 'center', + paddingHorizontal: 40, + }, scanOverlay: { flex: 1, justifyContent: 'center',