How chenpig3100/offline-inventory-management works
Project type and purpose
• This is a React Native mobile application built with Expo.
• Its primary features include user authentication, announcement fetching, inventory management (with offline-first support), settings, and data synchronization between local storage and a backend API.
File structure
• Top-level entry points:
• index.js & App.js – bootstrap the Expo/React-Native app.
• app.json & package.json – configuration and dependencies.
• src/views – “screens” or “pages” (Login, Dashboard, Announcements, Inventory, Settings, etc.).
• src/components – reusable UI pieces (e.g., HintOverlay, NavSwitchBar).
• src/context – React Context for global state (AuthContext).
• src/hooks – custom hooks (useNetworkSync monitors connectivity and triggers sync).
• src/modules – domain logic (e.g., product.js defines business rules for inventory items).
• src/services – data access and synchronization (announcementApi.js for remote fetch, sync.js to reconcile local <> remote).
• src/constants & src/data – styling constants and static datasets (categories, countries).
• Native storage: expo-sqlite for relational storage, @react-native-async-storage/async-storage for key-value.
README for additional insights
• Dependencies: axios for HTTP, expo-sqlite + async-storage for persistence, community/netinfo for connectivity, image-picker, gesture-handler, reanimated, dropdown-picker.
• Deployment: uses EAS (Expo Application Services) for over-the-air updates.
Detail without over-compartmentalizing
• Separate hooks and Context from generic components.
• Both synchronous (screen → service) and asynchronous flows (background sync).
• Asset loading (image-picker) only if it factors into the core flow (e.g., product image upload).