import React, { useState } from "react"; import { Button, FlatList, Pressable, StyleSheet, Text, TextInput, View, } from "react-native"; import * as Updates from 'expo-updates'; export default function App() { const [buffer, setBuffer] = useState(""); const [items, setItems] = useState([]); const [status, setStatus] = useState(""); const [updates, setUpdates] = useState("") const handleChange = (text: string) => { // Scanner "types" characters then appends Enter (\n) if (text.endsWith("\n")) { const code = text.trim(); // Remove newline handleScan(code); setBuffer(""); // Reset for next scan } else { setBuffer(text); } }; async function checkServerUpdate() { setUpdates('Checking for updates...'); try { const res = await Updates.checkForUpdateAsync(); if (res.isAvailable) { setUpdates('Update available! Fetching and reloading...'); await Updates.fetchUpdateAsync(); await Updates.reloadAsync(); } else { setUpdates('No new update available.'); } } catch (e:any) { setUpdates(`Update check failed: ${e.message}`); } } const handleScan = (code: string) => { //console.log("Scanned:", code); if (code.toUpperCase().startsWith("LOC")) { console.log("Triggered relocate to lane"); performRelocate(code); } else { setItems((prev) => [...prev, code]); setStatus(`Added: ${code}`); } }; const performRelocate = (locationCode: string) => { if (items.length === 0) { setStatus(`Relocate to ${locationCode} requested, but no items`); return; } // Do your API call or whatever the "relocate" means console.log("Relocating", items, "to", locationCode); setStatus(`Moved ${items.length} items to ${locationCode}`); setItems([]); }; return (