import { BarCodeScanner } from 'expo-barcode-scanner'; import { StatusBar } from 'expo-status-bar'; import { useEffect, useState } from 'react'; import { Button, StyleSheet, Text, View } from 'react-native'; export default function App() { const [hasPermission, setHasPermission] = useState(null); const [scanned, setScanned] = useState(false); useEffect(() => { const getBarCodeScannerPermissions = async () => { const { status } = await BarCodeScanner.requestPermissionsAsync(); setHasPermission(status === 'granted'); }; getBarCodeScannerPermissions(); }, []); const handleBarCodeScanned = ({ type, data }) => { setScanned(true); alert(`A vonalkód típusa ${type}\nAz olvasott adat: ${data}`); }; if (hasPermission === null) { return Szükséges a kamerához hozzáférés; } if (hasPermission === false) { return A kamera nem elérhető; } return ( {scanned &&