林旭祥 преди 6 дни
родител
ревизия
9566a24c4a
променени са 4 файла, в които са добавени 0 реда и са изтрити 266 реда
  1. 0 24
      App.tsx
  2. 0 36
      src/pages/Custom/index.tsx
  3. 0 22
      src/pages/Face/index.tsx
  4. 0 184
      src/pages/Udp/index.tsx

+ 0 - 24
App.tsx

@@ -3,9 +3,6 @@ import { NavigationContainer } from '@react-navigation/native';
 import { createNativeStackNavigator } from '@react-navigation/native-stack';
 import LoginScreen from './src/pages/Login';
 import HomeScreen from './src/pages/Home';
-import FaceScreen from './src/pages/Face';
-import CustomScreen from './src/pages/Custom';
-import UdpScreen from './src/pages/Udp';
 
 const Stack = createNativeStackNavigator();
 
@@ -13,13 +10,6 @@ function App(): React.JSX.Element {
   return (
     <NavigationContainer>
       <Stack.Navigator initialRouteName="Udp">
-        <Stack.Screen
-          name="Udp"
-          component={UdpScreen}
-          options={{
-            title: '测试udp',
-          }}
-        />
         <Stack.Screen
           name="Login"
           component={LoginScreen}
@@ -38,20 +28,6 @@ function App(): React.JSX.Element {
             headerShown: false,
           }}
         />
-        <Stack.Screen
-          name="Face"
-          component={FaceScreen}
-          options={{
-            title: '人脸识别',
-          }}
-        />
-        <Stack.Screen
-          name="Custom"
-          component={CustomScreen}
-          options={{
-            title: '自定义SDK',
-          }}
-        />
       </Stack.Navigator>
     </NavigationContainer>
   );

+ 0 - 36
src/pages/Custom/index.tsx

@@ -1,36 +0,0 @@
-import React from 'react';
-import { View, Button, NativeModules, StyleSheet, Text } from 'react-native';
-
-const { ToastModule } = NativeModules;
-
-const CustomScreen = () => {
-  const showToast = () => {
-    ToastModule.showToast('Hello from Kotlin!', 1); // 1=长时,0=短时
-  };
-
-  const getDeviceName = () => {
-    const device = ToastModule.getDeviceName();
-    alert(`Device: ${device}`);
-  };
-
-  return (
-    <View style={styles.container}>
-      <Button title="显示 Toast" onPress={showToast} />
-      <View style={styles.space} />
-      <Button title="获取设备名称" onPress={getDeviceName} />
-    </View>
-  );
-};
-
-const styles = StyleSheet.create({
-  container: {
-    flex: 1,
-    justifyContent: 'center',
-    padding: 20
-  },
-  space: {
-    height: 10
-  }
-});
-
-export default CustomScreen;

+ 0 - 22
src/pages/Face/index.tsx

@@ -1,22 +0,0 @@
-import React, { useEffect } from 'react';
-import { StyleSheet, Button, View, TouchableOpacity} from 'react-native';
-import { useNavigation } from '@react-navigation/native';
-// import { initFaceSDK, detectFace } from '../../utils/FaceRecognition';
-
-function FaceScreen() {
-  const navigation = useNavigation();
-  const handleDetect = async () => {
-    // const result = await detectFace();
-    // console.log('人脸识别结果:', result);
-  };
-
-  return (
-    <View style={{ flex: 1, justifyContent: 'center' }}>
-      <TouchableOpacity onPress={handleDetect}>
-        <Button title="检测人脸" />
-      </TouchableOpacity>
-    </View>
-  );
-}
-
-export default FaceScreen;

+ 0 - 184
src/pages/Udp/index.tsx

