diff --git a/App.tsx b/App.tsx index 7f4fb4c..282d85e 100644 --- a/App.tsx +++ b/App.tsx @@ -1,25 +1,3 @@ -// /** -// * Sample React Native App -// * https://github.com/facebook/react-native -// * -// * @format -// */ -// -// import React from 'react'; -// import Navigation from './src/navigation'; -// import {ThemeProvider} from './src/contexts/ThemeContext'; -// -// function App(): JSX.Element { -// return ( -// -// -// -// ); -// } -// -// export default App; - - /** * Sample React Native App * https://github.com/facebook/react-native @@ -27,11 +5,11 @@ * @format */ -import React, { useState, useEffect } from 'react'; +import React, {useState, useEffect} from 'react'; import Navigation from './src/navigation'; import {ThemeProvider} from './src/contexts/ThemeContext'; import MaterialIcons from 'react-native-vector-icons/MaterialIcons'; -import { View, Text, ActivityIndicator, StyleSheet } from 'react-native'; +import {View, Text, ActivityIndicator, StyleSheet} from 'react-native'; function App(): JSX.Element { const [fontLoaded, setFontLoaded] = useState(false); @@ -71,9 +49,7 @@ function App(): JSX.Element { return ( - - {fontError || 'Loading icons...'} - + {fontError || 'Loading icons...'} Using MaterialIcons font family: {MaterialIcons.getFontFamily()} @@ -108,4 +84,4 @@ const styles = StyleSheet.create({ }, }); -export default App; \ No newline at end of file +export default App; diff --git a/package.json b/package.json index ab39b6c..dae9194 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pda_react_native_template", - "version": "0.0.1", + "version": "1.0.0", "private": true, "scripts": { "android": "react-native run-android", diff --git a/src/App.tsx b/src/App.tsx deleted file mode 100644 index 0bef0bc..0000000 --- a/src/App.tsx +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * - * @format - */ - -import React from 'react'; -import {StatusBar} from 'react-native'; -import Navigation from './navigation'; -import {ThemeProvider} from './contexts/ThemeContext'; -import {theme} from './constants/theme'; - -const App = () => { - return ( - - - - - ); -}; - -export default App; diff --git a/src/services/http.ts b/src/api/http.ts similarity index 100% rename from src/services/http.ts rename to src/api/http.ts diff --git a/src/services/wmsApi.ts b/src/api/wmsApi.ts similarity index 100% rename from src/services/wmsApi.ts rename to src/api/wmsApi.ts diff --git a/src/constants/env.ts b/src/constants/env.ts index 9fe4977..ce77cf7 100644 --- a/src/constants/env.ts +++ b/src/constants/env.ts @@ -2,4 +2,4 @@ export const ENV = { API_URL: __DEV__ ? 'http://dev-api.example.com' : 'https://api.example.com', APP_NAME: 'PdaRnTemplate', VERSION: '1.0.0', -}; \ No newline at end of file +}; diff --git a/src/constants/theme.ts b/src/constants/theme.ts index 2257519..96a4e0d 100644 --- a/src/constants/theme.ts +++ b/src/constants/theme.ts @@ -1,31 +1,31 @@ export const theme = { colors: { // 基础颜色 - aqua: '#05DCEF', // 青色主色调 (0xff05dcef) - background: '#ffffff', // 背景色 + aqua: '#05DCEF', // 青色主色调 (0xff05dcef) + background: '#ffffff', // 背景色 backgroundGray: '#F5F5F5', // 灰色背景 - text: '#333333', // 文本颜色 - textLight: '#666666', // 次要文本颜色 - border: '#dddddd', // 边框颜色 - error: '#ff3b30', // 错误颜色 - cyan: '#00FFFF', // 青色背景 - lightGreen: '#7FFFAA', // 浅绿色 + text: '#333333', // 文本颜色 + textLight: '#666666', // 次要文本颜色 + border: '#dddddd', // 边框颜色 + error: '#ff3b30', // 错误颜色 + cyan: '#00FFFF', // 青色背景 + lightGreen: '#7FFFAA', // 浅绿色 // 渐变色配置 gradients: { - primary: ['#05DCEF', '#7DE2F5', '#B8F2FF'], // 主要渐变(青蓝白,小清新) - contrast: ['#00F5A0', '#00D9F5'], // 对比渐变(绿青) - header: ['#05DCEF', '#7DE2F5'], // 头部渐变 - button: ['#05DCEF', '#7DE2F5'], // 按钮渐变 + primary: ['#05DCEF', '#7DE2F5', '#B8F2FF'], // 主要渐变(青蓝白,小清新) + contrast: ['#00F5A0', '#00D9F5'], // 对比渐变(绿青) + header: ['#05DCEF', '#7DE2F5'], // 头部渐变 + button: ['#05DCEF', '#7DE2F5'], // 按钮渐变 }, // 图表颜色 chart: { - cyan: '#00FFFF', // 青色 + cyan: '#00FFFF', // 青色 lightGreen: '#7FFFAA', // 浅绿色 }, }, - + // 字体大小 fontSize: { small: 12, @@ -36,7 +36,7 @@ export const theme = { xxlarge: 24, title: 32, }, - + // 间距 spacing: { xs: 4, @@ -45,7 +45,7 @@ export const theme = { large: 24, xl: 32, }, - + // 圆角 borderRadius: { small: 4, @@ -54,7 +54,7 @@ export const theme = { xl: 16, circle: 999, }, - + // 阴影 shadow: { small: { @@ -73,7 +73,7 @@ export const theme = { width: 0, height: 4, }, - shadowOpacity: 0.30, + shadowOpacity: 0.3, shadowRadius: 4.65, elevation: 4, }, @@ -88,8 +88,6 @@ export const theme = { elevation: 6, }, }, - - }; // 类型定义 @@ -98,4 +96,4 @@ export type Theme = typeof theme; // 导出类型 declare module '@react-navigation/native' { export type ExtendedTheme = Theme; -} \ No newline at end of file +} diff --git a/src/contexts/ThemeContext.tsx b/src/contexts/ThemeContext.tsx index 0448101..8873421 100644 --- a/src/contexts/ThemeContext.tsx +++ b/src/contexts/ThemeContext.tsx @@ -18,4 +18,4 @@ export const useTheme = () => { throw new Error('useTheme must be used within a ThemeProvider'); } return theme; -}; \ No newline at end of file +}; diff --git a/src/device/scanner/index.ts b/src/device/scanner/index.ts deleted file mode 100644 index 3fe02f6..0000000 --- a/src/device/scanner/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -class ScannerService { - async init(): Promise { - // 初始化扫描器 - console.log('Scanner initialized'); - } - - async startScan(): Promise { - // 开始扫描 - return new Promise((resolve) => { - // 模拟扫描结果 - setTimeout(() => { - resolve('Scanned barcode result'); - }, 1000); - }); - } - - async stopScan(): Promise { - // 停止扫描 - console.log('Scanner stopped'); - } -} - -export const scannerService = new ScannerService(); \ No newline at end of file diff --git a/src/hooks/useScanner.tsx b/src/hooks/useScanner.tsx deleted file mode 100644 index 4471015..0000000 --- a/src/hooks/useScanner.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import {useState, useCallback} from 'react'; -import {scannerService} from '../device/scanner'; - -export const useScanner = () => { - const [isScanning, setIsScanning] = useState(false); - const [result, setResult] = useState(null); - const [error, setError] = useState(null); - - const startScan = useCallback(async () => { - try { - setIsScanning(true); - setError(null); - const scanResult = await scannerService.startScan(); - setResult(scanResult); - } catch (err) { - setError(err as Error); - } finally { - setIsScanning(false); - } - }, []); - - const stopScan = useCallback(async () => { - try { - await scannerService.stopScan(); - setIsScanning(false); - } catch (err) { - setError(err as Error); - } - }, []); - - return { - isScanning, - result, - error, - startScan, - stopScan, - }; -}; \ No newline at end of file diff --git a/src/navigation/index.tsx b/src/navigation/index.tsx index 694ae89..c7b6a67 100644 --- a/src/navigation/index.tsx +++ b/src/navigation/index.tsx @@ -4,7 +4,7 @@ import {createNativeStackNavigator} from '@react-navigation/native-stack'; import {LoginScreen} from '../screens/auth/LoginScreen'; import {HomeScreen} from '../screens/home/HomeScreen'; import {StockInEmpty} from '../screens/stockIn/StockInEmpty'; -import StockInWheelManual from '../screens/stockIn/StockInWheelManual'; +import {StockInManual} from '../screens/stockIn/StockInManual'; import {RootStackParamList} from './types'; import {Platform} from 'react-native'; import {screensEnabled, enableScreens} from 'react-native-screens'; @@ -50,8 +50,8 @@ const Navigation = () => { }} /> { const menuItems: MenuItem[] = [ { title: '空载具入库', icon: 'local-shipping', route: 'StockInEmpty' }, - { title: '手动码盘入库', icon: 'inventory', route: 'StockInWheelManual' }, + { title: '手动码盘入库', icon: 'inventory', route: 'StockInManual' }, ]; const stockData = [ diff --git a/src/screens/stockIn/StockInWheelManual.tsx b/src/screens/stockIn/StockInManual.tsx similarity index 99% rename from src/screens/stockIn/StockInWheelManual.tsx rename to src/screens/stockIn/StockInManual.tsx index 381a2bd..33a1ae3 100644 --- a/src/screens/stockIn/StockInWheelManual.tsx +++ b/src/screens/stockIn/StockInManual.tsx @@ -34,7 +34,7 @@ interface PackageDataItem { lineLocationId: string; } -const StockInWheelManual: React.FC = () => { +export const StockInManual: React.FC = () => { const theme = useTheme(); const navigation = useNavigation(); const [vehicleCode, setVehicleCode] = useState(''); @@ -656,4 +656,4 @@ const styles = StyleSheet.create({ }, }); -export default StockInWheelManual; +export default StockInManual; diff --git a/src/types/index.ts b/src/types/index.ts index 6c322e6..7212ce3 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -18,4 +18,4 @@ export interface DeviceInfo { model: string; osVersion: string; serialNumber: string; -} \ No newline at end of file +} diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 0df16f4..480af3d 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -35,4 +35,4 @@ export const storage = { console.error('Error clearing data', error); } }, -}; \ No newline at end of file +};