import React, { useState, useEffect } from "react"; import { View, ScrollView, Pressable, Platform, Dimensions, StyleSheet, } from "react-native"; import { Text } from "@/components/ui/text"; import { Button } from "@/components/ui/button"; import { X, Zap, Camera as CameraIcon } from "@/lib/icons"; import { ScreenWrapper } from "@/components/ScreenWrapper"; import { CameraView, useCameraPermissions } from "expo-camera"; import { router, useNavigation } from "expo-router"; const { width } = Dimensions.get("window"); export default function ScanScreen() { const [permission, requestPermission] = useCameraPermissions(); const [torch, setTorch] = useState(false); const navigation = useNavigation(); const NAV_BG = "#ffffff"; // Hide tab bar when on this screen (since it's a dedicated camera view) useEffect(() => { navigation.setOptions({ tabBarStyle: { display: "none", }, }); return () => { navigation.setOptions({ tabBarStyle: { display: "flex", backgroundColor: NAV_BG, borderTopWidth: 0, elevation: 10, height: 75, paddingBottom: Platform.OS === "ios" ? 30 : 10, paddingTop: 10, marginHorizontal: 20, position: "absolute", bottom: 25, left: 20, right: 20, borderRadius: 32, shadowColor: "#000", shadowOffset: { width: 0, height: 10 }, shadowOpacity: 0.12, shadowRadius: 20, }, }); }; }, [navigation]); if (!permission) { // Camera permissions are still loading. return ; } if (!permission.granted) { // Camera permissions are not granted yet. return ( Camera Access We need your permission to use the camera to scan invoices and receipts automatically. router.back()} className="mt-6"> Go Back ); } return ( setTorch(!torch)} className={`h-12 w-12 rounded-full items-center justify-center border border-white/20 ${torch ? "bg-primary" : "bg-black/40"}`} > navigation.goBack()} className="h-12 w-12 rounded-full bg-black/40 items-center justify-center border border-white/20" > {/* Scanning Frame */} Align Invoice AI Auto-detecting... ); }