@@ -1,184 +0,0 @@
-import React, { useState } from 'react';
-import {
-  View,
-  Text,
-  TextInput,
-  TouchableOpacity,
-  StyleSheet,
-  Alert,
-  KeyboardAvoidingView,
-  Platform,
-  StatusBar,
-  ActivityIndicator,
-  ToastAndroid
-} from 'react-native';
-import { useNavigation } from '@react-navigation/native';
-import { NativeModules } from 'react-native';
-import dgram from 'react-native-udp';
-console.log("dgram", dgram)
-
-
-
-
-
-const UdpScreen = ({ }) => {
-  const navigation = useNavigation();
-  const [username, setUsername] = useState('');
-  const [password, setPassword] = useState('');
-  const [isLoading, setIsLoading] = useState(false);
-  const [secureTextEntry, setSecureTextEntry] = useState(true);
-
-  const handleLogin = async () => {
-    if (!username || !password) {
-      ToastAndroid.show('请输入信息', 2000);
-      return;
-    }
-    setIsLoading(true);
-    try {
-      // 创建 UDP Socket 实例
-      const socket = dgram.createSocket('udp4');
-      // 检查实例是否创建成功
-      if (socket) {
-        console.log(password, username)
-        // 绑定端口、监听事件等操作
-        socket.bind(password, username, (err) => {
-          if (err) {
-            ToastAndroid.show('绑定失败', 2000);
-          } else { 
-            ToastAndroid.show('初始化成功', 2000);
-          }
-        });
-        // 监听绑定成功事件
-        socket.on('listening', () => {
-          const address = socket.address();
-          console.log("address",address)
-          ToastAndroid.show(`${address.address}:${address.port}`, 2000)
-        });
-      } else {
-        ToastAndroid.show('创建失败', 2000);
-      }
-
-    } catch (error: any) {
-      console.log(error);
-    } finally {
-      setIsLoading(false);
-    }
-  };
-
-  return (
-    <KeyboardAvoidingView
-      behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
-      style={styles.container}>
-      <StatusBar backgroundColor="#1E90FF" barStyle="light-content" />
-
-      <View style={styles.logoContainer}>
-        <Text style={styles.logoText}>测试UDP</Text>
-      </View>
-
-      <View style={styles.formContainer}>
-        <TextInput
-          style={styles.input}
-          placeholder="地址"
-          placeholderTextColor="#999"
-          value={username}
-          onChangeText={setUsername}
-          autoCapitalize="none"
-          autoCorrect={false}
-        />
-
-        <View style={styles.passwordInputContainer}>
-          <TextInput
-            style={styles.input}
-            placeholder="端口"
-            placeholderTextColor="#999"
-            value={password}
-            onChangeText={setPassword}
-            autoCapitalize="none"
-            autoCorrect={false}
-          />
-        </View>
-
-        <TouchableOpacity
-          style={styles.loginButton}
-          onPress={handleLogin}
-          disabled={isLoading}>
-          {isLoading ? (
-            <ActivityIndicator size="small" color="#fff" />
-          ) : (
-            <Text style={styles.loginButtonText}>连 接</Text>
-          )}
-        </TouchableOpacity>
-      </View>
-    </KeyboardAvoidingView>
-  );
-};
-
-const styles = StyleSheet.create({
-  container: {
-    flex: 1,
-    backgroundColor: '#fff',
-    paddingHorizontal: 30,
-  },
-  logoContainer: {
-    flex: 1,
-    justifyContent: 'center',
-    alignItems: 'center',
-  },
-  logoText: {
-    fontSize: 32,
-    fontWeight: 'bold',
-    color: '#1E90FF',
-  },
-  formContainer: {
-    flex: 2,
-    justifyContent: 'center',
-  },
-  input: {
-    height: 50,
-    backgroundColor: '#f5f5f5',
-    borderRadius: 8,
-    paddingHorizontal: 15,
-    marginBottom: 15,
-    fontSize: 16,
-  },
-  passwordInputContainer: {
-    position: 'relative',
-  },
-  togglePassword: {
-    position: 'absolute',
-    right: 15,
-    top: 15,
-  },
-  togglePasswordText: {
-    color: '#1E90FF',
-    fontSize: 14,
-  },
-  loginButton: {
-    height: 50,
-    backgroundColor: '#1E90FF',
-    borderRadius: 8,
-    justifyContent: 'center',
-    alignItems: 'center',
-    marginTop: 10,
-  },
-  loginButtonText: {
-    color: '#fff',
-    fontSize: 18,
-    fontWeight: 'bold',
-  },
-  footer: {
-    flexDirection: 'row',
-    justifyContent: 'center',
-    marginTop: 20,
-  },
-  footerText: {
-    color: '#666',
-  },
-  registerText: {
-    color: '#1E90FF',
-    marginLeft: 5,
-    fontWeight: 'bold',
-  },
-});
-
-export default UdpScreen;